blob: 5a6cc945c58ae2c9e57b06d1ce916f2580979361 [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
37${external_libs} True
38${setup_device} True
39${teardown_device} True
40${VOLTCTL_NAMESPACE} default
41${BBSIMCTL_NAMESPACE} voltha
42${VOLTCTL_POD_NAME} voltctl
43${BBSIMCTL_POD_NAME} bbsim
44
45*** Test Cases ***
46Ensure required pods Running
47 [Documentation] Ensure the bbsim and voltctl pods are in Running state
48 [Tags] active
49 Validate Pod Status ${BBSIMCTL_POD_NAME} ${BBSIMCTL_NAMESPACE} Running
50 Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
51
52ONU Discovery
53 [Documentation] Discover lists of ONUS, their Serial Numbers and device id, and pick one for subsequent tests
54 [Tags] active
55 #build onu sn list
56 ${List_ONU_Serial} Create List
57 Set Suite Variable ${List_ONU_Serial}
58 Build ONU SN List ${List_ONU_Serial}
59 Log ${List_ONU_Serial}
60 #validate onu states
61 Wait Until Keyword Succeeds ${long_timeout} 20s
62 ... Validate ONU Devices ENABLED ACTIVE REACHABLE ${List_ONU_Serial}
63 # Pick an ONU to use for subsequent test cases
64 ${onu_sn} Set Variable ${List_ONU_Serial}[0]
65 Set Suite Variable ${onu_sn}
66 ${onu_id} Get Device ID From SN ${onu_sn}
67 Set Suite Variable ${onu_id}
Scott Baker27d04db2020-02-06 18:03:21 -080068 ${parent_id} Get Parent ID From Device ID ${onu_id}
69 Set Suite Variable ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -080070
Scott Baker27d04db2020-02-06 18:03:21 -080071Test RaiseActivationFailureAlarm
72 # Note: Can only be raised, not cleared
73 [Documentation] Raise Activation Fail Alarm and verify event received
74 [Tags] active
75 ${header} ${deviceEvent} Raise Alarm And Get Event ActivationFailure
76 ... ${onu_sn} ONU_ACTIVATION_FAIL_RAISE_EVENT
77 # Note: PON is the zero value of the subCategory field, and causes it to be not present
78 Verify Header ${header} Voltha.openolt.ONU_ACTIVATION_FAIL\.(\\d+) ${EMPTY}
79 Should Be Equal ${deviceEvent}[deviceEventName] ONU_ACTIVATION_FAIL_RAISE_EVENT
80 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
81
82Test RaiseDriftOfWindowAlarm
83 [Documentation] Raise Drift Of Window Alarm and verify event received
84 [Tags] active
85 ${header} ${deviceEvent} Raise Alarm And Get Event DriftOfWindow
86 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
87 # Note: PON is the zero value of the subCategory field, and causes it to be not present
88 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
89 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
90 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
91
92Test ClearDriftOfWindowAlarm
93 [Documentation] Clear Drift Of Window Alarm and verify event received
94 [Tags] active
95 ${header} ${deviceEvent} Clear Alarm And Get Event DriftOfWindow
96 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
97 # Note: PON is the zero value of the subCategory field, and causes it to be not present
98 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
99 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
100 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
101
102Test RaiseDyingGaspAlarm
103 [Documentation] Raise Dying Gasp Alarm and verify event received
104 [Tags] active
105 ${header} ${deviceEvent} Raise Alarm And Get Event DyingGasp
Scott Bakeree675552020-02-11 10:43:34 -0800106 ... ${onu_sn} ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800107 # Note: PON is the zero value of the subCategory field, and causes it to be not present
Scott Bakeree675552020-02-11 10:43:34 -0800108 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ${EMPTY}
109 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800110 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
111
112Test RaiseLopcMissAlarm
113 [Documentation] Raise LOPC_MISS Alarm and verify event received
114 [Tags] active
115 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MISS
116 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
117 # Note: PON is the zero value of the subCategory field, and causes it to be not present
118 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
119 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
120 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
121
122Test ClearLopcMissAlarm
123 [Documentation] Clear LOPC_MISS Alarm and verify event received
124 [Tags] active
125 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MISS
126 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
127 # Note: PON is the zero value of the subCategory field, and causes it to be not present
128 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
129 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
130 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
131
132Test RaiseLopcMicErrorAlarm
133 [Documentation] Raise LOPC_MISS Alarm and verify event received
134 [Tags] active
135 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MIC_ERROR
136 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
137 # Note: PON is the zero value of the subCategory field, and causes it to be not present
138 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
139 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
140 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
141
142Test ClearLopcMicErrorAlarm
143 [Documentation] Clear LOPC_MISS Alarm and verify event received
144 [Tags] active
145 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MIC_ERROR
146 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
147 # Note: PON is the zero value of the subCategory field, and causes it to be not present
148 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
149 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
150 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800151
152Test RaiseLossOfBurstAlarm
153 [Documentation] Raise Loss Of Burst Alarm and verify event received
154 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800155 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfBurst
156 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
157 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800158 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800159 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
160
161Test ClearLossOfBurstAlarm
162 [Documentation] Clear Loss Of Burst Alarm and verify event received
163 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800164 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfBurst
165 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
166 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800167 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800168 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
169
170Test RaiseLossOfFrameAlarm
171 [Documentation] Raise Loss Of Frame Alarm and verify event received
172 [Tags] active
173 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfFrame
174 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
175 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
176 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
177 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
178
179Test ClearLossOfFrameAlarm
180 [Documentation] Clear Loss Of Frame Alarm and verify event received
181 [Tags] active
182 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfFrame
183 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
184 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
185 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
186 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
187
188Test RaiseLossOfKeySyncFailureAlarm
189 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
190 [Tags] active
191 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfKeySyncFailure
192 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
193 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
194 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
195 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
196
197Test ClearLossOfKeySyncFailureAlarm
198 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
199 [Tags] active
200 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfKeySyncFailure
201 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
202 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
203 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
204 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
205
206Test RaiseLossOfOmciChannelAlarm
207 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
208 [Tags] active
209 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfOmciChannel
210 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
211 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
212 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
213 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
214
215Test ClearLossOfOmciChannelAlarm
216 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
217 [Tags] active
218 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfOmciChannel
219 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
220 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
221 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
222 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
223
224Test RaiseLossOfPloamAlarm
225 [Documentation] Raise Loss Of Ploam Alarm and verify event received
226 [Tags] active
227 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfPloam
228 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
229 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
230 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
231 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
232
233Test ClearLossOfPloamAlarm
234 [Documentation] Clear Loss Of Ploam Alarm and verify event received
235 [Tags] active
236 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfPloam
237 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
238 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
239 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
240 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
241
242Test RaiseLossOfSignalAlarm
243 [Documentation] Raise Loss Of Signal Alarm and verify event received
244 [Tags] active
245 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfSignal
246 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
247 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
248 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
249 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
250
251Test ClearLossOfSignalAlarm
252 [Documentation] Clear Loss Of Signal Alarm and verify event received
253 [Tags] active
254 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfSignal
255 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
256 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
257 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
258 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
259
260Test RaisePonLossOfSignalAlarm
261 [Documentation] Raise Loss Of Signal Alarm and verify event received
262 [Tags] active
263 ${header} ${deviceEvent} Raise Alarm And Get Event PonLossOfSignal
264 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_RAISE_EVENT
265 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
266 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
267 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
268
269Test ClearPonLossOfSignalAlarm
270 [Documentation] Clear Loss Of Signal Alarm and verify event received
271 [Tags] active
272 ${header} ${deviceEvent} Clear Alarm And Get Event PonLossOfSignal
273 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
274 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
275 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
276 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
277
278Test RaiseProcessingErrorAlarm
279 # Not Implemented
280 [Documentation] Raise Processing Error Alarm and verify event received
281 [Tags] not-active
282 ${header} ${deviceEvent} Raise Alarm And Get Event ProcessingError
283 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
284 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
285 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
286 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
287
288Test ClearProcessingErrorAlarm
289 # Not Implemented
290 [Documentation] Clear Processing Error Alarm and verify event received
291 [Tags] not-active
292 ${header} ${deviceEvent} Clear Alarm And Get Event ProcessingError
293 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
294 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
295 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
296 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
297
298Test RaiseSignalDegradeAlarm
299 [Documentation] Raise Signal Degrade Alarm and verify event received
300 [Tags] active
301 ${header} ${deviceEvent} Raise Alarm And Get Event SignalDegrade
302 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
303 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
304 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
305 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
306
307Test ClearSignalDegradeAlarm
308 [Documentation] Clear Signal Degrade Alarm and verify event received
309 [Tags] active
310 ${header} ${deviceEvent} Clear Alarm And Get Event SignalDegrade
311 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
312 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
313 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
314 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
315
316Test RaiseSignalsFailureAlarm
317 [Documentation] Raise Signals Fail Alarm and verify event received
318 [Tags] active
319 ${header} ${deviceEvent} Raise Alarm And Get Event SignalsFailure
320 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
321 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
322 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
323 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
324
325Test ClearSignalsFailureAlarm
326 [Documentation] Clear Signals Fail Alarm and verify event received
327 [Tags] active
328 ${header} ${deviceEvent} Clear Alarm And Get Event SignalsFailure
329 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
330 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
331 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
332 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
333
334Test RaiseStartupFailureAlarm
335 # Not Implemented
336 [Documentation] Raise Startup Failure Alarm and verify event received
337 [Tags] not-active
338 ${header} ${deviceEvent} Raise Alarm And Get Event StartupFailure
339 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
340 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
341 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
342 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
343
344Test ClearStartupFailureAlarm
345 # Not Implemented
346 [Documentation] Clear Startup Failure Alarm and verify event received
347 [Tags] not-active
348 ${header} ${deviceEvent} Clear Alarm And Get Event StartupFailure
349 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
350 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
351 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
352 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
353
354Test RaiseTransmissionInterferenceAlarm
355 # Not Implemented
356 [Documentation] Raise Transmission Interference Alarm and verify event received
357 [Tags] not-active
358 ${header} ${deviceEvent} Raise Alarm And Get Event TransmissionInterference
359 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
360 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
361 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
362 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
363
364Test ClearTransmissionInterferenceAlarm
365 # Not Implemented
366 [Documentation] Clear Transmission Interference Alarm and verify event received
367 [Tags] not-active
368 ${header} ${deviceEvent} Clear Alarm And Get Event TransmissionInterference
369 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
370 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
371 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800372 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
373
374*** Keywords ***
375Setup Suite
376 [Documentation] Set up the test suite
377 Common Test Suite Setup
378 # Ensure the voltctl pod is deployed and running
379 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
380 Wait Until Keyword Succeeds ${timeout} 5s
381 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
382 # Call Setup keyword in utils library to create and enable device
383 Run Keyword If ${setup_device} Setup
384
385Teardown Suite
386 [Documentation] Clean up devices if desired
387 ... kills processes and cleans up interfaces on src+dst servers
388 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
389 Run Keyword If ${has_dataplane} Clean Up Linux
390 Run Keyword If ${external_libs}
391 ... Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
392 Run Keyword If ${teardown_device} Delete Device and Verify
393 Run Keyword If ${teardown_device} Test Empty Device List
394 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
395 ... device-remove ${of_id}
396
Scott Baker27d04db2020-02-06 18:03:21 -0800397Raise Alarm And Get Event
398 [Documentation] Raise an Alarm and return event
399 [Arguments] ${name} ${sn} ${deviceEventName}
400 ${since} Get Current Time
401 Raise Alarm ${name} ${sn}
402 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800403 ${LastEventPostTimestamp} Set Variable ${since}
404 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800405 [return] ${header} ${deviceEvent}
406
407Clear Alarm And Get Event
408 [Documentation] Clear an Alarm and return event
409 [Arguments] ${name} ${sn} ${deviceEventName}
410 ${since} Get Current Time
411 Clear Alarm ${name} ${sn}
412 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800413 ${LastEventPostTimestamp} Set Variable ${since}
414 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800415 [return] ${header} ${deviceEvent}
416
Scott Baker60e570d2020-02-02 22:10:13 -0800417Raise Alarm
418 [Documentation] Raise an Alarm
419 [Arguments] ${name} ${sn}
420 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm raise ${name} ${sn}
421 Should Contain ${raiseOutput} Alarm Indication Sent
422
423Clear Alarm
424 [Documentation] Raise an Alarm
425 [Arguments] ${name} ${sn}
426 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm clear ${name} ${sn}
427 Should Contain ${raiseOutput} Alarm Indication Sent
428
429Get Device Event
430 [Documentation] Get the most recent alarm event from voltha.events
431 [Arguments] ${deviceEventName} ${since}
432 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
433 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName} -s ${since}
434 ${json} To Json ${output}
435 ${count} Get Length ${json}
436 # If there is more than one event (which could happen if we quickly do a raise and a clear),
437 # then return the most recent one.
438 Should Be Larger Than ${count} 0
439 ${lastIndex} Evaluate ${count}-1
440 ${lastItem} Set Variable ${json}[${lastIndex}]
441 ${header} Set Variable ${lastItem}[header]
442 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
443 Log ${header}
444 Log ${deviceEvent}
445 [return] ${header} ${deviceEvent}
446
447Verify Header
448 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800449 [Arguments] ${header} ${id} ${subCategory}
450 ${headerSubCategory} Evaluate $header.get("subCategory", "")
451 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800452 Should Be Equal ${header}[type] DEVICE_EVENT
453 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800454 # TODO Timestamps are now RFC3339 date strings. Add Verification
455 ${reportedTs} Set Variable ${header}[reportedTs]
456 ${raisedTs} Set Variable ${header}[raisedTs]
457 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
458 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}