2 Documentation Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios
3 Library RequestsLibrary
4 Library OperatingSystem
7 Resource resources/dcae_keywords.robot
8 Resource ../../common.robot
9 Resource resources/dcae_properties.robot
10 Test Setup Cleanup VES Events
11 Suite Setup Run keywords VES Collector Suite Setup DMaaP Create sessions Create header
12 Suite Teardown VES Collector Suite Shutdown DMaaP
15 ${VESC_URL_HTTPS} https://%{VESC_IP}:8443
16 ${VESC_URL} http://%{VESC_IP}:8080
17 ${VES_ANY_EVENT_PATH} /eventListener/v5
18 ${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch
19 ${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState
20 ${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
23 ${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
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
39 #No authorization tests
41 VES Collector HTTP Health Check
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}
47 Should Be Equal As Strings ${resp.status_code} 200
49 Publish Single VES VNF Measurement Event API V7
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
56 ${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
62 Publish Single VES VNF Measurement Event with wrong JSON
64 [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()}
72 Publish Single VES VNF Measurement Event with No Auth over HTTPS
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}
80 Publish Single VES VoLTE Fault Event
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
92 Publish Single VES VNF Measurement Event API V5
94 [Documentation] Post single event and expect 202 Response
95 ${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}
98 Should Be Equal As Strings ${resp.status_code} 202
99 ${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
104 Publish VES VoLTE Fault Batch Events
106 [Documentation] Post batched events and expect 202 Response
107 ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE}
108 ${resp}= Publish Event To VES Collector No Auth ${VES_BATCH_EVENT_PATH} ${evtdata}
109 Log Receive HTTP Status code ${resp.status_code}
110 Should Be Equal As Strings ${resp.status_code} 202
111 ${isEmpty}= Is Json Empty ${resp}
112 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
113 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025
114 Should Be Equal As Strings ${ret} true
117 Publish VES Event With Invalid Method
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}
124 Should Be Equal As Strings ${resp.status_code} 405
125 ${isEmpty}= Is Json Empty ${resp}
126 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
128 Publish VES Event With Invalid URL Path
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}
135 Should Be Equal As Strings ${resp.status_code} 404
136 ${isEmpty}= Is Json Empty ${resp}
137 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
139 Publish PNF Registration Event
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
152 # Auth by certificate and basic auth username / password
154 Enable VESC HTTPS with certBasicAuth
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
164 Publish Single VES Fault Event Over HTTPS
166 [Documentation] Post single event and expect 202 Response
167 ${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}
170 Log Receive HTTPS Status code ${resp.status_code}
171 Should Be Equal As Strings ${resp.status_code} 202
172 ${isEmpty}= Is Json Empty ${resp}
173 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
174 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
175 Should Be Equal As Strings ${ret} true
177 Publish Single VES Measurement Event Over HTTPS
179 [Documentation] Post single event and expect 202 Response
180 ${evtdata}= Get Data From File ${EVENT_MEASURE_FILE}
181 ${resp}= Publish Event To VES Collector ${VES_ANY_EVENT_PATH} ${evtdata}
182 Log Receive HTTPS Status code ${resp.status_code}
183 Should Be Equal As Strings ${resp.status_code} 202
184 ${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
189 Publish VES Fault Batch Events Over HTTPS
191 [Documentation] Post batched events and expect 202 Response
192 ${evtdata}= Get Data From File ${EVENT_BATCH_DATA_FILE}
193 ${resp}= Publish Event To VES Collector ${VES_BATCH_EVENT_PATH} ${evtdata}
194 Should Be Equal As Strings ${resp.status_code} 202
195 ${isEmpty}= Is Json Empty ${resp}
196 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
197 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546025
198 Should Be Equal As Strings ${ret} true
201 Publish VES Event With Invalid URL Path HTTPS
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}
207 Log Receive HTTPS Status code ${resp.status_code}
208 Should Be Equal As Strings ${resp.status_code} 404
209 ${isEmpty}= Is Json Empty ${resp}
210 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
212 Publish Single VES VNF Measurement Event over HTTP
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()}
223 Publish Single VES VNF Measurement Event with certBasicAuth over HTTPS
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
233 Should Be Equal As Strings ${ret} true
235 Publish Single VES VNF Measurement Event over HTTPS with wrong JSON
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()}
245 Publish Single VES VNF Measurement Event With Wrong Auth
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()}
255 Publish Single VES VNF Measurement Event With Cert
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
267 Publish Single VES VNF Measurement Event With Wrong Cert
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}
276 Publish Single VES VNF Measurement Event Without Auth And Cert
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()}