blob: 83040aded4a1923f0f7807f63959c1936b3074fc [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
fujinhua7aa8cd32019-04-05 08:20:53 +080012${create_ns_url} /api/nslcm/v1/ns
13${delete_ns_url} /api/nslcm/v1/ns
fujinhua898e2cb2019-04-18 19:29:04 +080014${get_ns_url} /api/nslcm/v1/ns
fujinhuad5a32832019-04-19 09:45:49 +080015${get_subscriptions_url} /api/nslcm/v1/subscriptions
fujinhua7aa8cd32019-04-05 08:20:53 +080016${healthcheck_url} /api/nslcm/v1/health_check
Gary Wu9abb61c2018-09-27 10:38:50 -070017
18#json files
19${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
20
21#global variables
22${nsInstId}
23
24*** Test Cases ***
25NslcmSwaggerTest
26 [Documentation] query swagger info of nslcm
27 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
28 Create Session web_session http://${NSLCM_IP}:8403 headers=${headers}
29 ${resp}= Get Request web_session ${queryswagger_url}
30 ${responese_code}= Convert To String ${resp.status_code}
31 List Should Contain Value ${return_ok_list} ${responese_code}
32 ${response_json} json.loads ${resp.content}
33 ${swagger_version}= Convert To String ${response_json['swagger']}
34 Should Be Equal ${swagger_version} 2.0
35
36NslcmSwaggerByMSBTest
37 [Documentation] query swagger info of nslcm by MSB
38 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
39 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
40 ${resp}= Get Request web_session ${queryswagger_url}
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 ${swagger_version}= Convert To String ${response_json['swagger']}
45 Should Be Equal ${swagger_version} 2.0
46
47CreateNSTest
48 [Documentation] Create NS function test
49 ${json_value}= json_from_file ${create_ns_json}
50 ${json_string}= string_from_json ${json_value}
51 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
52 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
53 Set Request Body ${json_string}
54 ${resp}= Post Request web_session ${create_ns_url} ${json_string}
55 ${responese_code}= Convert To String ${resp.status_code}
56 List Should Contain Value ${return_ok_list} ${responese_code}
57 ${response_json} json.loads ${resp.content}
58 ${nsInstId}= Convert To String ${response_json['nsInstanceId']}
59 Set Global Variable ${nsInstId}
60
61DeleteNS Test
62 [Documentation] Delete NS function test
63 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
64 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
65 ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId}
66 ${responese_code}= Convert To String ${resp.status_code}
67 List Should Contain Value ${return_ok_list} ${responese_code}
fujinhua7aa8cd32019-04-05 08:20:53 +080068
69LcmHealthCheckTest
70 [Documentation] check health for nslcm by MSB
71 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
72 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
73 ${resp}= Get Request web_session ${healthcheck_url}
74 ${responese_code}= Convert To String ${resp.status_code}
75 List Should Contain Value ${return_ok_list} ${responese_code}
76 ${response_json} json.loads ${resp.content}
77 ${health_status}= Convert To String ${response_json['status']}
78 Should Be Equal ${health_status} active
fujinhua898e2cb2019-04-18 19:29:04 +080079
80LcmGetNsTest
81 [Documentation] get ns instances for nslcm by MSB
82 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
83 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
84 ${resp}= Get Request web_session ${get_ns_url}
85 ${responese_code}= Convert To String ${resp.status_code}
86 List Should Contain Value ${return_ok_list} ${responese_code}
fujinhuad5a32832019-04-19 09:45:49 +080087
88LcmGetSubscriptionsTest
89 [Documentation] get subscriptions for nslcm by MSB
90 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
91 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
92 ${resp}= Get Request web_session ${get_subscriptions_url}
93 ${responese_code}= Convert To String ${resp.status_code}
94 List Should Contain Value ${return_ok_list} ${responese_code}