blob: 8f413c3311078a555597bb6b65e433e84cbd0b3e [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
75 # Note: PON is the zero value of the subCategory field, and causes it to be not present
76 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
77 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
85 # Note: PON is the zero value of the subCategory field, and causes it to be not present
86 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ${EMPTY}
87 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
88 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
89
90Test RaiseDyingGaspAlarm
91 [Documentation] Raise Dying Gasp Alarm and verify event received
92 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070093 ${header} ${deviceEvent} Raise Onu Alarm And Get Event DYING_GASP
Scott Bakeree675552020-02-11 10:43:34 -080094 ... ${onu_sn} ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -080095 # Note: PON is the zero value of the subCategory field, and causes it to be not present
Scott Bakeree675552020-02-11 10:43:34 -080096 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ${EMPTY}
97 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -080098 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
99
100Test RaiseLopcMissAlarm
101 [Documentation] Raise LOPC_MISS Alarm and verify event received
102 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700103 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800104 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
105 # Note: PON is the zero value of the subCategory field, and causes it to be not present
106 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
107 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
108 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
109
110Test ClearLopcMissAlarm
111 [Documentation] Clear LOPC_MISS Alarm and verify event received
112 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700113 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800114 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
115 # Note: PON is the zero value of the subCategory field, and causes it to be not present
116 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
117 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
118 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
119
120Test RaiseLopcMicErrorAlarm
121 [Documentation] Raise LOPC_MISS Alarm and verify event received
122 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700123 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800124 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
125 # Note: PON is the zero value of the subCategory field, and causes it to be not present
126 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
127 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
128 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
129
130Test ClearLopcMicErrorAlarm
131 [Documentation] Clear LOPC_MISS Alarm and verify event received
132 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700133 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800134 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
135 # Note: PON is the zero value of the subCategory field, and causes it to be not present
136 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
137 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
138 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800139
140Test RaiseLossOfBurstAlarm
141 [Documentation] Raise Loss Of Burst Alarm and verify event received
142 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700143 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800144 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
145 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800146 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800147 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
148
149Test ClearLossOfBurstAlarm
150 [Documentation] Clear Loss Of Burst Alarm and verify event received
151 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700152 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800153 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
154 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800155 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800156 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
157
158Test RaiseLossOfFrameAlarm
159 [Documentation] Raise Loss Of Frame Alarm and verify event received
160 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700161 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800162 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
163 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
164 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
165 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
166
167Test ClearLossOfFrameAlarm
168 [Documentation] Clear Loss Of Frame Alarm and verify event received
169 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700170 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800171 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
172 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
173 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
174 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
175
176Test RaiseLossOfKeySyncFailureAlarm
177 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
178 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700179 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800180 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
181 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
182 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
183 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
184
185Test ClearLossOfKeySyncFailureAlarm
186 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
187 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700188 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800189 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
190 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
191 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
192 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
193
194Test RaiseLossOfOmciChannelAlarm
195 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
196 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700197 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800198 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
199 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
200 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
201 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
202
203Test ClearLossOfOmciChannelAlarm
204 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
205 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700206 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800207 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
208 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ${EMPTY}
209 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
210 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
211
212Test RaiseLossOfPloamAlarm
213 [Documentation] Raise Loss Of Ploam Alarm and verify event received
214 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700215 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800216 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
217 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
218 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
219 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
220
221Test ClearLossOfPloamAlarm
222 [Documentation] Clear Loss Of Ploam Alarm and verify event received
223 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700224 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800225 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
226 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
227 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
228 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
229
Scott Bakere7840002020-03-23 16:50:27 -0700230# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
231# multiples are sent in a row. It seems like the bbsim state machine is interacting
232# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
233# this test to be a duplicate, which in turn is suppressed and fails. So what we
234# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800235Test RaiseLossOfSignalAlarm
236 [Documentation] Raise Loss Of Signal Alarm and verify event received
237 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700238 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
239 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800240 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
241 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
242 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
243 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
244
245Test ClearLossOfSignalAlarm
246 [Documentation] Clear Loss Of Signal Alarm and verify event received
247 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700248 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800249 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
250 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
251 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
252 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
253
254Test RaisePonLossOfSignalAlarm
255 [Documentation] Raise Loss Of Signal Alarm and verify event received
256 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700257 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700258 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800259 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
260 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
261 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
262
263Test ClearPonLossOfSignalAlarm
264 [Documentation] Clear Loss Of Signal Alarm and verify event received
265 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700266 ${header} ${deviceEvent} Clear Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700267 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800268 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) OLT
269 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
270 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
271
272Test RaiseProcessingErrorAlarm
273 # Not Implemented
274 [Documentation] Raise Processing Error Alarm and verify event received
275 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700276 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800277 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
278 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
279 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
280 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
281
282Test ClearProcessingErrorAlarm
283 # Not Implemented
284 [Documentation] Clear Processing Error Alarm and verify event received
285 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700286 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800287 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
288 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
289 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
290 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
291
292Test RaiseSignalDegradeAlarm
293 [Documentation] Raise Signal Degrade Alarm and verify event received
294 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700295 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800296 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
297 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
298 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
299 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
300
301Test ClearSignalDegradeAlarm
302 [Documentation] Clear Signal Degrade Alarm and verify event received
303 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700304 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800305 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
306 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ${EMPTY}
307 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
308 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
309
310Test RaiseSignalsFailureAlarm
311 [Documentation] Raise Signals Fail Alarm and verify event received
312 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700313 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800314 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
315 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
316 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
317 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
318
319Test ClearSignalsFailureAlarm
320 [Documentation] Clear Signals Fail Alarm and verify event received
321 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700322 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800323 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
324 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ${EMPTY}
325 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
326 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
327
328Test RaiseStartupFailureAlarm
329 # Not Implemented
330 [Documentation] Raise Startup Failure Alarm and verify event received
331 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700332 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800333 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
334 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
335 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
336 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
337
338Test ClearStartupFailureAlarm
339 # Not Implemented
340 [Documentation] Clear Startup Failure Alarm and verify event received
341 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700342 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800343 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
344 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
345 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
346 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
347
348Test RaiseTransmissionInterferenceAlarm
349 # Not Implemented
350 [Documentation] Raise Transmission Interference Alarm and verify event received
351 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700352 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800353 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
354 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
355 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
356 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
357
358Test ClearTransmissionInterferenceAlarm
359 # Not Implemented
360 [Documentation] Clear Transmission Interference Alarm and verify event received
361 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700362 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800363 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
364 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
365 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800366 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
367
368*** Keywords ***
369Setup Suite
370 [Documentation] Set up the test suite
371 Common Test Suite Setup
372 # Ensure the voltctl pod is deployed and running
373 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
374 Wait Until Keyword Succeeds ${timeout} 5s
375 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
376 # Call Setup keyword in utils library to create and enable device
377 Run Keyword If ${setup_device} Setup
378
379Teardown Suite
380 [Documentation] Clean up devices if desired
381 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800382 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800383 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800384 Run Keyword If ${teardown_device} Delete All Devices and Verify
Scott Baker60e570d2020-02-02 22:10:13 -0800385 Run Keyword If ${teardown_device} Test Empty Device List
ubuntu6b6e7d42020-03-02 12:35:42 -0800386 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800387 ... device-remove ${of_id}
388
Scott Bakeree03dd02020-03-12 11:48:06 -0700389# Onu Alarms
390
391Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800392 [Documentation] Raise an Alarm and return event
393 [Arguments] ${name} ${sn} ${deviceEventName}
394 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700395 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800396 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800397 ${LastEventPostTimestamp} Set Variable ${since}
398 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800399 [return] ${header} ${deviceEvent}
400
Scott Bakeree03dd02020-03-12 11:48:06 -0700401Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800402 [Documentation] Clear an Alarm and return event
403 [Arguments] ${name} ${sn} ${deviceEventName}
404 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700405 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800406 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800407 ${LastEventPostTimestamp} Set Variable ${since}
408 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800409 [return] ${header} ${deviceEvent}
410
Scott Bakeree03dd02020-03-12 11:48:06 -0700411Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800412 [Documentation] Raise an Alarm
413 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700414 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
415 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800416 Should Contain ${raiseOutput} Alarm Indication Sent
417
Scott Bakeree03dd02020-03-12 11:48:06 -0700418Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800419 [Documentation] Raise an Alarm
420 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700421 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
422 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700423 Should Contain ${raiseOutput} Alarm Indication Sent
424
425# Olt Alarms
426
427Raise Olt Alarm And Get Event
428 [Documentation] Raise an Alarm and return event
429 [Arguments] ${name} ${intf_id} ${deviceEventName}
430 ${since} Get Current Time
431 Raise Olt Alarm ${name} ${intf_id}
432 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
433 ${LastEventPostTimestamp} Set Variable ${since}
434 Set Suite Variable ${LastEventPostTimestamp}
435 [return] ${header} ${deviceEvent}
436
437Clear Olt Alarm And Get Event
438 [Documentation] Clear an Alarm and return event
439 [Arguments] ${name} ${intf_id} ${deviceEventName}
440 ${since} Get Current Time
441 Clear Olt Alarm ${name} ${intf_id}
442 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
443 ${LastEventPostTimestamp} Set Variable ${since}
444 Set Suite Variable ${LastEventPostTimestamp}
445 [return] ${header} ${deviceEvent}
446
447Raise Olt Alarm
448 [Documentation] Raise an Alarm
449 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700450 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
451 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700452 Should Contain ${raiseOutput} Alarm Indication Sent
453
454Clear Olt Alarm
455 [Documentation] Raise an Alarm
456 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700457 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
458 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800459 Should Contain ${raiseOutput} Alarm Indication Sent
460
461Get Device Event
462 [Documentation] Get the most recent alarm event from voltha.events
463 [Arguments] ${deviceEventName} ${since}
464 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
Girish Gowdra698a04b2020-11-23 10:24:43 -0800465 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName}
Scott Baker60e570d2020-02-02 22:10:13 -0800466 ${json} To Json ${output}
467 ${count} Get Length ${json}
468 # If there is more than one event (which could happen if we quickly do a raise and a clear),
469 # then return the most recent one.
470 Should Be Larger Than ${count} 0
471 ${lastIndex} Evaluate ${count}-1
472 ${lastItem} Set Variable ${json}[${lastIndex}]
473 ${header} Set Variable ${lastItem}[header]
474 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
475 Log ${header}
476 Log ${deviceEvent}
477 [return] ${header} ${deviceEvent}
478
479Verify Header
480 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800481 [Arguments] ${header} ${id} ${subCategory}
482 ${headerSubCategory} Evaluate $header.get("subCategory", "")
483 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800484 Should Be Equal ${header}[type] DEVICE_EVENT
485 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800486 # TODO Timestamps are now RFC3339 date strings. Add Verification
487 ${reportedTs} Set Variable ${header}[reportedTs]
488 ${raisedTs} Set Variable ${header}[raisedTs]
489 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
490 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}