blob: 9cfdda08de55589dfebd6dd8a1b81d465b912b98 [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
ying.yunlonge08e1b62017-09-26 16:33:53 +080011${delete_vnf_url} /api/vnflcm/v1/vnf_instances
ying.yunlong3d3f4322017-09-26 15:39:58 +080012
13#json files
14${create_vnf_json} ./jsoninput/create_vnf.json
fujinhuadcb405e2017-09-06 16:43:41 +080015
16*** Test Cases ***
fujinhua441febc2017-09-08 13:58:29 +080017VnflcmSwaggerTest
ying.yunlong3d3f4322017-09-26 15:39:58 +080018 [Documentation] query swagger info vnflcm by MSB
fujinhua441febc2017-09-08 13:58:29 +080019 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
ying.yunlong3d3f4322017-09-26 15:39:58 +080020 Create Session web_session http://${MSB_IAG_IP}:8801 headers=${headers}
fujinhua441febc2017-09-08 13:58:29 +080021 ${resp}= Get Request web_session ${queryswagger_url}
22 ${responese_code}= Convert To String ${resp.status_code}
23 List Should Contain Value ${return_ok_list} ${responese_code}
24 ${response_json} json.loads ${resp.content}
25 ${swagger_version}= Convert To String ${response_json['swagger']}
26 Should Be Equal ${swagger_version} 2.0
ying.yunlong3d3f4322017-09-26 15:39:58 +080027
28CreateVnfTest
29 [Documentation] Create Vnf function test
30 ${json_value}= json_from_file ${create_vnf_json}
31 ${json_string}= string_from_json ${json_value}
32 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
33 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
34 Set Request Body ${json_string}
35 ${resp}= Post Request web_session ${create_vnf_url} ${json_string}
36 ${responese_code}= Convert To String ${resp.status_code}
37 List Should Contain Value ${return_ok_list} ${responese_code}
38 ${response_json} json.loads ${resp.content}
39 ${vnfInstId}= Convert To String ${response_json['vnfInstanceId']}
ying.yunlonge08e1b62017-09-26 16:33:53 +080040 Set Global Variable ${vnfInstId}
41
42DeleteVnfTest
43 [Documentation] Delete Vnf function test
44 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
45 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
46 ${resp}= Delete Request web_session ${delete_vnf_url}/${vnfInstId}
47 ${responese_code}= Convert To String ${resp.status_code}
48 List Should Contain Value ${return_ok_list} ${responese_code}