2 Resource ../../common.robot
4 Library RequestsLibrary
5 Library OperatingSystem
7 Library HttpLibrary.HTTP
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
14 ${healthcheck_url} /api/catalog/v1/health_check
15 ${create_subs_url} /api/vnfpkgm/v1/subscriptions
18 ${vnf_subscription_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_subscription.json
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}
28 CatalogHealthCheckTest
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
39 CreateVnfSubscriptionTest
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