blob: 0c7bc6765866f1c2fe6be609098600f2d8d22cbf [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
Scott Bakerff612b82020-06-25 14:42:18 -070039${VOLTCTL_KAFKA_ENDPOINT} kafka:9092
Scott Baker60e570d2020-02-02 22:10:13 -080040${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
Scott Bakere7840002020-03-23 16:50:27 -070075 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ACTIVATION_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -080076 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -070085 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080086 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -070095 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080096 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700105 ${header} ${deviceEvent} Raise Onu Alarm And Get Event DYING_GASP
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
Scott Bakere7840002020-03-23 16:50:27 -0700115 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800116 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700125 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800126 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700135 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800136 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700145 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800146 ... ${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 Bakere7840002020-03-23 16:50:27 -0700155 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800156 ... ${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 Bakere7840002020-03-23 16:50:27 -0700164 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800165 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700173 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800174 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700182 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800183 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700191 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800192 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700200 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800201 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700209 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800210 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700218 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800219 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700227 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800228 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700236 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800237 ... ${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
Scott Bakere7840002020-03-23 16:50:27 -0700242# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
243# multiples are sent in a row. It seems like the bbsim state machine is interacting
244# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
245# this test to be a duplicate, which in turn is suppressed and fails. So what we
246# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800247Test RaiseLossOfSignalAlarm
248 [Documentation] Raise Loss Of Signal Alarm and verify event received
249 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700250 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
251 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800252 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
253 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
254 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
255 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
256
257Test ClearLossOfSignalAlarm
258 [Documentation] Clear Loss Of Signal Alarm and verify event received
259 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700260 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800261 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
262 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
263 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
264 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
265
266Test RaisePonLossOfSignalAlarm
267 [Documentation] Raise Loss Of Signal Alarm and verify event received
268 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700269 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700270 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800271 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
272 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
273 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
274
275Test ClearPonLossOfSignalAlarm
276 [Documentation] Clear Loss Of Signal Alarm and verify event received
277 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700278 ${header} ${deviceEvent} Clear Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700279 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800280 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
281 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
282 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
283
284Test RaiseProcessingErrorAlarm
285 # Not Implemented
286 [Documentation] Raise Processing Error Alarm and verify event received
287 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700288 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800289 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
290 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
291 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
292 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
293
294Test ClearProcessingErrorAlarm
295 # Not Implemented
296 [Documentation] Clear Processing Error Alarm and verify event received
297 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700298 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800299 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
300 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
301 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
302 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
303
304Test RaiseSignalDegradeAlarm
305 [Documentation] Raise Signal Degrade Alarm and verify event received
306 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700307 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800308 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
309 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
310 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
311 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
312
313Test ClearSignalDegradeAlarm
314 [Documentation] Clear Signal Degrade Alarm and verify event received
315 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700316 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800317 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
318 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
319 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
320 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
321
322Test RaiseSignalsFailureAlarm
323 [Documentation] Raise Signals Fail Alarm and verify event received
324 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700325 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800326 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
327 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
328 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
329 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
330
331Test ClearSignalsFailureAlarm
332 [Documentation] Clear Signals Fail Alarm and verify event received
333 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700334 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800335 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
336 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
337 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
338 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
339
340Test RaiseStartupFailureAlarm
341 # Not Implemented
342 [Documentation] Raise Startup Failure Alarm and verify event received
343 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700344 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800345 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
346 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
347 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
348 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
349
350Test ClearStartupFailureAlarm
351 # Not Implemented
352 [Documentation] Clear Startup Failure Alarm and verify event received
353 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700354 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800355 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
356 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
357 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
358 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
359
360Test RaiseTransmissionInterferenceAlarm
361 # Not Implemented
362 [Documentation] Raise Transmission Interference Alarm and verify event received
363 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700364 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800365 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
366 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
367 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
368 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
369
370Test ClearTransmissionInterferenceAlarm
371 # Not Implemented
372 [Documentation] Clear Transmission Interference Alarm and verify event received
373 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700374 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800375 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
376 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
377 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800378 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
379
380*** Keywords ***
381Setup Suite
382 [Documentation] Set up the test suite
383 Common Test Suite Setup
384 # Ensure the voltctl pod is deployed and running
385 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
386 Wait Until Keyword Succeeds ${timeout} 5s
387 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
388 # Call Setup keyword in utils library to create and enable device
389 Run Keyword If ${setup_device} Setup
390
391Teardown Suite
392 [Documentation] Clean up devices if desired
393 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800394 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800395 Run Keyword If ${has_dataplane} Clean Up Linux
Scott Baker60e570d2020-02-02 22:10:13 -0800396 Run Keyword If ${teardown_device} Delete Device and Verify
397 Run Keyword If ${teardown_device} Test Empty Device List
ubuntu6b6e7d42020-03-02 12:35:42 -0800398 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800399 ... device-remove ${of_id}
400
Scott Bakeree03dd02020-03-12 11:48:06 -0700401# Onu Alarms
402
403Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800404 [Documentation] Raise an Alarm and return event
405 [Arguments] ${name} ${sn} ${deviceEventName}
406 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700407 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800408 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800409 ${LastEventPostTimestamp} Set Variable ${since}
410 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800411 [return] ${header} ${deviceEvent}
412
Scott Bakeree03dd02020-03-12 11:48:06 -0700413Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800414 [Documentation] Clear an Alarm and return event
415 [Arguments] ${name} ${sn} ${deviceEventName}
416 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700417 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800418 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800419 ${LastEventPostTimestamp} Set Variable ${since}
420 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800421 [return] ${header} ${deviceEvent}
422
Scott Bakeree03dd02020-03-12 11:48:06 -0700423Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800424 [Documentation] Raise an Alarm
425 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700426 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
427 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800428 Should Contain ${raiseOutput} Alarm Indication Sent
429
Scott Bakeree03dd02020-03-12 11:48:06 -0700430Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800431 [Documentation] Raise an Alarm
432 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700433 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
434 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700435 Should Contain ${raiseOutput} Alarm Indication Sent
436
437# Olt Alarms
438
439Raise Olt Alarm And Get Event
440 [Documentation] Raise an Alarm and return event
441 [Arguments] ${name} ${intf_id} ${deviceEventName}
442 ${since} Get Current Time
443 Raise Olt Alarm ${name} ${intf_id}
444 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
445 ${LastEventPostTimestamp} Set Variable ${since}
446 Set Suite Variable ${LastEventPostTimestamp}
447 [return] ${header} ${deviceEvent}
448
449Clear Olt Alarm And Get Event
450 [Documentation] Clear an Alarm and return event
451 [Arguments] ${name} ${intf_id} ${deviceEventName}
452 ${since} Get Current Time
453 Clear Olt Alarm ${name} ${intf_id}
454 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
455 ${LastEventPostTimestamp} Set Variable ${since}
456 Set Suite Variable ${LastEventPostTimestamp}
457 [return] ${header} ${deviceEvent}
458
459Raise Olt Alarm
460 [Documentation] Raise an Alarm
461 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700462 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
463 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700464 Should Contain ${raiseOutput} Alarm Indication Sent
465
466Clear Olt Alarm
467 [Documentation] Raise an Alarm
468 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700469 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
470 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800471 Should Contain ${raiseOutput} Alarm Indication Sent
472
473Get Device Event
474 [Documentation] Get the most recent alarm event from voltha.events
475 [Arguments] ${deviceEventName} ${since}
Scott Bakerff612b82020-06-25 14:42:18 -0700476 ${voltctl_command} Catenate SEPARATOR=
477 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName} ${EMPTY}
Scott Bakerab5b3a62020-06-25 23:23:15 -0700478 ... -s ${since} --kafka ${VOLTCTL_KAFKA_ENDPOINT}
Scott Baker60e570d2020-02-02 22:10:13 -0800479 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
Scott Bakerff612b82020-06-25 14:42:18 -0700480 ... ${voltctl_command}
Scott Baker60e570d2020-02-02 22:10:13 -0800481 ${json} To Json ${output}
482 ${count} Get Length ${json}
483 # If there is more than one event (which could happen if we quickly do a raise and a clear),
484 # then return the most recent one.
485 Should Be Larger Than ${count} 0
486 ${lastIndex} Evaluate ${count}-1
487 ${lastItem} Set Variable ${json}[${lastIndex}]
488 ${header} Set Variable ${lastItem}[header]
489 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
490 Log ${header}
491 Log ${deviceEvent}
492 [return] ${header} ${deviceEvent}
493
494Verify Header
495 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800496 [Arguments] ${header} ${id} ${subCategory}
497 ${headerSubCategory} Evaluate $header.get("subCategory", "")
498 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800499 Should Be Equal ${header}[type] DEVICE_EVENT
500 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800501 # TODO Timestamps are now RFC3339 date strings. Add Verification
502 ${reportedTs} Set Variable ${header}[reportedTs]
503 ${raisedTs} Set Variable ${header}[raisedTs]
504 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
505 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}