blob: 4848b745965de79f5f3ac745345e6aa3310f41ea [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** settings ***
2Resource ../../common.robot
3Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library 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 ***
15BrokerSwaggerTest
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
26BrokerCapacityTest
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}