blob: 444c68e1a8bb38bba1a9cb0b3584abb2baa60577 [file] [log] [blame]
Bin Sun102cee62017-09-27 14:57:21 +08001*** settings ***
2Resource ../../common.robot
3Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
7Library HttpLibrary.HTTP
8
9
10*** Variables ***
11@{return_ok_list}= 200 201 202
12${get_token_url} /api/multicloud-vio/v0/vmware_fake/identity/v3/auth/tokens
13
14#json files
15${auth_info_json} ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/auth_info.json
16
17#global vars
18${TOKEN}
19${TENANTID}
20${host1Id}
21
22*** Test Cases ***
23
24GetAuthToken
25 [Documentation] Sanity test - Get Auth Token
26 ${json_value}= json_from_file ${auth_info_json}
27 ${json_string}= string_from_json ${json_value}
28 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
29 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
30 ${resp}= POST Request web_session ${get_token_url} ${json_string}
31 ${responese_code}= Convert To String ${resp.status_code}
32 List Should Contain Value ${return_ok_list} ${responese_code}
33 ${response_json} json.loads ${resp.content}
34 ${TOKEN}= Convert To String ${response_json['token']['value']}
35 ${TENANTID}= Convert To String ${response_json['token']['project']['id']}
36 Set Global Variable ${TOKEN}
37 Set Global Variable ${TENANTID}
38
39TestListHosts
40 [Documentation] Sanity Test - List Hosts
41 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
42 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
43 ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/os-hypervisors/detail
44 ${response_code}= Convert To String ${resp.status_code}
45 List Should Contain Value ${return_ok_list} ${response_code}
46 ${response_json} json.loads ${resp.content}
47 #Log To Console ${response_json}
48 ${host1Id}= Convert To String ${response_json['hypervisors'][0]['service']['id']}
49 Set Global Variable ${host1Id}
50
51TestGetHost
52 [Documentation] Sanity Test - Get Host
53 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
54 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
55 ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/os-hypervisors/${host1Id}
56 ${response_code}= Convert To String ${resp.status_code}
57 List Should Contain Value ${return_ok_list} ${response_code}
58 ${response_json} json.loads ${resp.content}
59 #Log To Console ${response_json}
60
61TestHostUptime
62 [Documentation] Sanity Test - Host Uptime
63 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
64 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
65 ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/os-hypervisors/uptime
66 ${response_code}= Convert To String ${resp.status_code}
67 List Should Contain Value ${return_ok_list} ${response_code}
68 ${response_json} json.loads ${resp.content}
69 #Log To Console ${response_json}
70
71
72TestHostAggregates
73 [Documentation] Sanity Test - Host Aggregates
74 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
75 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
76 ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/os-aggregates
77 ${response_code}= Convert To String ${resp.status_code}
78 List Should Contain Value ${return_ok_list} ${response_code}
79 ${response_json} json.loads ${resp.content}
80 #Log To Console ${response_json}
81
82
83