Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** settings *** |
| 2 | Resource ../../common.robot |
| 3 | Library Collections |
| 4 | Library RequestsLibrary |
| 5 | Library OperatingSystem |
| 6 | Library json |
| 7 | Library HttpLibrary.HTTP |
| 8 | |
| 9 | *** Variables *** |
| 10 | @{return_ok_list}= 200 201 202 204 |
| 11 | ${queryswagger_url} /api/vnflcm/v1/swagger.json |
fujinhua | 329de3e | 2019-04-16 08:37:35 +0800 | [diff] [blame] | 12 | ${query_vnfs_url} /api/vnflcm/v1/vnf_instances |
fujinhua | ba33cc4 | 2019-04-04 09:01:32 +0800 | [diff] [blame] | 13 | ${healthcheck_url} /api/vnflcm/v1/health_check |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 14 | |
| 15 | #json files |
| 16 | ${create_vnf_json} ${SCRIPTS}/../tests/vfc/gvnfm-vnflcm/jsoninput/create_vnf.json |
| 17 | |
| 18 | #global variables |
| 19 | ${vnfInstId} |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | VnflcmSwaggerTest |
| 23 | [Documentation] query swagger info vnflcm by MSB |
| 24 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 25 | Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers} |
| 26 | ${resp}= Get Request web_session ${queryswagger_url} |
| 27 | ${responese_code}= Convert To String ${resp.status_code} |
| 28 | List Should Contain Value ${return_ok_list} ${responese_code} |
| 29 | ${response_json} json.loads ${resp.content} |
| 30 | ${swagger_version}= Convert To String ${response_json['swagger']} |
| 31 | Should Be Equal ${swagger_version} 2.0 |
fujinhua | ba33cc4 | 2019-04-04 09:01:32 +0800 | [diff] [blame] | 32 | |
| 33 | VnflcmHealthCheckTest |
| 34 | [Documentation] check health for vnflcm by MSB |
| 35 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 36 | Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers} |
| 37 | ${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 |
fujinhua | 329de3e | 2019-04-16 08:37:35 +0800 | [diff] [blame] | 43 | |
| 44 | VnflcmQueryVnfsTest |
| 45 | [Documentation] check health for vnflcm by MSB |
| 46 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 47 | Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers} |
| 48 | ${resp}= Get Request web_session ${query_vnfs_url} |
| 49 | ${responese_code}= Convert To String ${resp.status_code} |
| 50 | List Should Contain Value ${return_ok_list} ${responese_code} |