blob: c035423d786025eeefdbe142eb3a60d2e5bb5799 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Documentation Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +01003Library RequestsLibrary
Gary Wu9abb61c2018-09-27 10:38:50 -07004Library OperatingSystem
5Library Collections
6Library DcaeLibrary
7Resource resources/dcae_keywords.robot
8Resource ../../common.robot
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +01009Resource resources/dcae_properties.robot
Gary Wu9abb61c2018-09-27 10:38:50 -070010Test Setup Cleanup VES Events
11Suite Setup Run keywords VES Collector Suite Setup DMaaP Create sessions Create header
12Suite Teardown VES Collector Suite Shutdown DMaaP
13
14*** Variables ***
15${VESC_URL_HTTPS} https://%{VESC_IP}:8443
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010016${VESC_URL} http://%{VESC_IP}:8080
Gary Wu9abb61c2018-09-27 10:38:50 -070017${VES_ANY_EVENT_PATH} /eventListener/v5
18${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch
19${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010020${VES_ENDPOINT} /eventListener/v7
21${VES_VALID_JSON_V7} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves7_valid.json
22${VES_INVALID_JSON_V7} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves7_invalid.json
Gary Wu13111e92018-09-27 11:31:33 -070023${EVENT_DATA_FILE} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json
24${EVENT_MEASURE_FILE} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json
25${EVENT_DATA_FILE_BAD} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json
26${EVENT_BATCH_DATA_FILE} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json
27${EVENT_THROTTLING_STATE_DATA_FILE} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json
28${EVENT_PNF_REGISTRATION} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_pnf_registration_event.json
Gary Wu9abb61c2018-09-27 10:38:50 -070029
30#DCAE Health Check
31${CONFIG_BINDING_URL} http://localhost:8443
32${CB_HEALTHCHECK_PATH} /healthcheck
33${CB_SERVICE_COMPONENT_PATH} /service_component/
34${VES_Service_Name1} dcae-controller-ves-collector
35${VES_Service_Name2} ves-collector-not-exist
36
37*** Test Cases ***
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010038
39#No authorization tests
40
41VES Collector HTTP Health Check
Gary Wu9abb61c2018-09-27 10:38:50 -070042 [Tags] DCAE-VESC-R1
43 [Documentation] Ves Collector Health Check
44 ${uuid}= Generate UUID
45 ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
46 ${resp}= Get Request ${suite_dcae_vesc_url_session} /healthcheck headers=${headers}
Gary Wu9abb61c2018-09-27 10:38:50 -070047 Should Be Equal As Strings ${resp.status_code} 200
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010048
49Publish Single VES VNF Measurement Event API V7
50 [Tags] DCAE-VESC-R1
51 [Documentation] Post single event and expect 202 Response
52 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
53 ${resp}= Publish Event To VES Collector No Auth ${VES_ENDPOINT} ${evtdata}
54 Log Receive HTTP Status code ${resp.status_code}
55 Should Be Equal As Strings ${resp.status_code} 202
Gary Wu9abb61c2018-09-27 10:38:50 -070056 ${isEmpty}= Is Json Empty ${resp}
57 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
58 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
59 Should Be Equal As Strings ${ret} true
60
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010061
62Publish Single VES VNF Measurement Event with wrong JSON
Gary Wu9abb61c2018-09-27 10:38:50 -070063 [Tags] DCAE-VESC-R1
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010064 [Documentation] Post single event and expect 400 Response
65 ${evtdata}= Get Data From File ${VES_INVALID_JSON_V7}
66 ${resp}= Publish Event To VES Collector No Auth ${VES_ENDPOINT} ${evtdata}
67 Log Receive HTTP Status code ${resp.status_code}
68 Should Be Equal As Strings ${resp.status_code} 400
69 ${isEmpty}= Is Json Empty ${resp}
70 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
71
72Publish Single VES VNF Measurement Event with No Auth over HTTPS
73 [Tags] DCAE-VESC-R1
74 [Documentation] Post single event and expect ConnectionError
75 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
76 ${err_msg}= Run Keyword And Expect Error ConnectionError:* Publish Event To VES Collector ${VES_ENDPOINT} ${evtdata}
77 Should Contain ${err_msg} Errno 111
78 Log Recieved error message ${err_msg}
79
80Publish Single VES VoLTE Fault Event
81 [Tags] DCAE-VESC-R1
82 [Documentation] Post single event and expect 202 Response
83 ${evtdata}= Get Data From File ${EVENT_DATA_FILE}
84 ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata}
85 Log Receive HTTP Status code ${resp.status_code}
86 Should Be Equal As Strings ${resp.status_code} 202
87 ${isEmpty}= Is Json Empty ${resp}
88 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
89 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
90 Should Be Equal As Strings ${ret} true
91
92Publish Single VES VNF Measurement Event API V5
93 [Tags] DCAE-VESC-R1
94 [Documentation] Post single event and expect 202 Response
Gary Wu9abb61c2018-09-27 10:38:50 -070095 ${evtdata}= Get Data From File ${EVENT_MEASURE_FILE}
96 ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata}
97 Log Receive HTTP Status code ${resp.status_code}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +010098 Should Be Equal As Strings ${resp.status_code} 202
Gary Wu9abb61c2018-09-27 10:38:50 -070099 ${isEmpty}= Is Json Empty ${resp}
100 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
101 ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6
102 Should Be Equal As Strings ${ret} true
103
104Publish VES VoLTE Fault Batch Events
105 [Tags] DCAE-VESC-R1
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100106 [Documentation] Post batched events and expect 202 Response
Gary Wu9abb61c2018-09-27 10:38:50 -0700107 ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE}
108 ${resp}= Publish Event To VES Collector No Auth ${VES_BATCH_EVENT_PATH} ${evtdata}
Gary Wu9abb61c2018-09-27 10:38:50 -0700109 Log Receive HTTP Status code ${resp.status_code}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100110 Should Be Equal As Strings ${resp.status_code} 202
Gary Wu9abb61c2018-09-27 10:38:50 -0700111 ${isEmpty}= Is Json Empty ${resp}
112 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100113 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025
114 Should Be Equal As Strings ${ret} true
115
116
Gary Wu9abb61c2018-09-27 10:38:50 -0700117Publish VES Event With Invalid Method
118 [Tags] DCAE-VESC-R1
119 [Documentation] Use invalid Put instead of Post method to expect 405 response
120 ${evtdata}= Get Data From File ${EVENT_DATA_FILE}
121 Log Send HTTP Request with invalid method Put instead of Post
122 ${resp}= Publish Event To VES Collector With Put Method No Auth ${VES_ANY_EVENT_PATH} ${evtdata}
123 Log Receive HTTP Status code ${resp.status_code}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100124 Should Be Equal As Strings ${resp.status_code} 405
125 ${isEmpty}= Is Json Empty ${resp}
126 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
127
Gary Wu9abb61c2018-09-27 10:38:50 -0700128Publish VES Event With Invalid URL Path
129 [Tags] DCAE-VESC-R1
130 [Documentation] Use invalid url path to expect 404 response
131 ${evtdata}= Get Data From File ${EVENT_DATA_FILE}
132 Log Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path
133 ${resp}= Publish Event To VES Collector No Auth /listener/v5/ ${evtdata}
134 Log Receive HTTP Status code ${resp.status_code}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100135 Should Be Equal As Strings ${resp.status_code} 404
136 ${isEmpty}= Is Json Empty ${resp}
137 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
138
139Publish PNF Registration Event
140 [Tags] DCAE-VESC-R1
141 [Documentation] Post PNF registration event and expect 200 Response
142 ${evtdata}= Get Data From File ${EVENT_PNF_REGISTRATION}
143 ${resp}= Publish Event To VES Collector No Auth ${VES_ANY_EVENT_PATH} ${evtdata}
144 Log Receive HTTP Status code ${resp.status_code}
145 Should Be Equal As Strings ${resp.status_code} 202
146 ${isEmpty}= Is Json Empty ${resp}
147 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
148 ${ret}= DMaaP Message Receive QTFCOC540002E-reg
149 Should Be Equal As Strings ${ret} true
150
151
152# Auth by certificate and basic auth username / password
153
154Enable VESC HTTPS with certBasicAuth
155 [Tags] DCAE-VESC-R1
156 [Documentation] Enable VESC Https and Authentication and Run Health Check
157 Enable VESC with certBasicAuth
158 ${uuid}= Generate UUID
159 ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
160 ${resp}= Get Request ${suite_dcae_vesc_url_session} /healthcheck headers=${headers}
161 Should Be Equal As Strings ${resp.status_code} 200
162
Gary Wu9abb61c2018-09-27 10:38:50 -0700163
164Publish Single VES Fault Event Over HTTPS
165 [Tags] DCAE-VESC-R1
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100166 [Documentation] Post single event and expect 202 Response
Gary Wu9abb61c2018-09-27 10:38:50 -0700167 ${evtdata}= Get Data From File ${EVENT_DATA_FILE}
168 Log Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD}
169 ${resp}= Publish Event To VES Collector ${VES_ANY_EVENT_PATH} ${evtdata}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100170 Log Receive HTTPS Status code ${resp.status_code}
171 Should Be Equal As Strings ${resp.status_code} 202
Gary Wu9abb61c2018-09-27 10:38:50 -0700172 ${isEmpty}= Is Json Empty ${resp}
173 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
174 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100175 Should Be Equal As Strings ${ret} true
176
Gary Wu9abb61c2018-09-27 10:38:50 -0700177Publish Single VES Measurement Event Over HTTPS
178 [Tags] DCAE-VESC-R1
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100179 [Documentation] Post single event and expect 202 Response
Gary Wu9abb61c2018-09-27 10:38:50 -0700180 ${evtdata}= Get Data From File ${EVENT_MEASURE_FILE}
181 ${resp}= Publish Event To VES Collector ${VES_ANY_EVENT_PATH} ${evtdata}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100182 Log Receive HTTPS Status code ${resp.status_code}
183 Should Be Equal As Strings ${resp.status_code} 202
Gary Wu9abb61c2018-09-27 10:38:50 -0700184 ${isEmpty}= Is Json Empty ${resp}
185 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
186 ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6
187 Should Be Equal As Strings ${ret} true
188
189Publish VES Fault Batch Events Over HTTPS
190 [Tags] DCAE-VESC-R1
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100191 [Documentation] Post batched events and expect 202 Response
Gary Wu9abb61c2018-09-27 10:38:50 -0700192 ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE}
193 ${resp}= Publish Event To VES Collector ${VES_BATCH_EVENT_PATH} ${evtdata}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100194 Should Be Equal As Strings ${resp.status_code} 202
195 ${isEmpty}= Is Json Empty ${resp}
196 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
Gary Wu9abb61c2018-09-27 10:38:50 -0700197 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025
198 Should Be Equal As Strings ${ret} true
199
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100200
Gary Wu9abb61c2018-09-27 10:38:50 -0700201Publish VES Event With Invalid URL Path HTTPS
202 [Tags] DCAE-VESC-R1
203 [Documentation] Use invalid url path to expect 404 response
204 ${evtdata}= Get Data From File ${EVENT_DATA_FILE}
205 Log Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path
206 ${resp}= Publish Event To VES Collector /eventlistener/v5 ${evtdata}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100207 Log Receive HTTPS Status code ${resp.status_code}
Gary Wu9abb61c2018-09-27 10:38:50 -0700208 Should Be Equal As Strings ${resp.status_code} 404
Gary Wu9abb61c2018-09-27 10:38:50 -0700209 ${isEmpty}= Is Json Empty ${resp}
210 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100211
212Publish Single VES VNF Measurement Event over HTTP
213 [Tags] DCAE-VESC-R1
214 [Documentation] Post single event over HTTP and expect 400 Response
215 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
216 ${resp}= Publish Event To VES Collector No Auth ${VES_ENDPOINT} ${evtdata}
217 Log Receive HTTP Status code ${resp.status_code}
218 Should Be Equal As Strings ${resp.status_code} 400
219 ${isEmpty}= Is Json Empty ${resp}
220 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
221
222
223Publish Single VES VNF Measurement Event with certBasicAuth over HTTPS
224 [Tags] DCAE-VESC-R1
225 [Documentation] Post single event and expect 202 Response
226 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
227 ${resp}= Publish Event To VES Collector ${VES_ENDPOINT} ${evtdata}
228 Log Receive HTTPS Status code ${resp.status_code}
229 Should Be Equal As Strings ${resp.status_code} 202
230 ${isEmpty}= Is Json Empty ${resp}
231 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
232 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
Gary Wu9abb61c2018-09-27 10:38:50 -0700233 Should Be Equal As Strings ${ret} true
Aleksandra Maciagafd6c8fa2019-11-06 15:14:11 +0100234
235Publish Single VES VNF Measurement Event over HTTPS with wrong JSON
236 [Tags] DCAE-VESC-R1
237 [Documentation] Post single event and expect 400 Response
238 ${evtdata}= Get Data From File ${VES_INVALID_JSON_V7}
239 ${resp}= Publish Event To VES Collector ${VES_ENDPOINT} ${evtdata}
240 Log Receive HTTPS Status code ${resp.status_code}
241 Should Be Equal As Strings ${resp.status_code} 400
242 ${isEmpty}= Is Json Empty ${resp}
243 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
244
245Publish Single VES VNF Measurement Event With Wrong Auth
246 [Tags] DCAE-VESC-R1
247 [Documentation] Post single event and expect 401 response
248 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
249 ${resp}= Publish Event To VES Collector With Wrong Auth ${VES_ENDPOINT} ${evtdata}
250 Log Receive HTTPS Status code ${resp.status_code}
251 Should Be Equal As Strings ${resp.status_code} 401
252 ${isEmpty}= Is Json Empty ${resp}
253 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
254
255Publish Single VES VNF Measurement Event With Cert
256 [Tags] DCAE-VESC-R1
257 [Documentation] Post single event and expect 202 response
258 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
259 ${resp}= Publish Event To VES Collector With Cert ${VES_ENDPOINT} ${evtdata}
260 Log Receive HTTPS Status code ${resp.status_code}
261 Should Be Equal As Strings ${resp.status_code} 202
262 ${isEmpty}= Is Json Empty ${resp}
263 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
264 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
265 Should Be Equal As Strings ${ret} true
266
267Publish Single VES VNF Measurement Event With Wrong Cert
268 [Tags] DCAE-VESC-R1
269 [Documentation] Post single event and expect SSLError with bad handshake
270 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
271 ${err_msg}= Run Keyword And Expect Error SSLError:* Publish Event To VES Collector With Wrong Cert ${VES_ENDPOINT} ${evtdata}
272 Should Contain ${err_msg} bad handshake
273 Should Contain ${err_msg} certificate unknown
274 Log Recieved error message ${err_msg}
275
276Publish Single VES VNF Measurement Event Without Auth And Cert
277 [Tags] DCAE-VESC-R1
278 [Documentation] Post single event and expect 401 response
279 ${evtdata}= Get Data From File ${VES_VALID_JSON_V7}
280 ${resp}= Publish Event To VES Collector Without Auth And Cert ${VES_ENDPOINT} ${evtdata}
281 Log Receive HTTPS Status code ${resp.status_code}
282 Should Be Equal As Strings ${resp.status_code} 401
283 ${isEmpty}= Is Json Empty ${resp}
284 Run Keyword If '${isEmpty}' == False Log ${resp.json()}