blob: 5a35e48b409c370bc10ad51cfc865edae4680555 [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
106 ... ${onu_sn} ONU_DYING_GASP_RAISE_EVENT
107 # Note: PON is the zero value of the subCategory field, and causes it to be not present
108 Verify Header ${header} Voltha.openolt.ONU_DYING_GASP\.(\\d+) ${EMPTY}
109 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_RAISE_EVENT
110 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
111
112Test ClearDyingGaspAlarm
113 [Documentation] Clear Dying Gasp Alarm and verify event received
114 [Tags] active
115 ${header} ${deviceEvent} Clear Alarm And Get Event DyingGasp
116 ... ${onu_sn} ONU_DYING_GASP_CLEAR_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_DYING_GASP\.(\\d+) ${EMPTY}
119 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_CLEAR_EVENT
120 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
121
122Test RaiseLopcMissAlarm
123 [Documentation] Raise LOPC_MISS Alarm and verify event received
124 [Tags] active
125 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MISS
126 ... ${onu_sn} ONU_LOPC_MISS_RAISE_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_RAISE_EVENT
130 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
131
132Test ClearLopcMissAlarm
133 [Documentation] Clear LOPC_MISS Alarm and verify event received
134 [Tags] active
135 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MISS
136 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_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_MISS\.(\\d+) ONU
139 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
140 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
141
142Test RaiseLopcMicErrorAlarm
143 [Documentation] Raise LOPC_MISS Alarm and verify event received
144 [Tags] active
145 ${header} ${deviceEvent} Raise Alarm And Get Event LOPC_MIC_ERROR
146 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_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_RAISE_EVENT
150 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
151
152Test ClearLopcMicErrorAlarm
153 [Documentation] Clear LOPC_MISS Alarm and verify event received
154 [Tags] active
155 ${header} ${deviceEvent} Clear Alarm And Get Event LOPC_MIC_ERROR
156 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
157 # Note: PON is the zero value of the subCategory field, and causes it to be not present
158 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
159 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
160 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800161
162Test RaiseLossOfBurstAlarm
163 [Documentation] Raise Loss Of Burst Alarm and verify event received
164 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800165 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfBurst
166 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
167 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800168 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800169 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
170
171Test ClearLossOfBurstAlarm
172 [Documentation] Clear Loss Of Burst Alarm and verify event received
173 [Tags] active
Scott Baker27d04db2020-02-06 18:03:21 -0800174 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfBurst
175 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
176 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800177 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800178 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
179
180Test RaiseLossOfFrameAlarm
181 [Documentation] Raise Loss Of Frame Alarm and verify event received
182 [Tags] active
183 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfFrame
184 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
185 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
186 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
187 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
188
189Test ClearLossOfFrameAlarm
190 [Documentation] Clear Loss Of Frame Alarm and verify event received
191 [Tags] active
192 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfFrame
193 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
194 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
195 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
196 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
197
198Test RaiseLossOfKeySyncFailureAlarm
199 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
200 [Tags] active
201 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfKeySyncFailure
202 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
203 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
204 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
205 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
206
207Test ClearLossOfKeySyncFailureAlarm
208 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
209 [Tags] active
210 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfKeySyncFailure
211 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
212 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
213 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
214 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
215
216Test RaiseLossOfOmciChannelAlarm
217 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
218 [Tags] active
219 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfOmciChannel
220 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
221 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
222 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
223 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
224
225Test ClearLossOfOmciChannelAlarm
226 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
227 [Tags] active
228 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfOmciChannel
229 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
230 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
231 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
232 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
233
234Test RaiseLossOfPloamAlarm
235 [Documentation] Raise Loss Of Ploam Alarm and verify event received
236 [Tags] active
237 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfPloam
238 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
239 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
240 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
241 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
242
243Test ClearLossOfPloamAlarm
244 [Documentation] Clear Loss Of Ploam Alarm and verify event received
245 [Tags] active
246 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfPloam
247 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
248 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
249 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
250 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
251
252Test RaiseLossOfSignalAlarm
253 [Documentation] Raise Loss Of Signal Alarm and verify event received
254 [Tags] active
255 ${header} ${deviceEvent} Raise Alarm And Get Event LossOfSignal
256 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
257 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
258 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
259 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
260
261Test ClearLossOfSignalAlarm
262 [Documentation] Clear Loss Of Signal Alarm and verify event received
263 [Tags] active
264 ${header} ${deviceEvent} Clear Alarm And Get Event LossOfSignal
265 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
266 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
267 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
268 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
269
270Test RaisePonLossOfSignalAlarm
271 [Documentation] Raise Loss Of Signal Alarm and verify event received
272 [Tags] active
273 ${header} ${deviceEvent} Raise Alarm And Get Event PonLossOfSignal
274 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_RAISE_EVENT
275 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
276 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
277 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
278
279Test ClearPonLossOfSignalAlarm
280 [Documentation] Clear Loss Of Signal Alarm and verify event received
281 [Tags] active
282 ${header} ${deviceEvent} Clear Alarm And Get Event PonLossOfSignal
283 ... ${onu_sn} OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
284 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
285 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
286 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
287
288Test RaiseProcessingErrorAlarm
289 # Not Implemented
290 [Documentation] Raise Processing Error Alarm and verify event received
291 [Tags] not-active
292 ${header} ${deviceEvent} Raise Alarm And Get Event ProcessingError
293 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
294 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
295 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
296 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
297
298Test ClearProcessingErrorAlarm
299 # Not Implemented
300 [Documentation] Clear Processing Error Alarm and verify event received
301 [Tags] not-active
302 ${header} ${deviceEvent} Clear Alarm And Get Event ProcessingError
303 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
304 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
305 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
306 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
307
308Test RaiseSignalDegradeAlarm
309 [Documentation] Raise Signal Degrade Alarm and verify event received
310 [Tags] active
311 ${header} ${deviceEvent} Raise Alarm And Get Event SignalDegrade
312 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
313 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
314 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
315 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
316
317Test ClearSignalDegradeAlarm
318 [Documentation] Clear Signal Degrade Alarm and verify event received
319 [Tags] active
320 ${header} ${deviceEvent} Clear Alarm And Get Event SignalDegrade
321 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
322 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
323 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
324 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
325
326Test RaiseSignalsFailureAlarm
327 [Documentation] Raise Signals Fail Alarm and verify event received
328 [Tags] active
329 ${header} ${deviceEvent} Raise Alarm And Get Event SignalsFailure
330 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
331 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
332 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
333 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
334
335Test ClearSignalsFailureAlarm
336 [Documentation] Clear Signals Fail Alarm and verify event received
337 [Tags] active
338 ${header} ${deviceEvent} Clear Alarm And Get Event SignalsFailure
339 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
340 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
341 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
342 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
343
344Test RaiseStartupFailureAlarm
345 # Not Implemented
346 [Documentation] Raise Startup Failure Alarm and verify event received
347 [Tags] not-active
348 ${header} ${deviceEvent} Raise Alarm And Get Event StartupFailure
349 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
350 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
351 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
352 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
353
354Test ClearStartupFailureAlarm
355 # Not Implemented
356 [Documentation] Clear Startup Failure Alarm and verify event received
357 [Tags] not-active
358 ${header} ${deviceEvent} Clear Alarm And Get Event StartupFailure
359 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
360 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
361 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
362 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
363
364Test RaiseTransmissionInterferenceAlarm
365 # Not Implemented
366 [Documentation] Raise Transmission Interference Alarm and verify event received
367 [Tags] not-active
368 ${header} ${deviceEvent} Raise Alarm And Get Event TransmissionInterference
369 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
370 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
371 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
372 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
373
374Test ClearTransmissionInterferenceAlarm
375 # Not Implemented
376 [Documentation] Clear Transmission Interference Alarm and verify event received
377 [Tags] not-active
378 ${header} ${deviceEvent} Clear Alarm And Get Event TransmissionInterference
379 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
380 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
381 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800382 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
383
384*** Keywords ***
385Setup Suite
386 [Documentation] Set up the test suite
387 Common Test Suite Setup
388 # Ensure the voltctl pod is deployed and running
389 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
390 Wait Until Keyword Succeeds ${timeout} 5s
391 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
392 # Call Setup keyword in utils library to create and enable device
393 Run Keyword If ${setup_device} Setup
394
395Teardown Suite
396 [Documentation] Clean up devices if desired
397 ... kills processes and cleans up interfaces on src+dst servers
398 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
399 Run Keyword If ${has_dataplane} Clean Up Linux
400 Run Keyword If ${external_libs}
401 ... Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
402 Run Keyword If ${teardown_device} Delete Device and Verify
403 Run Keyword If ${teardown_device} Test Empty Device List
404 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
405 ... device-remove ${of_id}
406
Scott Baker27d04db2020-02-06 18:03:21 -0800407Raise Alarm And Get Event
408 [Documentation] Raise an Alarm and return event
409 [Arguments] ${name} ${sn} ${deviceEventName}
410 ${since} Get Current Time
411 Raise Alarm ${name} ${sn}
412 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
413 [return] ${header} ${deviceEvent}
414
415Clear Alarm And Get Event
416 [Documentation] Clear an Alarm and return event
417 [Arguments] ${name} ${sn} ${deviceEventName}
418 ${since} Get Current Time
419 Clear Alarm ${name} ${sn}
420 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
421 [return] ${header} ${deviceEvent}
422
Scott Baker60e570d2020-02-02 22:10:13 -0800423Raise Alarm
424 [Documentation] Raise an Alarm
425 [Arguments] ${name} ${sn}
426 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm raise ${name} ${sn}
427 Should Contain ${raiseOutput} Alarm Indication Sent
428
429Clear Alarm
430 [Documentation] Raise an Alarm
431 [Arguments] ${name} ${sn}
432 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME} bbsimctl alarm clear ${name} ${sn}
433 Should Contain ${raiseOutput} Alarm Indication Sent
434
435Get Device Event
436 [Documentation] Get the most recent alarm event from voltha.events
437 [Arguments] ${deviceEventName} ${since}
438 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
439 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName} -s ${since}
440 ${json} To Json ${output}
441 ${count} Get Length ${json}
442 # If there is more than one event (which could happen if we quickly do a raise and a clear),
443 # then return the most recent one.
444 Should Be Larger Than ${count} 0
445 ${lastIndex} Evaluate ${count}-1
446 ${lastItem} Set Variable ${json}[${lastIndex}]
447 ${header} Set Variable ${lastItem}[header]
448 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
449 Log ${header}
450 Log ${deviceEvent}
451 [return] ${header} ${deviceEvent}
452
453Verify Header
454 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800455 [Arguments] ${header} ${id} ${subCategory}
456 ${headerSubCategory} Evaluate $header.get("subCategory", "")
457 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800458 Should Be Equal ${header}[type] DEVICE_EVENT
459 Should Match Regexp ${header}[id] ${id}
460 # TODO Revisit when timestamp format is changed from Float to Timestamp
461 Should Be Float ${header}[raisedTs]
462 Should Be Float ${header}[reportedTs]
463