Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Variables *** |
| 8 | @{return_ok_list}= 200 201 202 |
| 9 | ${queryswagger_url} /api/vnfres/v1/swagger.json |
fujinhua | 8ba19f3 | 2019-04-04 12:10:57 +0800 | [diff] [blame] | 10 | ${healthcheck_url} /api/vnfres/v1/health_check |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 11 | |
| 12 | *** Test Cases *** |
| 13 | VnfresSwaggerTest |
| 14 | [Documentation] query vnfres swagger info rest test |
| 15 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 16 | Create Session web_session http://${VNFRES_IP}:8802 headers=${headers} |
| 17 | ${resp}= Get Request web_session ${queryswagger_url} |
| 18 | ${responese_code}= Convert To String ${resp.status_code} |
| 19 | List Should Contain Value ${return_ok_list} ${responese_code} |
| 20 | ${response_json} json.loads ${resp.content} |
| 21 | ${swagger_version}= Convert To String ${response_json['swagger']} |
| 22 | Should Be Equal ${swagger_version} 2.0 |
fujinhua | 8ba19f3 | 2019-04-04 12:10:57 +0800 | [diff] [blame] | 23 | |
| 24 | VnfResHealthCheckTest |
| 25 | [Documentation] check health for vnfres by MSB |
| 26 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 27 | Create Session web_session http://${VNFRES_IP}:8802 headers=${headers} |
| 28 | ${resp}= Get Request web_session ${healthcheck_url} |
| 29 | ${responese_code}= Convert To String ${resp.status_code} |
| 30 | List Should Contain Value ${return_ok_list} ${responese_code} |
| 31 | ${response_json} json.loads ${resp.content} |
| 32 | ${health_status}= Convert To String ${response_json['status']} |
| 33 | Should Be Equal ${health_status} active |