blob: 6711cf69636c0213e0ef16a0c010f6f2b72c6259 [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
14${healthcheck_url} /api/nslcm/v1/health_check
Gary Wu9abb61c2018-09-27 10:38:50 -070015
16#json files
17${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
18
19#global variables
20${nsInstId}
21
22*** Test Cases ***
23NslcmSwaggerTest
24 [Documentation] query swagger info of nslcm
25 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
26 Create Session web_session http://${NSLCM_IP}:8403 headers=${headers}
27 ${resp}= Get Request web_session ${queryswagger_url}
28 ${responese_code}= Convert To String ${resp.status_code}
29 List Should Contain Value ${return_ok_list} ${responese_code}
30 ${response_json} json.loads ${resp.content}
31 ${swagger_version}= Convert To String ${response_json['swagger']}
32 Should Be Equal ${swagger_version} 2.0
33
34NslcmSwaggerByMSBTest
35 [Documentation] query swagger info of nslcm by MSB
36 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
37 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
38 ${resp}= Get Request web_session ${queryswagger_url}
39 ${responese_code}= Convert To String ${resp.status_code}
40 List Should Contain Value ${return_ok_list} ${responese_code}
41 ${response_json} json.loads ${resp.content}
42 ${swagger_version}= Convert To String ${response_json['swagger']}
43 Should Be Equal ${swagger_version} 2.0
44
45CreateNSTest
46 [Documentation] Create NS function test
47 ${json_value}= json_from_file ${create_ns_json}
48 ${json_string}= string_from_json ${json_value}
49 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
50 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
51 Set Request Body ${json_string}
52 ${resp}= Post Request web_session ${create_ns_url} ${json_string}
53 ${responese_code}= Convert To String ${resp.status_code}
54 List Should Contain Value ${return_ok_list} ${responese_code}
55 ${response_json} json.loads ${resp.content}
56 ${nsInstId}= Convert To String ${response_json['nsInstanceId']}
57 Set Global Variable ${nsInstId}
58
59DeleteNS Test
60 [Documentation] Delete NS function test
61 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
62 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
63 ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId}
64 ${responese_code}= Convert To String ${resp.status_code}
65 List Should Contain Value ${return_ok_list} ${responese_code}
fujinhua7aa8cd32019-04-05 08:20:53 +080066
67LcmHealthCheckTest
68 [Documentation] check health for nslcm by MSB
69 ${headers} Create Dictionary Content-Type=application/json Accept=application/json
70 Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
71 ${resp}= Get Request web_session ${healthcheck_url}
72 ${responese_code}= Convert To String ${resp.status_code}
73 List Should Contain Value ${return_ok_list} ${responese_code}
74 ${response_json} json.loads ${resp.content}
75 ${health_status}= Convert To String ${response_json['status']}
76 Should Be Equal ${health_status} active