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