blob: 5adafb5aff1c2b4cbafda99208a69888bab5bd6f [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${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${flavor1Id}
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
39
40ListFlavorsFuncTest
41 [Documentation] get a list of flavors info rest test
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 api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/flavors
45 ${response_code}= Convert To String ${resp.status_code}
46 List Should Contain Value ${return_ok_list} ${response_code}
47 ${response_json} json.loads ${resp.content}
48 #Log To Console ${response_json}
49 ${flavor1Id}= Convert To String ${response_json['flavors'][0]['id']}
50 Set Global Variable ${flavor1Id}
51 #Log To Console ${flavor1Id}
52
53GetFlavorFuncTest
54 [Documentation] get the specific flavor info rest test
55 ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN}
56 Create Session web_session http://${VIO_IP}:9004 headers=${headers}
57 ${resp}= GET Request web_session api/multicloud-vio/v0/vmware_fake/nova/${TENANTID}/flavors/${flavor1Id}
58 ${response_code}= Convert To String ${resp.status_code}
59 List Should Contain Value ${return_ok_list} ${response_code}
60 ${response_json} json.loads ${resp.content}
61 #Log To Console ${response_json}
62