Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** settings *** |
fujinhua | f2490e7 | 2019-04-28 10:32:40 +0800 | [diff] [blame^] | 2 | Resource ../../common.robot |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 3 | Library Collections |
| 4 | Library RequestsLibrary |
| 5 | Library OperatingSystem |
| 6 | Library json |
fujinhua | f2490e7 | 2019-04-28 10:32:40 +0800 | [diff] [blame^] | 7 | Library HttpLibrary.HTTP |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 8 | |
| 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 |
fujinhua | e23e047 | 2019-04-04 16:24:48 +0800 | [diff] [blame] | 14 | ${healthcheck_url} /api/catalog/v1/health_check |
fujinhua | f2490e7 | 2019-04-28 10:32:40 +0800 | [diff] [blame^] | 15 | ${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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 19 | |
| 20 | *** Test Cases *** |
| 21 | GetVNFPackages |
| 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} |
fujinhua | e23e047 | 2019-04-04 16:24:48 +0800 | [diff] [blame] | 27 | |
| 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 |
fujinhua | f2490e7 | 2019-04-28 10:32:40 +0800 | [diff] [blame^] | 38 | |
| 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 |