blob: d38b9983b575e3a3e4bb30d954981466488749b3 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** 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@{delete_ok_list}= 200 204
13${get_token_url} /api/multicloud-vio/v0/vmware_fake/identity/v3/auth/tokens
14${get_networks_url} /api/multicloud-vio/v0/vmware_fake/neutron/networks
15
16#json files
17${auth_info_json} ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/auth_info.json
18
19#global vars
20${TOKEN}
21${NETWORKID}
22
23*** Test Cases ***
24
25GetAuthToken
26 [Documentation] Sanity test - Get Auth Token
27 ${json_value}= json_from_file ${auth_info_json}
28 ${json_string}= string_from_json ${json_value}
29 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
30 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
31 ${resp}= POST Request web_session ${get_token_url} ${json_string}
32 ${responese_code}= Convert To String ${resp.status_code}
33 List Should Contain Value ${return_ok_list} ${responese_code}
34 ${response_json} json.loads ${resp.content}
35 ${TOKEN}= Convert To String ${response_json['token']['value']}
36 ${TENANTID}= Convert To String ${response_json['token']['project']['id']}
37 Set Global Variable ${TOKEN}
38
39
40TestCaseListNetworks
41 [Documentation] Sanity test - List Networks
42 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
43 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
44 ${resp}= Get Request web_session ${get_networks_url}
45 ${responese_code}= Convert To String ${resp.status_code}
46 List Should Contain Value ${return_ok_list} ${responese_code}
47 ${response_json} json.loads ${resp.content}
48 ${NETWORKID}= Convert To String ${response_json['networks'][0]['id']}
49 Set Global Variable ${NETWORKID}
50
51
52
53
54TestCaseShowNetwork
55 [Documentation] Sanity test - Show Network
56 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
57 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
58 ${resp}= Get Request web_session ${get_networks_url}/${NETWORKID}
59 ${responese_code}= Convert To String ${resp.status_code}
60 List Should Contain Value ${return_ok_list} ${responese_code}
61 ${response_json} json.loads ${resp.content}
62 Should Be Equal ${response_json['network']['status']} ACTIVE