blob: e4ab03a6816e90b49b0847a9cdad986aa6c12ef6 [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
Hardik Windlassd75b93b2021-10-28 06:03:23 +000029Resource ../../libraries/voltha.robot
Scott Baker60e570d2020-02-02 22:10:13 -080030Resource ../../variables/variables.robot
31
32*** Variables ***
33${timeout} 60s
34${long_timeout} 420s
35${of_id} 0
36${logical_id} 0
37${has_dataplane} True
Scott Baker60e570d2020-02-02 22:10:13 -080038${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 RaiseDriftOfWindowAlarm
72 [Documentation] Raise Drift Of Window Alarm and verify event received
73 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070074 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080075 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010076 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080077 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
78 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
79
80Test ClearDriftOfWindowAlarm
81 [Documentation] Clear Drift Of Window Alarm and verify event received
82 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070083 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080084 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010085 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080086 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
87 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
88
89Test RaiseDyingGaspAlarm
90 [Documentation] Raise Dying Gasp Alarm and verify event received
91 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070092 ${header} ${deviceEvent} Raise Onu Alarm And Get Event DYING_GASP
Scott Bakeree675552020-02-11 10:43:34 -080093 ... ${onu_sn} ONU_DYING_GASP_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010094 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ONU
Scott Bakeree675552020-02-11 10:43:34 -080095 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -080096 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
97
98Test RaiseLopcMissAlarm
99 [Documentation] Raise LOPC_MISS Alarm and verify event received
100 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700101 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800102 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800103 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
104 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
105 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
106
107Test ClearLopcMissAlarm
108 [Documentation] Clear LOPC_MISS Alarm and verify event received
109 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700110 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800111 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800112 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
113 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
114 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
115
116Test RaiseLopcMicErrorAlarm
117 [Documentation] Raise LOPC_MISS Alarm and verify event received
118 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700119 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800120 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800121 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
122 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
123 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
124
125Test ClearLopcMicErrorAlarm
126 [Documentation] Clear LOPC_MISS Alarm and verify event received
127 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700128 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800129 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800130 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
131 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
132 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800133
134Test RaiseLossOfBurstAlarm
135 [Documentation] Raise Loss Of Burst Alarm and verify event received
136 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700137 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800138 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
139 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800140 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800141 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
142
143Test ClearLossOfBurstAlarm
144 [Documentation] Clear Loss Of Burst Alarm and verify event received
145 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700146 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800147 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
148 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800149 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800150 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
151
152Test RaiseLossOfFrameAlarm
153 [Documentation] Raise Loss Of Frame 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_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800156 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
157 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
158 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
159 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
160
161Test ClearLossOfFrameAlarm
162 [Documentation] Clear Loss Of Frame 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_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800165 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
166 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
167 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
168 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
169
170Test RaiseLossOfKeySyncFailureAlarm
171 [Documentation] Raise Loss Of Key Sync 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_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800174 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
175 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
176 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
177 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
178
179Test ClearLossOfKeySyncFailureAlarm
180 [Documentation] Clear Loss Of Key Sync 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_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800183 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
184 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
185 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
186 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
187
188Test RaiseLossOfOmciChannelAlarm
189 [Documentation] Raise Loss Of Omci Channel 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_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800192 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100193 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800194 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
195 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
196
197Test ClearLossOfOmciChannelAlarm
198 [Documentation] Clear Loss Of Omci Channel 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_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800201 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100202 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800203 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
204 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
205
206Test RaiseLossOfPloamAlarm
207 [Documentation] Raise Loss Of Ploam 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_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800210 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
211 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
212 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
213 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
214
215Test ClearLossOfPloamAlarm
216 [Documentation] Clear Loss Of Ploam 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_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800219 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
220 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
221 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
222 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
223
Scott Bakere7840002020-03-23 16:50:27 -0700224# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
225# multiples are sent in a row. It seems like the bbsim state machine is interacting
226# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
227# this test to be a duplicate, which in turn is suppressed and fails. So what we
228# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800229Test RaiseLossOfSignalAlarm
230 [Documentation] Raise Loss Of Signal Alarm and verify event received
231 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700232 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
233 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800234 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
235 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
236 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
237 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
238
239Test ClearLossOfSignalAlarm
240 [Documentation] Clear Loss Of Signal Alarm and verify event received
241 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700242 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800243 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
244 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
245 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
246 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
247
248Test RaisePonLossOfSignalAlarm
249 [Documentation] Raise Loss Of Signal Alarm and verify event received
250 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700251 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700252 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100253 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800254 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
255 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
256
257Test ClearPonLossOfSignalAlarm
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 Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700261 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100262 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800263 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
264 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
265
266Test RaiseProcessingErrorAlarm
267 # Not Implemented
268 [Documentation] Raise Processing Error Alarm and verify event received
269 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700270 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800271 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
272 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
273 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
274 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
275
276Test ClearProcessingErrorAlarm
277 # Not Implemented
278 [Documentation] Clear Processing Error Alarm and verify event received
279 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700280 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800281 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
282 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
283 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
284 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
285
286Test RaiseSignalDegradeAlarm
287 [Documentation] Raise Signal Degrade Alarm and verify event received
288 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700289 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800290 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100291 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800292 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
293 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
294
295Test ClearSignalDegradeAlarm
296 [Documentation] Clear Signal Degrade Alarm and verify event received
297 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700298 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800299 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100300 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800301 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
302 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
303
304Test RaiseSignalsFailureAlarm
305 [Documentation] Raise Signals Fail 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_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800308 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100309 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800310 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
311 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
312
313Test ClearSignalsFailureAlarm
314 [Documentation] Clear Signals Fail 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_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800317 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100318 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800319 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
320 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
321
322Test RaiseStartupFailureAlarm
323 # Not Implemented
324 [Documentation] Raise Startup Failure Alarm and verify event received
325 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700326 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800327 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
328 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
329 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
330 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
331
332Test ClearStartupFailureAlarm
333 # Not Implemented
334 [Documentation] Clear Startup Failure Alarm and verify event received
335 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700336 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800337 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
338 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
339 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
340 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
341
342Test RaiseTransmissionInterferenceAlarm
343 # Not Implemented
344 [Documentation] Raise Transmission Interference Alarm and verify event received
345 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700346 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800347 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
348 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
349 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
350 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
351
352Test ClearTransmissionInterferenceAlarm
353 # Not Implemented
354 [Documentation] Clear Transmission Interference Alarm and verify event received
355 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700356 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800357 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
358 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
359 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800360 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
361
362*** Keywords ***
363Setup Suite
364 [Documentation] Set up the test suite
365 Common Test Suite Setup
366 # Ensure the voltctl pod is deployed and running
367 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
368 Wait Until Keyword Succeeds ${timeout} 5s
369 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
370 # Call Setup keyword in utils library to create and enable device
371 Run Keyword If ${setup_device} Setup
372
373Teardown Suite
374 [Documentation] Clean up devices if desired
375 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800376 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800377 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800378 Run Keyword If ${teardown_device} Delete All Devices and Verify
Scott Baker60e570d2020-02-02 22:10:13 -0800379 Run Keyword If ${teardown_device} Test Empty Device List
TorstenThieme4e2168e2021-06-22 14:01:47 +0000380 Run Keyword If ${teardown_device} Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800381 ... device-remove ${of_id}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000382 Close All ONOS SSH Connections
Scott Baker60e570d2020-02-02 22:10:13 -0800383
Scott Bakeree03dd02020-03-12 11:48:06 -0700384# Onu Alarms
385
386Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800387 [Documentation] Raise an Alarm and return event
388 [Arguments] ${name} ${sn} ${deviceEventName}
389 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700390 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800391 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800392 ${LastEventPostTimestamp} Set Variable ${since}
393 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800394 [return] ${header} ${deviceEvent}
395
Scott Bakeree03dd02020-03-12 11:48:06 -0700396Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800397 [Documentation] Clear an Alarm and return event
398 [Arguments] ${name} ${sn} ${deviceEventName}
399 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700400 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800401 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800402 ${LastEventPostTimestamp} Set Variable ${since}
403 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800404 [return] ${header} ${deviceEvent}
405
Scott Bakeree03dd02020-03-12 11:48:06 -0700406Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800407 [Documentation] Raise an Alarm
408 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700409 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
410 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800411 Should Contain ${raiseOutput} Alarm Indication Sent
412
Scott Bakeree03dd02020-03-12 11:48:06 -0700413Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800414 [Documentation] Raise an Alarm
415 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700416 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
417 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700418 Should Contain ${raiseOutput} Alarm Indication Sent
419
420# Olt Alarms
421
422Raise Olt Alarm And Get Event
423 [Documentation] Raise an Alarm and return event
424 [Arguments] ${name} ${intf_id} ${deviceEventName}
425 ${since} Get Current Time
426 Raise Olt Alarm ${name} ${intf_id}
427 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
428 ${LastEventPostTimestamp} Set Variable ${since}
429 Set Suite Variable ${LastEventPostTimestamp}
430 [return] ${header} ${deviceEvent}
431
432Clear Olt Alarm And Get Event
433 [Documentation] Clear an Alarm and return event
434 [Arguments] ${name} ${intf_id} ${deviceEventName}
435 ${since} Get Current Time
436 Clear Olt Alarm ${name} ${intf_id}
437 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
438 ${LastEventPostTimestamp} Set Variable ${since}
439 Set Suite Variable ${LastEventPostTimestamp}
440 [return] ${header} ${deviceEvent}
441
442Raise Olt Alarm
443 [Documentation] Raise an Alarm
444 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700445 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
446 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700447 Should Contain ${raiseOutput} Alarm Indication Sent
448
449Clear Olt Alarm
450 [Documentation] Raise an Alarm
451 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700452 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
453 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800454 Should Contain ${raiseOutput} Alarm Indication Sent
455
456Get Device Event
457 [Documentation] Get the most recent alarm event from voltha.events
458 [Arguments] ${deviceEventName} ${since}
459 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
Girish Gowdra698a04b2020-11-23 10:24:43 -0800460 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName}
Scott Baker60e570d2020-02-02 22:10:13 -0800461 ${json} To Json ${output}
462 ${count} Get Length ${json}
463 # If there is more than one event (which could happen if we quickly do a raise and a clear),
464 # then return the most recent one.
465 Should Be Larger Than ${count} 0
466 ${lastIndex} Evaluate ${count}-1
467 ${lastItem} Set Variable ${json}[${lastIndex}]
468 ${header} Set Variable ${lastItem}[header]
469 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
470 Log ${header}
471 Log ${deviceEvent}
472 [return] ${header} ${deviceEvent}
473
474Verify Header
475 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800476 [Arguments] ${header} ${id} ${subCategory}
477 ${headerSubCategory} Evaluate $header.get("subCategory", "")
478 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800479 Should Be Equal ${header}[type] DEVICE_EVENT
480 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800481 # TODO Timestamps are now RFC3339 date strings. Add Verification
482 ${reportedTs} Set Variable ${header}[reportedTs]
483 ${raisedTs} Set Variable ${header}[raisedTs]
484 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
485 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}