blob: 9805a9ae3d95ef5ed8b8b5ffea6432a4910178a0 [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 RaiseActivationFailureAlarm
71 # Note: Can only be raised, not cleared
72 [Documentation] Raise Activation Fail 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_ACTIVATION_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -080075 ... ${onu_sn} ONU_ACTIVATION_FAIL_RAISE_EVENT
76 # Note: PON is the zero value of the subCategory field, and causes it to be not present
77 Verify Header ${header} Voltha.openolt.ONU_ACTIVATION_FAIL\.(\\d+) ${EMPTY}
78 Should Be Equal ${deviceEvent}[deviceEventName] ONU_ACTIVATION_FAIL_RAISE_EVENT
79 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
80
81Test RaiseDriftOfWindowAlarm
82 [Documentation] Raise Drift Of Window Alarm and verify event received
83 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070084 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080085 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
86 # Note: PON is the zero value of the subCategory field, and causes it to be not present
87 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
88 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
89 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
90
91Test ClearDriftOfWindowAlarm
92 [Documentation] Clear Drift Of Window Alarm and verify event received
93 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070094 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080095 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
96 # Note: PON is the zero value of the subCategory field, and causes it to be not present
97 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
98 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
99 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
100
101Test RaiseDyingGaspAlarm
102 [Documentation] Raise Dying Gasp Alarm and verify event received
103 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700104 ${header} ${deviceEvent} Raise Onu Alarm And Get Event DYING_GASP
Scott Bakeree675552020-02-11 10:43:34 -0800105 ... ${onu_sn} ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800106 # Note: PON is the zero value of the subCategory field, and causes it to be not present
Scott Bakeree675552020-02-11 10:43:34 -0800107 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ${EMPTY}
108 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800109 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
110
111Test RaiseLopcMissAlarm
112 [Documentation] Raise LOPC_MISS Alarm and verify event received
113 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700114 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800115 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
116 # Note: PON is the zero value of the subCategory field, and causes it to be not present
117 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
118 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
119 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
120
121Test ClearLopcMissAlarm
122 [Documentation] Clear LOPC_MISS Alarm and verify event received
123 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700124 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800125 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
126 # Note: PON is the zero value of the subCategory field, and causes it to be not present
127 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
128 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
129 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
130
131Test RaiseLopcMicErrorAlarm
132 [Documentation] Raise LOPC_MISS Alarm and verify event received
133 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700134 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800135 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
136 # Note: PON is the zero value of the subCategory field, and causes it to be not present
137 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
138 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
139 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
140
141Test ClearLopcMicErrorAlarm
142 [Documentation] Clear LOPC_MISS Alarm and verify event received
143 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700144 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800145 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
146 # Note: PON is the zero value of the subCategory field, and causes it to be not present
147 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
148 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
149 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800150
151Test RaiseLossOfBurstAlarm
152 [Documentation] Raise Loss Of Burst 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_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800155 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
156 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800157 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800158 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
159
160Test ClearLossOfBurstAlarm
161 [Documentation] Clear Loss Of Burst 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_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800164 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
165 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800166 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800167 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
168
169Test RaiseLossOfFrameAlarm
170 [Documentation] Raise Loss Of Frame 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_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800173 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
174 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
175 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
176 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
177
178Test ClearLossOfFrameAlarm
179 [Documentation] Clear Loss Of Frame 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_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800182 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
183 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
184 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
185 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
186
187Test RaiseLossOfKeySyncFailureAlarm
188 [Documentation] Raise Loss Of Key Sync 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_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800191 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
192 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
193 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
194 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
195
196Test ClearLossOfKeySyncFailureAlarm
197 [Documentation] Clear Loss Of Key Sync 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_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800200 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
201 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
202 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
203 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
204
205Test RaiseLossOfOmciChannelAlarm
206 [Documentation] Raise Loss Of Omci Channel 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_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800209 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
210 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
211 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
212 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
213
214Test ClearLossOfOmciChannelAlarm
215 [Documentation] Clear Loss Of Omci Channel 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_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800218 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
219 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
220 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
221 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
222
223Test RaiseLossOfPloamAlarm
224 [Documentation] Raise Loss Of Ploam Alarm and verify event received
225 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700226 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800227 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
228 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
229 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
230 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
231
232Test ClearLossOfPloamAlarm
233 [Documentation] Clear Loss Of Ploam Alarm and verify event received
234 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700235 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800236 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
237 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
238 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
239 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
240
Scott Bakere7840002020-03-23 16:50:27 -0700241# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
242# multiples are sent in a row. It seems like the bbsim state machine is interacting
243# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
244# this test to be a duplicate, which in turn is suppressed and fails. So what we
245# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800246Test RaiseLossOfSignalAlarm
247 [Documentation] Raise Loss Of Signal Alarm and verify event received
248 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700249 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
250 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800251 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
252 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
253 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
254 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
255
256Test ClearLossOfSignalAlarm
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 Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800260 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
261 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
262 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
263 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
264
265Test RaisePonLossOfSignalAlarm
266 [Documentation] Raise Loss Of Signal Alarm and verify event received
267 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700268 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700269 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800270 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
271 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
272 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
273
274Test ClearPonLossOfSignalAlarm
275 [Documentation] Clear Loss Of Signal Alarm and verify event received
276 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700277 ${header} ${deviceEvent} Clear Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700278 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800279 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
280 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
281 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
282
283Test RaiseProcessingErrorAlarm
284 # Not Implemented
285 [Documentation] Raise Processing Error Alarm and verify event received
286 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700287 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800288 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
289 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
290 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
291 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
292
293Test ClearProcessingErrorAlarm
294 # Not Implemented
295 [Documentation] Clear Processing Error Alarm and verify event received
296 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700297 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800298 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
299 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
300 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
301 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
302
303Test RaiseSignalDegradeAlarm
304 [Documentation] Raise Signal Degrade 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_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800307 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
308 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
309 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
310 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
311
312Test ClearSignalDegradeAlarm
313 [Documentation] Clear Signal Degrade 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_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800316 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
317 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
318 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
319 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
320
321Test RaiseSignalsFailureAlarm
322 [Documentation] Raise Signals Fail Alarm and verify event received
323 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700324 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800325 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
326 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
327 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
328 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
329
330Test ClearSignalsFailureAlarm
331 [Documentation] Clear Signals Fail Alarm and verify event received
332 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700333 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800334 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
335 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
336 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
337 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
338
339Test RaiseStartupFailureAlarm
340 # Not Implemented
341 [Documentation] Raise Startup Failure Alarm and verify event received
342 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700343 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800344 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
345 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
346 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
347 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
348
349Test ClearStartupFailureAlarm
350 # Not Implemented
351 [Documentation] Clear Startup Failure Alarm and verify event received
352 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700353 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800354 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
355 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
356 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
357 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
358
359Test RaiseTransmissionInterferenceAlarm
360 # Not Implemented
361 [Documentation] Raise Transmission Interference Alarm and verify event received
362 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700363 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800364 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
365 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
366 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
367 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
368
369Test ClearTransmissionInterferenceAlarm
370 # Not Implemented
371 [Documentation] Clear Transmission Interference Alarm and verify event received
372 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700373 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800374 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
375 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
376 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800377 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
378
379*** Keywords ***
380Setup Suite
381 [Documentation] Set up the test suite
382 Common Test Suite Setup
383 # Ensure the voltctl pod is deployed and running
384 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
385 Wait Until Keyword Succeeds ${timeout} 5s
386 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
387 # Call Setup keyword in utils library to create and enable device
388 Run Keyword If ${setup_device} Setup
389
390Teardown Suite
391 [Documentation] Clean up devices if desired
392 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800393 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800394 Run Keyword If ${has_dataplane} Clean Up Linux
Scott Baker60e570d2020-02-02 22:10:13 -0800395 Run Keyword If ${teardown_device} Delete Device and Verify
396 Run Keyword If ${teardown_device} Test Empty Device List
ubuntu6b6e7d42020-03-02 12:35:42 -0800397 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800398 ... device-remove ${of_id}
399
Scott Bakeree03dd02020-03-12 11:48:06 -0700400# Onu Alarms
401
402Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800403 [Documentation] Raise an Alarm and return event
404 [Arguments] ${name} ${sn} ${deviceEventName}
405 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700406 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800407 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800408 ${LastEventPostTimestamp} Set Variable ${since}
409 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800410 [return] ${header} ${deviceEvent}
411
Scott Bakeree03dd02020-03-12 11:48:06 -0700412Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800413 [Documentation] Clear an Alarm and return event
414 [Arguments] ${name} ${sn} ${deviceEventName}
415 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700416 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800417 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800418 ${LastEventPostTimestamp} Set Variable ${since}
419 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800420 [return] ${header} ${deviceEvent}
421
Scott Bakeree03dd02020-03-12 11:48:06 -0700422Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800423 [Documentation] Raise an Alarm
424 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700425 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
426 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800427 Should Contain ${raiseOutput} Alarm Indication Sent
428
Scott Bakeree03dd02020-03-12 11:48:06 -0700429Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800430 [Documentation] Raise an Alarm
431 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700432 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
433 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700434 Should Contain ${raiseOutput} Alarm Indication Sent
435
436# Olt Alarms
437
438Raise Olt Alarm And Get Event
439 [Documentation] Raise an Alarm and return event
440 [Arguments] ${name} ${intf_id} ${deviceEventName}
441 ${since} Get Current Time
442 Raise Olt Alarm ${name} ${intf_id}
443 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
444 ${LastEventPostTimestamp} Set Variable ${since}
445 Set Suite Variable ${LastEventPostTimestamp}
446 [return] ${header} ${deviceEvent}
447
448Clear Olt Alarm And Get Event
449 [Documentation] Clear an Alarm and return event
450 [Arguments] ${name} ${intf_id} ${deviceEventName}
451 ${since} Get Current Time
452 Clear Olt Alarm ${name} ${intf_id}
453 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
454 ${LastEventPostTimestamp} Set Variable ${since}
455 Set Suite Variable ${LastEventPostTimestamp}
456 [return] ${header} ${deviceEvent}
457
458Raise Olt Alarm
459 [Documentation] Raise an Alarm
460 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700461 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
462 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700463 Should Contain ${raiseOutput} Alarm Indication Sent
464
465Clear Olt Alarm
466 [Documentation] Raise an Alarm
467 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700468 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
469 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800470 Should Contain ${raiseOutput} Alarm Indication Sent
471
472Get Device Event
473 [Documentation] Get the most recent alarm event from voltha.events
474 [Arguments] ${deviceEventName} ${since}
475 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
476 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName} -s ${since}
477 ${json} To Json ${output}
478 ${count} Get Length ${json}
479 # If there is more than one event (which could happen if we quickly do a raise and a clear),
480 # then return the most recent one.
481 Should Be Larger Than ${count} 0
482 ${lastIndex} Evaluate ${count}-1
483 ${lastItem} Set Variable ${json}[${lastIndex}]
484 ${header} Set Variable ${lastItem}[header]
485 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
486 Log ${header}
487 Log ${deviceEvent}
488 [return] ${header} ${deviceEvent}
489
490Verify Header
491 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800492 [Arguments] ${header} ${id} ${subCategory}
493 ${headerSubCategory} Evaluate $header.get("subCategory", "")
494 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800495 Should Be Equal ${header}[type] DEVICE_EVENT
496 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800497 # TODO Timestamps are now RFC3339 date strings. Add Verification
498 ${reportedTs} Set Variable ${header}[reportedTs]
499 ${raisedTs} Set Variable ${header}[raisedTs]
500 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
501 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}