blob: 4fb24c82bfd80a2c375690e35fb5c90a160c3c4e [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** settings ***
fujinhuaf2490e72019-04-28 10:32:40 +08002Resource ../../common.robot
Gary Wu9abb61c2018-09-27 10:38:50 -07003Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
fujinhuaf2490e72019-04-28 10:32:40 +08007Library HttpLibrary.HTTP
Gary Wu9abb61c2018-09-27 10:38:50 -07008
9*** Variables ***
10@{return_ok_list}= 200 201 202
11${queryswagger_url} /api/catalog/v1/swagger.json
12${queryVNFPackage_url} /api/catalog/v1/vnfpackages
13${queryNSPackages_url} /api/catalog/v1/nspackages
fujinhuae23e0472019-04-04 16:24:48 +080014${healthcheck_url} /api/catalog/v1/health_check
fujinhuaf2490e72019-04-28 10:32:40 +080015${create_subs_url} /api/vnfpkgm/v1/subscriptions
16
17#json files
18${vnf_subscription_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_subscription.json
Gary Wu9abb61c2018-09-27 10:38:50 -070019
20*** Test Cases ***
21GetVNFPackages
22 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
23 Create Session web_session http://${CATALOG_IP}:8806 headers=${headers}
24 ${resp}= Get Request web_session ${queryVNFPackage_url}
25 ${responese_code}= Convert To String ${resp.status_code}
26 List Should Contain Value ${return_ok_list} ${responese_code}
fujinhuae23e0472019-04-04 16:24:48 +080027
28CatalogHealthCheckTest
29 [Documentation] check health for catalog by MSB
30 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
31 Create Session web_session http://${CATALOG_IP}:8806 headers=${headers}
32 ${resp}= Get Request web_session ${healthcheck_url}
33 ${responese_code}= Convert To String ${resp.status_code}
34 List Should Contain Value ${return_ok_list} ${responese_code}
35 ${response_json} json.loads ${resp.content}
36 ${health_status}= Convert To String ${response_json['status']}
37 Should Be Equal ${health_status} active
fujinhuaf2490e72019-04-28 10:32:40 +080038
39CreateVnfSubscriptionTest
40 [Documentation] Create Vnf Subscription function test
41 ${json_value}= json_from_file ${vnf_subscription_json}
42 ${json_string}= string_from_json ${json_value}
43 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
44 Create Session web_session http://${CATALOG_IP}:8806 headers=${headers}
45 Set Request Body ${json_string}
46 ${resp}= Post Request web_session ${create_subs_url} ${json_string}
47 ${responese_code}= Convert To String ${resp.status_code}
48 List Should Contain Value ${return_ok_list} ${responese_code}
49 ${response_json} json.loads ${resp.content}
50 ${callback_uri}= Convert To String ${response_json['callbackUri']}
51 Should Be Equal ${callback_uri} http://127.0.0.1:8806/api/catalog/v1/callback_sample