blob: 44d23292e41898c960f526da48fac17775e35e0a [file] [log] [blame]
fujinhua79b58a92017-09-04 19:12:01 +08001*** settings ***
fujinhuaa12f3bb2017-09-14 16:28:50 +08002Resource ../../common.robot
fujinhua79b58a92017-09-04 19:12:01 +08003Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
fujinhuac37933b2017-09-14 17:08:59 +08007Library HttpLibrary.HTTP
fujinhua79b58a92017-09-04 19:12:01 +08008
9*** Variables ***
fujinhua57c23982017-09-14 11:17:30 +080010@{return_ok_list}= 200 201 202 204
fujinhua79b58a92017-09-04 19:12:01 +080011${queryswagger_url} /api/nslcm/v1/swagger.json
fujinhua57c23982017-09-14 11:17:30 +080012${create_ns_url} /api/nslcm/v1/ns
13${delete_ns_url} /api/nslcm/v1/ns
14
15#json files
fujinhuac37933b2017-09-14 17:08:59 +080016${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
fujinhua57c23982017-09-14 11:17:30 +080017
18#global variables
19${nsInstId}
fujinhua79b58a92017-09-04 19:12:01 +080020
21*** Test Cases ***
22NslcmSwaggerTest
fujinhuabbb154e2017-09-09 16:29:59 +080023 [Documentation] query swagger info of nslcm
fujinhua8fea9bb2017-09-08 09:26:34 +080024 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
fujinhuafef3f742017-09-09 15:55:18 +080025 Create Session web_session http://${NSLCM_IP}:8403 headers=${headers}
fujinhua8fea9bb2017-09-08 09:26:34 +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']}
31 Should Be Equal ${swagger_version} 2.0
fujinhuabbb154e2017-09-09 16:29:59 +080032
33NslcmSwaggerByMSBTest
34 [Documentation] query swagger info of nslcm by MSB
35 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
36 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
37 ${resp}= Get Request web_session ${queryswagger_url}
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 ${swagger_version}= Convert To String ${response_json['swagger']}
fujinhua57c23982017-09-14 11:17:30 +080042 Should Be Equal ${swagger_version} 2.0
43
44CreateNSTest
45 [Documentation] Create NS function test
46 ${json_value}= json_from_file ${create_ns_json}
47 ${json_string}= string_from_json ${json_value}
48 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
49 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
50 Set Request Body ${json_string}
51 ${resp}= Post Request web_session ${create_ns_url} ${json_string}
52 ${responese_code}= Convert To String ${resp.status_code}
53 List Should Contain Value ${return_ok_list} ${responese_code}
54 ${response_json} json.loads ${resp.content}
55 ${nsInstId}= Convert To String ${response_json['nsInstanceId']}
56 Set Global Variable ${nsInstId}
57
58DeleteNS Test
59 [Documentation] Delete NS function test
60 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
61 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
62 ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId}
63 ${responese_code}= Convert To String ${resp.status_code}
64 List Should Contain Value ${return_ok_list} ${responese_code}