blob: 1324a1cc86dcddb3af452a5abe070fbecb766265 [file] [log] [blame]
fujinhuadcb405e2017-09-06 16:43:41 +08001*** settings ***
ying.yunlong4f7282b2017-09-28 11:08:29 +08002Resource ../../common.robot
fujinhuadcb405e2017-09-06 16:43:41 +08003Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
ying.yunlong4f7282b2017-09-28 11:08:29 +08007Library HttpLibrary.HTTP
fujinhuadcb405e2017-09-06 16:43:41 +08008
9*** Variables ***
10@{return_ok_list}= 200 201 202
11${queryswagger_url} /api/vnflcm/v1/swagger.json
ying.yunlong3d3f4322017-09-26 15:39:58 +080012${create_vnf_url} /api/vnflcm/v1/vnf_instances
ying.yunlonge08e1b62017-09-26 16:33:53 +080013${delete_vnf_url} /api/vnflcm/v1/vnf_instances
ying.yunlong3d3f4322017-09-26 15:39:58 +080014
15#json files
16${create_vnf_json} ./jsoninput/create_vnf.json
fujinhuadcb405e2017-09-06 16:43:41 +080017
18*** Test Cases ***
fujinhua441febc2017-09-08 13:58:29 +080019VnflcmSwaggerTest
ying.yunlong3d3f4322017-09-26 15:39:58 +080020 [Documentation] query swagger info vnflcm by MSB
fujinhua441febc2017-09-08 13:58:29 +080021 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
ying.yunlong4f7282b2017-09-28 11:08:29 +080022 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
fujinhua441febc2017-09-08 13:58:29 +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
ying.yunlong3d3f4322017-09-26 15:39:58 +080029
30CreateVnfTest
31 [Documentation] Create Vnf function test
32 ${json_value}= json_from_file ${create_vnf_json}
33 ${json_string}= string_from_json ${json_value}
34 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
35 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
36 Set Request Body ${json_string}
37 ${resp}= Post Request web_session ${create_vnf_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 ${vnfInstId}= Convert To String ${response_json['vnfInstanceId']}
ying.yunlonge08e1b62017-09-26 16:33:53 +080042 Set Global Variable ${vnfInstId}
43
44DeleteVnfTest
45 [Documentation] Delete Vnf function test
46 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
47 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
48 ${resp}= Delete Request web_session ${delete_vnf_url}/${vnfInstId}
49 ${responese_code}= Convert To String ${resp.status_code}
50 List Should Contain Value ${return_ok_list} ${responese_code}