blob: a9d3b4539eebcfbe7d191e1fa25ae682c089c7a3 [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 ***
ying.yunlong168b0022017-09-28 11:43:25 +080010@{return_ok_list}= 200 201 202 204
fujinhuadcb405e2017-09-06 16:43:41 +080011${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
ying.yunlong168b0022017-09-28 11:43:25 +080016${create_vnf_json} ${SCRIPTS}/../tests/vfc/gvnfm-vnflcm/jsoninput/create_vnf.json
17
18#global variables
19${vnfInstId}
fujinhuadcb405e2017-09-06 16:43:41 +080020
21*** Test Cases ***
fujinhua441febc2017-09-08 13:58:29 +080022VnflcmSwaggerTest
ying.yunlong3d3f4322017-09-26 15:39:58 +080023 [Documentation] query swagger info vnflcm by MSB
fujinhua441febc2017-09-08 13:58:29 +080024 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
ying.yunlong168b0022017-09-28 11:43:25 +080025 Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers}
fujinhua441febc2017-09-08 13:58:29 +080026 ${resp}= Get Request web_session ${queryswagger_url}
27 ${responese_code}= Convert To String ${resp.status_code}
28 List Should Contain Value ${return_ok_list} ${responese_code}
29 ${response_json} json.loads ${resp.content}
30 ${swagger_version}= Convert To String ${response_json['swagger']}
ying.yunlong693c8dc2017-10-10 14:44:41 +080031 Should Be Equal ${swagger_version} 2.0
32
33CreateVnfTest
34 [Documentation] Create Vnf function test
35 ${json_value}= json_from_file ${create_vnf_json}
36 ${json_string}= string_from_json ${json_value}
37 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
38 Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers}
39 Set Request Body ${json_string}
40 ${resp}= Post Request web_session ${create_vnf_url} ${json_string}
41 ${responese_code}= Convert To String ${resp.status_code}
42 List Should Contain Value ${return_ok_list} ${responese_code}
43 ${response_json} json.loads ${resp.content}
44 ${vnfInstId}= Convert To String ${response_json['vnfInstanceId']}
45 Set Global Variable ${vnfInstId}
46
47DeleteVnfTest
48 [Documentation] Delete Vnf function test
49 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
50 Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers}
51 ${resp}= Delete Request web_session ${delete_vnf_url}/${vnfInstId}
52 ${responese_code}= Convert To String ${resp.status_code}
53 List Should Contain Value ${return_ok_list} ${responese_code}