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 ${healthcheck_url} /api/nslcm/v1/health_check
18 ${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
25 [Documentation] query swagger info of nslcm
26 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
27 Create Session web_session http://${NSLCM_IP}:8403 headers=${headers}
28 ${resp}= Get Request web_session ${queryswagger_url}
29 ${responese_code}= Convert To String ${resp.status_code}
30 List Should Contain Value ${return_ok_list} ${responese_code}
31 ${response_json} json.loads ${resp.content}
32 ${swagger_version}= Convert To String ${response_json['swagger']}
33 Should Be Equal ${swagger_version} 2.0
36 [Documentation] query swagger info of nslcm by MSB
37 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
38 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
39 ${resp}= Get Request web_session ${queryswagger_url}
40 ${responese_code}= Convert To String ${resp.status_code}
41 List Should Contain Value ${return_ok_list} ${responese_code}
42 ${response_json} json.loads ${resp.content}
43 ${swagger_version}= Convert To String ${response_json['swagger']}
44 Should Be Equal ${swagger_version} 2.0
47 [Documentation] Create NS function test
48 ${json_value}= json_from_file ${create_ns_json}
49 ${json_string}= string_from_json ${json_value}
50 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
51 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
52 Set Request Body ${json_string}
53 ${resp}= Post Request web_session ${create_ns_url} ${json_string}
54 ${responese_code}= Convert To String ${resp.status_code}
55 List Should Contain Value ${return_ok_list} ${responese_code}
56 ${response_json} json.loads ${resp.content}
57 ${nsInstId}= Convert To String ${response_json['nsInstanceId']}
58 Set Global Variable ${nsInstId}
61 [Documentation] Delete NS function test
62 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
63 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
64 ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId}
65 ${responese_code}= Convert To String ${resp.status_code}
66 List Should Contain Value ${return_ok_list} ${responese_code}
69 [Documentation] check health for nslcm by MSB
70 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
71 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
72 ${resp}= Get Request web_session ${healthcheck_url}
73 ${responese_code}= Convert To String ${resp.status_code}
74 List Should Contain Value ${return_ok_list} ${responese_code}
75 ${response_json} json.loads ${resp.content}
76 ${health_status}= Convert To String ${response_json['status']}
77 Should Be Equal ${health_status} active
80 [Documentation] get ns instances for nslcm by MSB
81 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
82 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
83 ${resp}= Get Request web_session ${get_ns_url}
84 ${responese_code}= Convert To String ${resp.status_code}
85 List Should Contain Value ${return_ok_list} ${responese_code}