blob: 9b7da615f5d33536564d63dae0801befd26191ff [file] [log] [blame]
Scott Baker60e570d2020-02-02 22:10:13 -08001#Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15*** Settings ***
16Documentation This test raises alarms using bbsimctl and verifies them using voltctl
17Suite Setup Setup Suite
18Suite Teardown Teardown Suite
19Library Collections
20Library String
21Library OperatingSystem
22Library XML
23Library RequestsLibrary
24Library ../../libraries/DependencyLibrary.py
25Resource ../../libraries/onos.robot
26Resource ../../libraries/voltctl.robot
27Resource ../../libraries/utils.robot
28Resource ../../libraries/k8s.robot
29Resource ../../variables/variables.robot
30
31*** Variables ***
32${timeout} 60s
33${long_timeout} 420s
34${of_id} 0
35${logical_id} 0
36${has_dataplane} True
Scott Baker60e570d2020-02-02 22:10:13 -080037${setup_device} True
38${teardown_device} True
39${VOLTCTL_NAMESPACE} default
40${BBSIMCTL_NAMESPACE} voltha
41${VOLTCTL_POD_NAME} voltctl
42${BBSIMCTL_POD_NAME} bbsim
43
44*** Test Cases ***
45Ensure required pods Running
46 [Documentation] Ensure the bbsim and voltctl pods are in Running state
47 [Tags] active
48 Validate Pod Status ${BBSIMCTL_POD_NAME} ${BBSIMCTL_NAMESPACE} Running
49 Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
50
51ONU Discovery
52 [Documentation] Discover lists of ONUS, their Serial Numbers and device id, and pick one for subsequent tests
53 [Tags] active
54 #build onu sn list
55 ${List_ONU_Serial} Create List
56 Set Suite Variable ${List_ONU_Serial}
57 Build ONU SN List ${List_ONU_Serial}
58 Log ${List_ONU_Serial}
59 #validate onu states
60 Wait Until Keyword Succeeds ${long_timeout} 20s
61 ... Validate ONU Devices ENABLED ACTIVE REACHABLE ${List_ONU_Serial}
62 # Pick an ONU to use for subsequent test cases
63 ${onu_sn} Set Variable ${List_ONU_Serial}[0]
64 Set Suite Variable ${onu_sn}
65 ${onu_id} Get Device ID From SN ${onu_sn}
66 Set Suite Variable ${onu_id}
Scott Baker27d04db2020-02-06 18:03:21 -080067 ${parent_id} Get Parent ID From Device ID ${onu_id}
68 Set Suite Variable ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -080069
Scott Baker27d04db2020-02-06 18:03:21 -080070Test RaiseDriftOfWindowAlarm
71 [Documentation] Raise Drift Of Window Alarm and verify event received
72 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070073 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080074 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010075 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080076 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
77 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
78
79Test ClearDriftOfWindowAlarm
80 [Documentation] Clear Drift Of Window Alarm and verify event received
81 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070082 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080083 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010084 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080085 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
86 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
87
88Test RaiseDyingGaspAlarm
89 [Documentation] Raise Dying Gasp Alarm and verify event received
90 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070091 ${header} ${deviceEvent} Raise Onu Alarm And Get Event DYING_GASP
Scott Bakeree675552020-02-11 10:43:34 -080092 ... ${onu_sn} ONU_DYING_GASP_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010093 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ONU
Scott Bakeree675552020-02-11 10:43:34 -080094 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -080095 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
96
97Test RaiseLopcMissAlarm
98 [Documentation] Raise LOPC_MISS Alarm and verify event received
99 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700100 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800101 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800102 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
103 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
104 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
105
106Test ClearLopcMissAlarm
107 [Documentation] Clear LOPC_MISS Alarm and verify event received
108 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700109 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800110 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800111 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
112 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
113 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
114
115Test RaiseLopcMicErrorAlarm
116 [Documentation] Raise LOPC_MISS Alarm and verify event received
117 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700118 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800119 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800120 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
121 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
122 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
123
124Test ClearLopcMicErrorAlarm
125 [Documentation] Clear LOPC_MISS Alarm and verify event received
126 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700127 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800128 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800129 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
130 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
131 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800132
133Test RaiseLossOfBurstAlarm
134 [Documentation] Raise Loss Of Burst Alarm and verify event received
135 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700136 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800137 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
138 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800139 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800140 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
141
142Test ClearLossOfBurstAlarm
143 [Documentation] Clear Loss Of Burst 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_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800146 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
147 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800148 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800149 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
150
151Test RaiseLossOfFrameAlarm
152 [Documentation] Raise Loss Of Frame Alarm and verify event received
153 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700154 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800155 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
156 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
157 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
158 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
159
160Test ClearLossOfFrameAlarm
161 [Documentation] Clear Loss Of Frame Alarm and verify event received
162 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700163 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800164 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
165 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
166 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
167 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
168
169Test RaiseLossOfKeySyncFailureAlarm
170 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
171 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700172 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800173 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
174 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
175 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
176 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
177
178Test ClearLossOfKeySyncFailureAlarm
179 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
180 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700181 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800182 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
183 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
184 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
185 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
186
187Test RaiseLossOfOmciChannelAlarm
188 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
189 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700190 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800191 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100192 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800193 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
194 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
195
196Test ClearLossOfOmciChannelAlarm
197 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
198 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700199 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800200 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100201 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800202 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
203 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
204
205Test RaiseLossOfPloamAlarm
206 [Documentation] Raise Loss Of Ploam Alarm and verify event received
207 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700208 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800209 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
210 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
211 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
212 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
213
214Test ClearLossOfPloamAlarm
215 [Documentation] Clear Loss Of Ploam Alarm and verify event received
216 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700217 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800218 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
219 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
220 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
221 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
222
Scott Bakere7840002020-03-23 16:50:27 -0700223# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
224# multiples are sent in a row. It seems like the bbsim state machine is interacting
225# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
226# this test to be a duplicate, which in turn is suppressed and fails. So what we
227# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800228Test RaiseLossOfSignalAlarm
229 [Documentation] Raise Loss Of Signal Alarm and verify event received
230 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700231 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
232 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800233 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
234 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
235 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
236 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
237
238Test ClearLossOfSignalAlarm
239 [Documentation] Clear Loss Of Signal Alarm and verify event received
240 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700241 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800242 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
243 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
244 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
245 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
246
247Test RaisePonLossOfSignalAlarm
248 [Documentation] Raise Loss Of Signal Alarm and verify event received
249 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700250 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700251 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100252 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800253 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
254 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
255
256Test ClearPonLossOfSignalAlarm
257 [Documentation] Clear Loss Of Signal Alarm and verify event received
258 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700259 ${header} ${deviceEvent} Clear Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700260 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100261 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800262 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
263 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
264
265Test RaiseProcessingErrorAlarm
266 # Not Implemented
267 [Documentation] Raise Processing Error Alarm and verify event received
268 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700269 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800270 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
271 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
272 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
273 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
274
275Test ClearProcessingErrorAlarm
276 # Not Implemented
277 [Documentation] Clear Processing Error Alarm and verify event received
278 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700279 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800280 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
281 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
282 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
283 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
284
285Test RaiseSignalDegradeAlarm
286 [Documentation] Raise Signal Degrade Alarm and verify event received
287 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700288 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800289 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100290 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800291 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
292 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
293
294Test ClearSignalDegradeAlarm
295 [Documentation] Clear Signal Degrade Alarm and verify event received
296 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700297 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800298 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100299 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800300 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
301 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
302
303Test RaiseSignalsFailureAlarm
304 [Documentation] Raise Signals Fail Alarm and verify event received
305 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700306 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800307 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100308 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800309 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
310 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
311
312Test ClearSignalsFailureAlarm
313 [Documentation] Clear Signals Fail Alarm and verify event received
314 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700315 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800316 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100317 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800318 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
319 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
320
321Test RaiseStartupFailureAlarm
322 # Not Implemented
323 [Documentation] Raise Startup Failure Alarm and verify event received
324 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700325 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800326 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
327 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
328 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
329 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
330
331Test ClearStartupFailureAlarm
332 # Not Implemented
333 [Documentation] Clear Startup Failure Alarm and verify event received
334 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700335 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800336 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
337 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
338 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
339 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
340
341Test RaiseTransmissionInterferenceAlarm
342 # Not Implemented
343 [Documentation] Raise Transmission Interference Alarm and verify event received
344 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700345 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800346 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
347 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
348 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
349 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
350
351Test ClearTransmissionInterferenceAlarm
352 # Not Implemented
353 [Documentation] Clear Transmission Interference Alarm and verify event received
354 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700355 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800356 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
357 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
358 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800359 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
360
361*** Keywords ***
362Setup Suite
363 [Documentation] Set up the test suite
364 Common Test Suite Setup
365 # Ensure the voltctl pod is deployed and running
366 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
367 Wait Until Keyword Succeeds ${timeout} 5s
368 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
369 # Call Setup keyword in utils library to create and enable device
370 Run Keyword If ${setup_device} Setup
371
372Teardown Suite
373 [Documentation] Clean up devices if desired
374 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800375 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800376 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800377 Run Keyword If ${teardown_device} Delete All Devices and Verify
Scott Baker60e570d2020-02-02 22:10:13 -0800378 Run Keyword If ${teardown_device} Test Empty Device List
TorstenThieme4e2168e2021-06-22 14:01:47 +0000379 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 -0800380 ... device-remove ${of_id}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000381 Close All ONOS SSH Connections
Scott Baker60e570d2020-02-02 22:10:13 -0800382
Scott Bakeree03dd02020-03-12 11:48:06 -0700383# Onu Alarms
384
385Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800386 [Documentation] Raise an Alarm and return event
387 [Arguments] ${name} ${sn} ${deviceEventName}
388 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700389 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800390 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800391 ${LastEventPostTimestamp} Set Variable ${since}
392 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800393 [return] ${header} ${deviceEvent}
394
Scott Bakeree03dd02020-03-12 11:48:06 -0700395Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800396 [Documentation] Clear an Alarm and return event
397 [Arguments] ${name} ${sn} ${deviceEventName}
398 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700399 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800400 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800401 ${LastEventPostTimestamp} Set Variable ${since}
402 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800403 [return] ${header} ${deviceEvent}
404
Scott Bakeree03dd02020-03-12 11:48:06 -0700405Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800406 [Documentation] Raise an Alarm
407 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700408 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
409 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800410 Should Contain ${raiseOutput} Alarm Indication Sent
411
Scott Bakeree03dd02020-03-12 11:48:06 -0700412Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800413 [Documentation] Raise an Alarm
414 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700415 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
416 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700417 Should Contain ${raiseOutput} Alarm Indication Sent
418
419# Olt Alarms
420
421Raise Olt Alarm And Get Event
422 [Documentation] Raise an Alarm and return event
423 [Arguments] ${name} ${intf_id} ${deviceEventName}
424 ${since} Get Current Time
425 Raise Olt Alarm ${name} ${intf_id}
426 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
427 ${LastEventPostTimestamp} Set Variable ${since}
428 Set Suite Variable ${LastEventPostTimestamp}
429 [return] ${header} ${deviceEvent}
430
431Clear Olt Alarm And Get Event
432 [Documentation] Clear an Alarm and return event
433 [Arguments] ${name} ${intf_id} ${deviceEventName}
434 ${since} Get Current Time
435 Clear Olt Alarm ${name} ${intf_id}
436 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
437 ${LastEventPostTimestamp} Set Variable ${since}
438 Set Suite Variable ${LastEventPostTimestamp}
439 [return] ${header} ${deviceEvent}
440
441Raise Olt Alarm
442 [Documentation] Raise an Alarm
443 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700444 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
445 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700446 Should Contain ${raiseOutput} Alarm Indication Sent
447
448Clear Olt Alarm
449 [Documentation] Raise an Alarm
450 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700451 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
452 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800453 Should Contain ${raiseOutput} Alarm Indication Sent
454
455Get Device Event
456 [Documentation] Get the most recent alarm event from voltha.events
457 [Arguments] ${deviceEventName} ${since}
458 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
Girish Gowdra698a04b2020-11-23 10:24:43 -0800459 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName}
Scott Baker60e570d2020-02-02 22:10:13 -0800460 ${json} To Json ${output}
461 ${count} Get Length ${json}
462 # If there is more than one event (which could happen if we quickly do a raise and a clear),
463 # then return the most recent one.
464 Should Be Larger Than ${count} 0
465 ${lastIndex} Evaluate ${count}-1
466 ${lastItem} Set Variable ${json}[${lastIndex}]
467 ${header} Set Variable ${lastItem}[header]
468 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
469 Log ${header}
470 Log ${deviceEvent}
471 [return] ${header} ${deviceEvent}
472
473Verify Header
474 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800475 [Arguments] ${header} ${id} ${subCategory}
476 ${headerSubCategory} Evaluate $header.get("subCategory", "")
477 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800478 Should Be Equal ${header}[type] DEVICE_EVENT
479 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800480 # TODO Timestamps are now RFC3339 date strings. Add Verification
481 ${reportedTs} Set Variable ${header}[reportedTs]
482 ${raisedTs} Set Variable ${header}[raisedTs]
483 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
484 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}