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 | |
| 8 | *** Variables *** |
| 9 | @{return_ok_list}= 200 201 202 |
| 10 | ${queryswagger_broker_url} /api/multicloud/v0/swagger.json |
| 11 | ${check_capacity_broker_url} /api/multicloud/v0/check_vim_capacity |
| 12 | |
| 13 | |
| 14 | *** Test Cases *** |
| 15 | BrokerSwaggerTest |
| 16 | [Documentation] query swagger info rest test |
| 17 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 18 | Create Session web_session http://${BROKER_IP}:9001 headers=${headers} |
| 19 | ${resp}= Get Request web_session ${queryswagger_broker_url} |
| 20 | ${responese_code}= Convert To String ${resp.status_code} |
| 21 | List Should Contain Value ${return_ok_list} ${responese_code} |
| 22 | ${response_json} json.loads ${resp.content} |
| 23 | ${swagger_version}= Convert To String ${response_json['swagger']} |
| 24 | Should Be Equal ${swagger_version} 2.0 |
| 25 | |
| 26 | BrokerCapacityTest |
| 27 | [Documentation] Check VIMs capacity |
| 28 | ${data}= Get Binary File ${CURDIR}${/}data${/}capacity.json |
| 29 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 30 | Create Session web_session http://${BROKER_IP}:9001 headers=${headers} |
| 31 | ${resp}= Post Request web_session ${check_capacity_broker_url} ${data} |
| 32 | ${responese_code}= Convert To String ${resp.status_code} |
| 33 | List Should Contain Value ${return_ok_list} ${responese_code} |