blob: 08844e55fc7ebb9e65f50e97e38ba381df7fba6b [file] [log] [blame]
fujinhuadcb405e2017-09-06 16:43:41 +08001*** settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Variables ***
8@{return_ok_list}= 200 201 202
9${queryswagger_url} /api/vnflcm/v1/swagger.json
ying.yunlong3d3f4322017-09-26 15:39:58 +080010${create_vnf_url} /api/vnflcm/v1/vnf_instances
11
12#json files
13${create_vnf_json} ./jsoninput/create_vnf.json
fujinhuadcb405e2017-09-06 16:43:41 +080014
15*** Test Cases ***
fujinhua441febc2017-09-08 13:58:29 +080016VnflcmSwaggerTest
ying.yunlong3d3f4322017-09-26 15:39:58 +080017 [Documentation] query swagger info vnflcm by MSB
fujinhua441febc2017-09-08 13:58:29 +080018 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
ying.yunlong3d3f4322017-09-26 15:39:58 +080019 Create Session web_session http://${MSB_IAG_IP}:8801 headers=${headers}
fujinhua441febc2017-09-08 13:58:29 +080020 ${resp}= Get Request web_session ${queryswagger_url}
21 ${responese_code}= Convert To String ${resp.status_code}
22 List Should Contain Value ${return_ok_list} ${responese_code}
23 ${response_json} json.loads ${resp.content}
24 ${swagger_version}= Convert To String ${response_json['swagger']}
25 Should Be Equal ${swagger_version} 2.0
ying.yunlong3d3f4322017-09-26 15:39:58 +080026
27CreateVnfTest
28 [Documentation] Create Vnf function test
29 ${json_value}= json_from_file ${create_vnf_json}
30 ${json_string}= string_from_json ${json_value}
31 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
32 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
33 Set Request Body ${json_string}
34 ${resp}= Post Request web_session ${create_vnf_url} ${json_string}
35 ${responese_code}= Convert To String ${resp.status_code}
36 List Should Contain Value ${return_ok_list} ${responese_code}
37 ${response_json} json.loads ${resp.content}
38 ${vnfInstId}= Convert To String ${response_json['vnfInstanceId']}
39 Set Global Variable ${vnfInstId}