blob: 44d23292e41898c960f526da48fac17775e35e0a [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** settings ***
2Resource ../../common.robot
3Library Collections
4Library RequestsLibrary
5Library OperatingSystem
6Library json
7Library HttpLibrary.HTTP
8
9*** Variables ***
10@{return_ok_list}= 200 201 202 204
11${queryswagger_url} /api/nslcm/v1/swagger.json
12${create_ns_url} /api/nslcm/v1/ns
13${delete_ns_url} /api/nslcm/v1/ns
14
15#json files
16${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
17
18#global variables
19${nsInstId}
20
21*** Test Cases ***
22NslcmSwaggerTest
23 [Documentation] query swagger info of nslcm
24 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
25 Create Session web_session http://${NSLCM_IP}:8403 headers=${headers}
26 ${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
32
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']}
42 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}