blob: 9bb85b891c66ea4b49622cac5a24ab787218b932 [file] [log] [blame]
luxind0247592017-09-09 15:08:52 +08001*** settings ***
luxin1e0f6df2017-09-20 17:40:52 +08002Resource ../../common.robot
luxind0247592017-09-09 15:08:52 +08003Library Collections
4Library RequestsLibrary
5Library simplejson
6Library OperatingSystem
7Library json
8Library HttpLibrary.HTTP
9
10*** Variables ***
luxin38df25a2017-09-20 11:27:40 +080011@{return_ok_list}= 200 201 202 204
luxind0247592017-09-09 15:08:52 +080012${queryswagger_url} /api/hwvnfm/v1/swagger.json
luxin38df25a2017-09-20 11:27:40 +080013${createauthtoken_url} /rest/vnfmmed/v2/auth/tokens
14
15#json files
16${hwvnfm_createtoken_json} ${SCRIPTS}/../tests/vfc/nfvo-driver-svnfm/jsoninput/hwvnfm_createtoken.json
luxind0247592017-09-09 15:08:52 +080017
18*** Test Cases ***
19SwaggerFuncTest
20 [Documentation] query swagger info rest test
luxin38df25a2017-09-20 11:27:40 +080021 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
luxin1e0f6df2017-09-20 17:40:52 +080022 Create Session web_session http://${SERVICE_IP}:8482 headers=${headers}
luxin38df25a2017-09-20 11:27:40 +080023 ${resp}= Get Request web_session ${queryswagger_url}
24 ${responese_code}= Convert To String ${resp.status_code}
25 List Should Contain Value ${return_ok_list} ${responese_code}
26 ${response_json} json.loads ${resp.content}
27 ${swagger_version}= Convert To String ${response_json['swagger']}
28 Should Be Equal ${swagger_version} 2.0
29
30AuthTokenFuncTest
31 [Documentation] create auth token rest test
32 ${json_value}= json_from_file ${hwvnfm_createtoken_json}
33 ${json_string}= string_from_json ${json_value}
34 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
luxin1e0f6df2017-09-20 17:40:52 +080035 Create Session web_session http://${SERVICE_IP}:8482 headers=${headers}
luxin38df25a2017-09-20 11:27:40 +080036 Set Request Body ${json_string}
37 ${resp}= Post Request web_session ${createauthtoken_url} ${json_string}
38 ${responese_code}= Convert To String ${resp.status_code}
39 List Should Contain Value ${return_ok_list} ${responese_code}
40 ${response_json} json.loads ${resp.content}
41 Dictionary Should Contain Key ${response_json} token