2 Resource ../../common.robot
4 Library RequestsLibrary
5 Library OperatingSystem
7 Library HttpLibrary.HTTP
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 ${get_ns_url} /api/nslcm/v1/ns
15 ${get_subscriptions_url} /api/nslcm/v1/subscriptions
16 ${healthcheck_url} /api/nslcm/v1/health_check
19 ${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
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
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
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}
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}
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
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}
88 LcmGetSubscriptionsTest
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}