blob: 9306692dfe9189ee0d02fceeeaf5948e99f3bc7f [file] [log] [blame]
Scott Baker60e570d2020-02-02 22:10:13 -08001#Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15*** Settings ***
16Documentation This test raises alarms using bbsimctl and verifies them using voltctl
17Suite Setup Setup Suite
18Suite Teardown Teardown Suite
19Library Collections
20Library String
21Library OperatingSystem
22Library XML
23Library RequestsLibrary
24Library ../../libraries/DependencyLibrary.py
25Resource ../../libraries/onos.robot
26Resource ../../libraries/voltctl.robot
27Resource ../../libraries/utils.robot
28Resource ../../libraries/k8s.robot
29Resource ../../variables/variables.robot
30
31*** Variables ***
32${timeout} 60s
33${long_timeout} 420s
34${of_id} 0
35${logical_id} 0
36${has_dataplane} True
Scott Baker60e570d2020-02-02 22:10:13 -080037${setup_device} True
38${teardown_device} True
39${VOLTCTL_NAMESPACE} default
40${BBSIMCTL_NAMESPACE} voltha
41${VOLTCTL_POD_NAME} voltctl
42${BBSIMCTL_POD_NAME} bbsim
43
44*** Test Cases ***
45Ensure required pods Running
46 [Documentation] Ensure the bbsim and voltctl pods are in Running state
47 [Tags] active
48 Validate Pod Status ${BBSIMCTL_POD_NAME} ${BBSIMCTL_NAMESPACE} Running
49 Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
50
51ONU Discovery
52 [Documentation] Discover lists of ONUS, their Serial Numbers and device id, and pick one for subsequent tests
53 [Tags] active
54 #build onu sn list
55 ${List_ONU_Serial} Create List
56 Set Suite Variable ${List_ONU_Serial}
57 Build ONU SN List ${List_ONU_Serial}
58 Log ${List_ONU_Serial}
59 #validate onu states
60 Wait Until Keyword Succeeds ${long_timeout} 20s
61 ... Validate ONU Devices ENABLED ACTIVE REACHABLE ${List_ONU_Serial}
62 # Pick an ONU to use for subsequent test cases
63 ${onu_sn} Set Variable ${List_ONU_Serial}[0]
64 Set Suite Variable ${onu_sn}
65 ${onu_id} Get Device ID From SN ${onu_sn}
66 Set Suite Variable ${onu_id}
Scott Baker27d04db2020-02-06 18:03:21 -080067 ${parent_id} Get Parent ID From Device ID ${onu_id}
68 Set Suite Variable ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -080069
Scott Baker27d04db2020-02-06 18:03:21 -080070Test RaiseActivationFailureAlarm
71 # Note: Can only be raised, not cleared
72 [Documentation] Raise Activation Fail Alarm and verify event received
73 [Tags] active
74 ${header} ${deviceEvent} Raise Alarm And Get Event ActivationFailure
75 ... ${onu_sn} ONU_ACTIVATION_FAIL_RAISE_EVENT
76 # Note: PON is the zero value of the subCategory field, and causes it to be not present
77 Verify Header ${header} Voltha.openolt.ONU_ACTIVATION_FAIL\.(\\d+) ${EMPTY}
78 Should Be Equal ${deviceEvent}[deviceEventName] ONU_ACTIVATION_FAIL_RAISE_EVENT
79 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
80
81Test RaiseDriftOfWindowAlarm
82 [Documentation] Raise Drift Of Window Alarm and verify event received
83 [Tags] active
84 ${header} ${deviceEvent} Raise Alarm And Get Event DriftOfWindow
85 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
86 # Note: PON is the zero value of the subCategory field, and causes it to be not present
87 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
88 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
89 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
90
91Test ClearDriftOfWindowAlarm
92 [Documentation] Clear Drift Of Window Alarm and verify event received
93 [Tags] active
94 ${header} ${deviceEvent} Clear Alarm And Get Event DriftOfWindow
95 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
96 # Note: PON is the zero value of the subCategory field, and causes it to be not present
97 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
98 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
99 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
100
101Test RaiseDyingGaspAlarm
102 [Documentation] Raise Dying Gasp Alarm and verify event received
103 [Tags] active
104 ${header} ${deviceEvent} Raise Alarm And Get Event DyingGasp
Scott Bakeree675552020-02-11 10:43:34 -0800105 ... ${onu_sn} ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800106 # Note: PON is the zero value of the subCategory field, and causes it to be not present
Scott Bakeree675552020-02-11 10:43:34 -0800107 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ${EMPTY}
108 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800109 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
110
111Test RaiseLopcMissAlarm
112 [Documentation] Raise LOPC_MISS Alarm and verify event received
113 [Tags] active
114 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MISS
115 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
116 # Note: PON is the zero value of the subCategory field, and causes it to be not present
117 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
118 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
119 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
120
121Test ClearLopcMissAlarm
122 [Documentation] Clear LOPC_MISS Alarm and verify event received
123 [Tags] active
124 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MISS
125 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
126 # Note: PON is the zero value of the subCategory field, and causes it to be not present
127 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
128 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
129 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
130
131Test RaiseLopcMicErrorAlarm
132 [Documentation] Raise LOPC_MISS Alarm and verify event received
133 [Tags] active
134 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MIC_ERROR
135 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
136 # Note: PON is the zero value of the subCategory field, and causes it to be not present
137 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
138 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
139 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
140
141Test ClearLopcMicErrorAlarm
142 [Documentation] Clear LOPC_MISS Alarm and verify event received
143 [Tags] active
144 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MIC_ERROR
145 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
146 # Note: PON is the zero value of the subCategory field, and causes it to be not present
147 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
148 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
149 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800150
151Test RaiseLossOfBurstAlarm
152 [Documentation] Raise Loss Of Burst Alarm and verify event received
153 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800154 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfBurst
155 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
156 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800157 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800158 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
159
160Test ClearLossOfBurstAlarm
161 [Documentation] Clear Loss Of Burst Alarm and verify event received
162 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800163 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfBurst
164 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
165 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800166 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800167 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
168
169Test RaiseLossOfFrameAlarm
170 [Documentation] Raise Loss Of Frame Alarm and verify event received
171 [Tags] active
172 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfFrame
173 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
174 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
175 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
176 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
177
178Test ClearLossOfFrameAlarm
179 [Documentation] Clear Loss Of Frame Alarm and verify event received
180 [Tags] active
181 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfFrame
182 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
183 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
184 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
185 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
186
187Test RaiseLossOfKeySyncFailureAlarm
188 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
189 [Tags] active
190 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfKeySyncFailure
191 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
192 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
193 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
194 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
195
196Test ClearLossOfKeySyncFailureAlarm
197 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
198 [Tags] active
199 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfKeySyncFailure
200 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
201 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
202 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
203 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
204
205Test RaiseLossOfOmciChannelAlarm
206 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
207 [Tags] active
208 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfOmciChannel
209 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
210 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
211 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
212 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
213
214Test ClearLossOfOmciChannelAlarm
215 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
216 [Tags] active
217 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfOmciChannel
218 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
219 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
220 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
221 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
222
223Test RaiseLossOfPloamAlarm
224 [Documentation] Raise Loss Of Ploam Alarm and verify event received
225 [Tags] active
226 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfPloam
227 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
228 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
229 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
230 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
231
232Test ClearLossOfPloamAlarm
233 [Documentation] Clear Loss Of Ploam Alarm and verify event received
234 [Tags] active
235 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfPloam
236 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
237 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
238 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
239 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
240
241Test RaiseLossOfSignalAlarm
242 [Documentation] Raise Loss Of Signal Alarm and verify event received
243 [Tags] active
244 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfSignal
245 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
246 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
247 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
248 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
249
250Test ClearLossOfSignalAlarm
251 [Documentation] Clear Loss Of Signal Alarm and verify event received
252 [Tags] active
253 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfSignal
254 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
255 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
256 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
257 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
258
259Test RaisePonLossOfSignalAlarm
260 [Documentation] Raise Loss Of Signal Alarm and verify event received
261 [Tags] active
262 ${header} ${deviceEvent} Raise Alarm And Get Event PonLossOfSignal
263 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_RAISE_EVENT
264 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
265 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
266 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
267
268Test ClearPonLossOfSignalAlarm
269 [Documentation] Clear Loss Of Signal Alarm and verify event received
270 [Tags] active
271 ${header} ${deviceEvent} Clear Alarm And Get Event PonLossOfSignal
272 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
273 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
274 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
275 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
276
277Test RaiseProcessingErrorAlarm
278 # Not Implemented
279 [Documentation] Raise Processing Error Alarm and verify event received
280 [Tags] not-active
281 ${header} ${deviceEvent} Raise Alarm And Get Event ProcessingError
282 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
283 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
284 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
285 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
286
287Test ClearProcessingErrorAlarm
288 # Not Implemented
289 [Documentation] Clear Processing Error Alarm and verify event received
290 [Tags] not-active
291 ${header} ${deviceEvent} Clear Alarm And Get Event ProcessingError
292 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
293 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
294 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
295 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
296
297Test RaiseSignalDegradeAlarm
298 [Documentation] Raise Signal Degrade Alarm and verify event received
299 [Tags] active
300 ${header} ${deviceEvent} Raise Alarm And Get Event SignalDegrade
301 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
302 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
303 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
304 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
305
306Test ClearSignalDegradeAlarm
307 [Documentation] Clear Signal Degrade Alarm and verify event received
308 [Tags] active
309 ${header} ${deviceEvent} Clear Alarm And Get Event SignalDegrade
310 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
311 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
312 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
313 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
314
315Test RaiseSignalsFailureAlarm
316 [Documentation] Raise Signals Fail Alarm and verify event received
317 [Tags] active
318 ${header} ${deviceEvent} Raise Alarm And Get Event SignalsFailure
319 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
320 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
321 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
322 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
323
324Test ClearSignalsFailureAlarm
325 [Documentation] Clear Signals Fail Alarm and verify event received
326 [Tags] active
327 ${header} ${deviceEvent} Clear Alarm And Get Event SignalsFailure
328 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
329 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
330 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
331 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
332
333Test RaiseStartupFailureAlarm
334 # Not Implemented
335 [Documentation] Raise Startup Failure Alarm and verify event received
336 [Tags] not-active
337 ${header} ${deviceEvent} Raise Alarm And Get Event StartupFailure
338 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
339 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
340 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
341 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
342
343Test ClearStartupFailureAlarm
344 # Not Implemented
345 [Documentation] Clear Startup Failure Alarm and verify event received
346 [Tags] not-active
347 ${header} ${deviceEvent} Clear Alarm And Get Event StartupFailure
348 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
349 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
350 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
351 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
352
353Test RaiseTransmissionInterferenceAlarm
354 # Not Implemented
355 [Documentation] Raise Transmission Interference Alarm and verify event received
356 [Tags] not-active
357 ${header} ${deviceEvent} Raise Alarm And Get Event TransmissionInterference
358 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
359 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
360 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
361 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
362
363Test ClearTransmissionInterferenceAlarm
364 # Not Implemented
365 [Documentation] Clear Transmission Interference Alarm and verify event received
366 [Tags] not-active
367 ${header} ${deviceEvent} Clear Alarm And Get Event TransmissionInterference
368 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
369 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
370 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800371 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
372
373*** Keywords ***
374Setup Suite
375 [Documentation] Set up the test suite
376 Common Test Suite Setup
377 # Ensure the voltctl pod is deployed and running
378 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
379 Wait Until Keyword Succeeds ${timeout} 5s
380 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
381 # Call Setup keyword in utils library to create and enable device
382 Run Keyword If ${setup_device} Setup
383
384Teardown Suite
385 [Documentation] Clean up devices if desired
386 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800387 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800388 Run Keyword If ${has_dataplane} Clean Up Linux
Scott Baker60e570d2020-02-02 22:10:13 -0800389 Run Keyword If ${teardown_device} Delete Device and Verify
390 Run Keyword If ${teardown_device} Test Empty Device List
ubuntu6b6e7d42020-03-02 12:35:42 -0800391 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800392 ... device-remove ${of_id}
393
Scott Baker27d04db2020-02-06 18:03:21 -0800394Raise Alarm And Get Event
395 [Documentation] Raise an Alarm and return event
396 [Arguments] ${name} ${sn} ${deviceEventName}
397 ${since} Get Current Time
398 Raise Alarm ${name} ${sn}
399 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800400 ${LastEventPostTimestamp} Set Variable ${since}
401 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800402 [return] ${header} ${deviceEvent}
403
404Clear Alarm And Get Event
405 [Documentation] Clear an Alarm and return event
406 [Arguments] ${name} ${sn} ${deviceEventName}
407 ${since} Get Current Time
408 Clear Alarm ${name} ${sn}
409 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800410 ${LastEventPostTimestamp} Set Variable ${since}
411 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800412 [return] ${header} ${deviceEvent}
413
Scott Baker60e570d2020-02-02 22:10:13 -0800414Raise Alarm
415 [Documentation] Raise an Alarm
416 [Arguments] ${name} ${sn}
417 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm raise ${name} ${sn}
418 Should Contain ${raiseOutput} Alarm Indication Sent
419
420Clear Alarm
421 [Documentation] Raise an Alarm
422 [Arguments] ${name} ${sn}
423 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm clear ${name} ${sn}
424 Should Contain ${raiseOutput} Alarm Indication Sent
425
426Get Device Event
427 [Documentation] Get the most recent alarm event from voltha.events
428 [Arguments] ${deviceEventName} ${since}
429 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
430 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName} -s ${since}
431 ${json} To Json ${output}
432 ${count} Get Length ${json}
433 # If there is more than one event (which could happen if we quickly do a raise and a clear),
434 # then return the most recent one.
435 Should Be Larger Than ${count} 0
436 ${lastIndex} Evaluate ${count}-1
437 ${lastItem} Set Variable ${json}[${lastIndex}]
438 ${header} Set Variable ${lastItem}[header]
439 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
440 Log ${header}
441 Log ${deviceEvent}
442 [return] ${header} ${deviceEvent}
443
444Verify Header
445 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800446 [Arguments] ${header} ${id} ${subCategory}
447 ${headerSubCategory} Evaluate $header.get("subCategory", "")
448 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800449 Should Be Equal ${header}[type] DEVICE_EVENT
450 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800451 # TODO Timestamps are now RFC3339 date strings. Add Verification
452 ${reportedTs} Set Variable ${header}[reportedTs]
453 ${raisedTs} Set Variable ${header}[raisedTs]
454 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
455 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}