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 |
| 11 | |
| 12 | #json files |
| 13 | ${create_vnf_json} ./jsoninput/create_vnf.json |
fujinhua | dcb405e | 2017-09-06 16:43:41 +0800 | [diff] [blame] | 14 | |
| 15 | *** Test Cases *** |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 16 | VnflcmSwaggerTest |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame^] | 17 | [Documentation] query swagger info vnflcm by MSB |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 18 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
ying.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame^] | 19 | Create Session web_session http://${MSB_IAG_IP}:8801 headers=${headers} |
fujinhua | 441febc | 2017-09-08 13:58:29 +0800 | [diff] [blame] | 20 | ${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.yunlong | 3d3f432 | 2017-09-26 15:39:58 +0800 | [diff] [blame^] | 26 | |
| 27 | CreateVnfTest |
| 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} |