fujinhua | dcb405e | 2017-09-06 16:43:41 +0800 | [diff] [blame] | 1 | *** settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Variables *** |
| 8 | @{return_ok_list}= 200 201 202 |
| 9 | ${queryswagger_url} /api/vnflcm/v1/swagger.json |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame] | 10 | ${create_vnf_url} /api/vnflcm/v1/vnf_instances |
ying.yunlong | e08e1b6 | 2017-09-26 16:33:53 +0800 | [diff] [blame] | 11 | ${delete_vnf_url} /api/vnflcm/v1/vnf_instances |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame] | 12 | |
| 13 | #json files |
| 14 | ${create_vnf_json} ./jsoninput/create_vnf.json |
fujinhua | dcb405e | 2017-09-06 16:43:41 +0800 | [diff] [blame] | 15 | |
| 16 | *** Test Cases *** |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 17 | VnflcmSwaggerTest |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame] | 18 | [Documentation] query swagger info vnflcm by MSB |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 19 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame] | 20 | Create Session web_session http://${MSB_IAG_IP}:8801 headers=${headers} |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 21 | ${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.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame] | 27 | |
| 28 | CreateVnfTest |
| 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.yunlong | e08e1b6 | 2017-09-26 16:33:53 +0800 | [diff] [blame] | 40 | Set Global Variable ${vnfInstId} |
| 41 | |
| 42 | DeleteVnfTest |
| 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} |