2 Resource ../../common.robot
4 Library RequestsLibrary
5 Library OperatingSystem
7 Library HttpLibrary.HTTP
11 @{return_ok_list}= 200 201 202
12 ${get_token_url} /api/multicloud-vio/v0/vmware_fake/identity/v3/auth/tokens
15 ${auth_info_json} ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/auth_info.json
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}
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}
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}