fujinhua | fafc922 | 2019-04-04 15:17:31 +0800 | [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/vnfmgr/v1/swagger.json |
| 10 | ${healthcheck_url} /api/vnfmgr/v1/health_check |
| 11 | |
| 12 | *** Test Cases *** |
| 13 | VnfMgrSwaggerTest |
| 14 | [Documentation] query vnfmgr swagger info rest test |
| 15 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 16 | Create Session web_session http://${VNFMGR_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 |
| 23 | |
| 24 | VnfMgrHealthCheckTest |
| 25 | [Documentation] check health for vnfmgr by MSB |
| 26 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 27 | Create Session web_session http://${VNFMGR_IP}:8803 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 |