blob: af7b8874f7e9fe03ed3b980f3463193bc73f9a32 [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 ***
fujinhua73c74802019-04-28 16:27:22 +080010@{return_ok_list}= 200 201 202 204
11${catalog_port} 8806
Gary Wu9abb61c2018-09-27 10:38:50 -070012${queryswagger_url} /api/catalog/v1/swagger.json
13${queryVNFPackage_url} /api/catalog/v1/vnfpackages
14${queryNSPackages_url} /api/catalog/v1/nspackages
fujinhuae23e0472019-04-04 16:24:48 +080015${healthcheck_url} /api/catalog/v1/health_check
fujinhuaf2490e72019-04-28 10:32:40 +080016${create_subs_url} /api/vnfpkgm/v1/subscriptions
fujinhua73c74802019-04-28 16:27:22 +080017${delete_subs_url} /api/vnfpkgm/v1/subscriptions
fujinhuaf2490e72019-04-28 10:32:40 +080018
19#json files
20${vnf_subscription_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/vnf_subscription.json
Gary Wu9abb61c2018-09-27 10:38:50 -070021
fujinhua73c74802019-04-28 16:27:22 +080022#global variables
23${subscriptionId}
24
Gary Wu9abb61c2018-09-27 10:38:50 -070025*** Test Cases ***
26GetVNFPackages
27 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
fujinhua73c74802019-04-28 16:27:22 +080028 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
Gary Wu9abb61c2018-09-27 10:38:50 -070029 ${resp}= Get Request web_session ${queryVNFPackage_url}
30 ${responese_code}= Convert To String ${resp.status_code}
31 List Should Contain Value ${return_ok_list} ${responese_code}
fujinhuae23e0472019-04-04 16:24:48 +080032
33CatalogHealthCheckTest
34 [Documentation] check health for catalog by MSB
35 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
fujinhua73c74802019-04-28 16:27:22 +080036 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
fujinhuae23e0472019-04-04 16:24:48 +080037 ${resp}= Get Request web_session ${healthcheck_url}
38 ${responese_code}= Convert To String ${resp.status_code}
39 List Should Contain Value ${return_ok_list} ${responese_code}
40 ${response_json} json.loads ${resp.content}
41 ${health_status}= Convert To String ${response_json['status']}
42 Should Be Equal ${health_status} active
fujinhuaf2490e72019-04-28 10:32:40 +080043
44CreateVnfSubscriptionTest
45 [Documentation] Create Vnf Subscription function test
46 ${json_value}= json_from_file ${vnf_subscription_json}
47 ${json_string}= string_from_json ${json_value}
48 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
fujinhua73c74802019-04-28 16:27:22 +080049 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
fujinhuaf2490e72019-04-28 10:32:40 +080050 Set Request Body ${json_string}
51 ${resp}= Post Request web_session ${create_subs_url} ${json_string}
52 ${responese_code}= Convert To String ${resp.status_code}
53 List Should Contain Value ${return_ok_list} ${responese_code}
54 ${response_json} json.loads ${resp.content}
55 ${callback_uri}= Convert To String ${response_json['callbackUri']}
fujinhua73c74802019-04-28 16:27:22 +080056 Should Be Equal ${callback_uri} http://127.0.0.1:${catalog_port}/api/catalog/v1/callback_sample
57 ${subscriptionId}= Convert To String ${response_json['id']}
58 Set Global Variable ${subscriptionId}
59
60DeleteVnfSubscriptionTest
61 [Documentation] Delete Vnf Subscription function test
62 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
63 Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers}
64 ${resp}= Delete Request web_session ${delete_subs_url}/${subscriptionId}
65 ${responese_code}= Convert To String ${resp.status_code}
66 List Should Contain Value ${return_ok_list} ${responese_code}