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