blob: eee6ea569914153604450c8f6039828c0cfecedd [file] [log] [blame]
pswang212b7d92017-09-27 12:45:03 -05001*** Settings ***
2Documentation Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios
3
4Library RequestsLibrary
5Library OperatingSystem
6Library Collections
7Library DcaeLibrary
8Resource resources/dcae_keywords.robot
9Test Setup Cleanup VES Events
10Suite Setup VES Collector Suite Setup DMaaP
11Suite Teardown VES Collector Suite Shutdown DMaaP
12
13
14
15
16*** Variables ***
17${VESC_URL_HTTPS} https://%{VESC_IP}:8443
18${VESC_URL} http://%{VESC_IP}:8080
19${VES_ANY_EVENT_PATH} /eventListener/v5
20${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch
21${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState
22${HEADER_STRING} content-type=application/json
23${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json
24${EVENT_MEASURE_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json
25${EVENT_DATA_FILE_BAD} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json
26${EVENT_BATCH_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json
27${EVENT_THROTTLING_STATE_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json
28
29
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
38*** Test Cases ***
39
40VES Collector Health Check
41 [Tags] DCAE-VESC-R1
42 [Documentation] Ves Collector Health Check
43 ${uuid}= Generate UUID
44 ${session}= Create Session dcae ${VESC_URL}
45 ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
46 ${resp}= Get Request dcae /healthcheck headers=${headers}
47 Should Be Equal As Strings ${resp.status_code} 200
48
49
50Publish Single VES VoLTE Fault Event
51 [Tags] DCAE-VESC-R1
52 [Documentation] Post single event and expect 200 Response
53 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
54 ${headers}= Create Header From String ${HEADER_STRING}
55 ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
56 Log Receive HTTP Status code ${resp.status_code}
57 Should Be Equal As Strings ${resp.status_code} 200
58 ${isEmpty}= Is Json Empty ${resp}
59 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
60 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
61 Should Be Equal As Strings ${ret} true
62
63Publish Single VES VNF Measurement Event
64 [Tags] DCAE-VESC-R1
65 [Documentation] Post single event and expect 200 Response
66 ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE}
67 ${headers}= Create Header From String ${HEADER_STRING}
68 ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
69 Log Receive HTTP Status code ${resp.status_code}
70 Should Be Equal As Strings ${resp.status_code} 200
71 ${isEmpty}= Is Json Empty ${resp}
72 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
73 ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6
74 Should Be Equal As Strings ${ret} true
75
76Publish VES VoLTE Fault Batch Events
77 [Tags] DCAE-VESC-R1
78 [Documentation] Post batched events and expect 202 Response
79 ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE}
80 ${headers}= Create Header From String ${HEADER_STRING}
81 ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata}
82 Should Be Equal As Strings ${resp.status_code} 200
83 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016
84 Should Be Equal As Strings ${ret} true
85
86
87Publish Single VES VoLTE Fault Event With Bad Data
88 [Tags] DCAE-VESC-R1
89 [Documentation] Run with JSON Envent with missing comma to expect 400 response
90 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE_BAD}
91 ${headers}= Create Header From String ${HEADER_STRING}
92 Log Send HTTP Request with invalid Json Event Data
93 ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
94 Log Receive HTTP Status code ${resp.status_code}
95 Should Be Equal As Strings ${resp.status_code} 400
96 ${isEmpty}= Is Json Empty ${resp}
97 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
98
99Publish VES Event With Invalid Method
100 [Tags] DCAE-VESC-R1
101 [Documentation] Use invalid Put instead of Post method to expect 405 response
102 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
103 ${headers}= Create Header From String ${HEADER_STRING}
104 Log Send HTTP Request with invalid method Put instead of Post
105 ${resp}= Publish Event To VES Collector With Put Method No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
106 Log Receive HTTP Status code ${resp.status_code}
107 Should Be Equal As Strings ${resp.status_code} 404
108
109
110Publish VES Event With Invalid URL Path
111 [Tags] DCAE-VESC-R1
112 [Documentation] Use invalid url path to expect 404 response
113 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
114 ${headers}= Create Header From String ${HEADER_STRING}
115 Log Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path
116 ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} /listener/v5/ ${headers} ${evtdata}
117 Log Receive HTTP Status code ${resp.status_code}
118 Should Be Equal As Strings ${resp.status_code} 404
119
120
121Enable VESC HTTPS And Basic Auth
122 [Tags] DCAE-VESC-R1
123 [Documentation] Enable VESC Https and Authentication, Disable Http and Run Health Check
124 Enable VESC Https Auth
125
126 ${auth}= Create List ${VESC_HTTPS_USER} ${VESC_HTTPS_PD}
127 ${session}= Create Session dcaegen2-r1 ${VESC_URL_HTTPS} auth=${auth} disable_warnings=1
128 ${headers}= Create Dictionary Accept=*/* X-FromAppId=${GLOBAL_APPLICATION_ID}
129 ${resp}= Get Request dcaegen2-r1 /healthcheck headers=${headers}
130 Should Be Equal As Strings ${resp.status_code} 200
131
132Publish Single VES Fault Event Over HTTPS
133 [Tags] DCAE-VESC-R1
134 [Documentation] Post single event and expect 200 Response
135 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
136 ${headers}= Create Header From String ${HEADER_STRING}
137 Log Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD}
138 ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} sample1 sample1
139 Log Receive HTTP Status code ${resp.status_code}
140 Should Be Equal As Strings ${resp.status_code} 200
141 ${isEmpty}= Is Json Empty ${resp}
142 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
143 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
144 Should Be Equal As Strings ${ret} true
145
146
147Publish Single VES Measurement Event Over HTTPS
148 [Tags] DCAE-VESC-R1
149 [Documentation] Post single event and expect 200 Response
150 ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE}
151 ${headers}= Create Header From String ${HEADER_STRING}
152 ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD}
153 Log Receive HTTP Status code ${resp.status_code}
154 Should Be Equal As Strings ${resp.status_code} 200
155 ${isEmpty}= Is Json Empty ${resp}
156 Run Keyword If '${isEmpty}' == False Log ${resp.json()}
157 ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6
158 Should Be Equal As Strings ${ret} true
159
160Publish VES Fault Batch Events Over HTTPS
161 [Tags] DCAE-VESC-R1
162 [Documentation] Post batched events and expect 202 Response
163 ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE}
164 ${headers}= Create Header From String ${HEADER_STRING}
165 ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD}
166 Should Be Equal As Strings ${resp.status_code} 200
167 ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016
168 Should Be Equal As Strings ${ret} true
169
170
171Publish VES Event With Invalid URL Path HTTPS
172 [Tags] DCAE-VESC-R1
173 [Documentation] Use invalid url path to expect 404 response
174 ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
175 ${headers}= Create Header From String ${HEADER_STRING}
176 Log Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path
177 ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} /eventlistener/v5 ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD}
178 Log Receive HTTP Status code ${resp.status_code}
179 Should Be Equal As Strings ${resp.status_code} 404
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199