blob: 4437135d7d7585b6e4b2ab647d5a715844c73faf [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 Windlassfb1d1e42021-10-28 06:25:52 +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
Hardik Windlassa9b38262021-10-27 08:14:22 +000044${INFRA_NAMESPACE} default
Scott Baker60e570d2020-02-02 22:10:13 -080045
46*** Test Cases ***
47Ensure required pods Running
48 [Documentation] Ensure the bbsim and voltctl pods are in Running state
49 [Tags] active
50 Validate Pod Status ${BBSIMCTL_POD_NAME} ${BBSIMCTL_NAMESPACE} Running
51 Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
52
53ONU Discovery
54 [Documentation] Discover lists of ONUS, their Serial Numbers and device id, and pick one for subsequent tests
55 [Tags] active
56 #build onu sn list
57 ${List_ONU_Serial} Create List
58 Set Suite Variable ${List_ONU_Serial}
59 Build ONU SN List ${List_ONU_Serial}
60 Log ${List_ONU_Serial}
61 #validate onu states
62 Wait Until Keyword Succeeds ${long_timeout} 20s
63 ... Validate ONU Devices ENABLED ACTIVE REACHABLE ${List_ONU_Serial}
64 # Pick an ONU to use for subsequent test cases
65 ${onu_sn} Set Variable ${List_ONU_Serial}[0]
66 Set Suite Variable ${onu_sn}
67 ${onu_id} Get Device ID From SN ${onu_sn}
68 Set Suite Variable ${onu_id}
Scott Baker27d04db2020-02-06 18:03:21 -080069 ${parent_id} Get Parent ID From Device ID ${onu_id}
70 Set Suite Variable ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -080071
Scott Baker27d04db2020-02-06 18:03:21 -080072Test RaiseDriftOfWindowAlarm
73 [Documentation] Raise Drift Of Window Alarm and verify event received
74 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070075 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080076 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010077 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080078 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DRIFT_OF_WINDOW_RAISE_EVENT
79 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
80
81Test ClearDriftOfWindowAlarm
82 [Documentation] Clear Drift Of Window Alarm and verify event received
83 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -070084 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_DRIFT_OF_WINDOW
Scott Baker27d04db2020-02-06 18:03:21 -080085 ... ${onu_sn} ONU_DRIFT_OF_WINDOW_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +010086 Verify Header ${header} Voltha.openolt.ONU_DRIFT_OF_WINDOW\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -080087 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
Andrea Campanellaff8abb22021-02-22 16:00:40 +010095 Verify Header ${header} Voltha.openolt.ONU_DYING\.(\\d+) ONU
Scott Bakeree675552020-02-11 10:43:34 -080096 Should Be Equal ${deviceEvent}[deviceEventName] ONU_DYING_GASP_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -080097 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
98
99Test RaiseLopcMissAlarm
100 [Documentation] Raise LOPC_MISS Alarm and verify event received
101 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700102 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800103 ... ${onu_sn} ONU_LOPC_MISS_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800104 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
105 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_RAISE_EVENT
106 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
107
108Test ClearLopcMissAlarm
109 [Documentation] Clear LOPC_MISS Alarm and verify event received
110 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700111 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MISS
Scott Baker27d04db2020-02-06 18:03:21 -0800112 ... ${onu_sn} ONU_LOPC_MISS_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800113 Verify Header ${header} Voltha.openolt.ONU_LOPC_MISS\.(\\d+) ONU
114 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MISS_CLEAR_EVENT
115 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
116
117Test RaiseLopcMicErrorAlarm
118 [Documentation] Raise LOPC_MISS Alarm and verify event received
119 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700120 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800121 ... ${onu_sn} ONU_LOPC_MIC_ERROR_RAISE_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800122 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
123 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_RAISE_EVENT
124 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
125
126Test ClearLopcMicErrorAlarm
127 [Documentation] Clear LOPC_MISS Alarm and verify event received
128 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700129 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOPC_MIC_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800130 ... ${onu_sn} ONU_LOPC_MIC_ERROR_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800131 Verify Header ${header} Voltha.openolt.ONU_LOPC_MIC_ERROR\.(\\d+) ONU
132 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOPC_MIC_ERROR_CLEAR_EVENT
133 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800134
135Test RaiseLossOfBurstAlarm
136 [Documentation] Raise Loss Of Burst Alarm and verify event received
137 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700138 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800139 ... ${onu_sn} ONU_LOSS_OF_BURST_RAISE_EVENT
140 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800141 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_RAISE_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800142 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
143
144Test ClearLossOfBurstAlarm
145 [Documentation] Clear Loss Of Burst Alarm and verify event received
146 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700147 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOB
Scott Baker27d04db2020-02-06 18:03:21 -0800148 ... ${onu_sn} ONU_LOSS_OF_BURST_CLEAR_EVENT
149 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_BURST\.(\\d+) ONU
Scott Baker60e570d2020-02-02 22:10:13 -0800150 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_BURST_CLEAR_EVENT
Scott Baker27d04db2020-02-06 18:03:21 -0800151 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
152
153Test RaiseLossOfFrameAlarm
154 [Documentation] Raise Loss Of Frame Alarm and verify event received
155 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700156 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800157 ... ${onu_sn} ONU_LOSS_OF_FRAME_RAISE_EVENT
158 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
159 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_RAISE_EVENT
160 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
161
162Test ClearLossOfFrameAlarm
163 [Documentation] Clear Loss Of Frame Alarm and verify event received
164 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700165 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOFI
Scott Baker27d04db2020-02-06 18:03:21 -0800166 ... ${onu_sn} ONU_LOSS_OF_FRAME_CLEAR_EVENT
167 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_FRAME\.(\\d+) ONU
168 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_FRAME_CLEAR_EVENT
169 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
170
171Test RaiseLossOfKeySyncFailureAlarm
172 [Documentation] Raise Loss Of Key Sync Alarm and verify event received
173 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700174 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800175 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
176 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
177 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_RAISE_EVENT
178 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
179
180Test ClearLossOfKeySyncFailureAlarm
181 [Documentation] Clear Loss Of Key Sync Alarm and verify event received
182 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700183 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_KEY_SYNC_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800184 ... ${onu_sn} ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
185 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_KEY_SYNC\.(\\d+) ONU
186 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_KEY_SYNC_CLEAR_EVENT
187 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
188
189Test RaiseLossOfOmciChannelAlarm
190 [Documentation] Raise Loss Of Omci Channel Alarm and verify event received
191 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700192 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800193 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100194 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800195 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_RAISE_EVENT
196 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
197
198Test ClearLossOfOmciChannelAlarm
199 [Documentation] Clear Loss Of Omci Channel Alarm and verify event received
200 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700201 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_LOSS_OF_OMCI_CHANNEL
Scott Baker27d04db2020-02-06 18:03:21 -0800202 ... ${onu_sn} ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100203 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_OMCI_CHANNEL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800204 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_OMCI_CHANNEL_CLEAR_EVENT
205 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
206
207Test RaiseLossOfPloamAlarm
208 [Documentation] Raise Loss Of Ploam Alarm and verify event received
209 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700210 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800211 ... ${onu_sn} ONU_LOSS_OF_PLOAM_RAISE_EVENT
212 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
213 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_RAISE_EVENT
214 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
215
216Test ClearLossOfPloamAlarm
217 [Documentation] Clear Loss Of Ploam Alarm and verify event received
218 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700219 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOAMI
Scott Baker27d04db2020-02-06 18:03:21 -0800220 ... ${onu_sn} ONU_LOSS_OF_PLOAM_CLEAR_EVENT
221 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_PLOAM\.(\\d+) ONU
222 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_PLOAM_CLEAR_EVENT
223 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
224
Scott Bakere7840002020-03-23 16:50:27 -0700225# NOTE: ONU_ALARM_LOS a bit touchy as it seems to be automatically suppressed if
226# multiples are sent in a row. It seems like the bbsim state machine is interacting
227# with alarms, sometimes causing an ONU_ALARM_LOS to be sent, which then causes
228# this test to be a duplicate, which in turn is suppressed and fails. So what we
229# do is issue a CLEAR right before the RAISE.
Scott Baker27d04db2020-02-06 18:03:21 -0800230Test RaiseLossOfSignalAlarm
231 [Documentation] Raise Loss Of Signal Alarm and verify event received
232 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700233 Clear Onu Alarm ONU_ALARM_LOS ${onu_sn}
234 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800235 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_RAISE_EVENT
236 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
237 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_RAISE_EVENT
238 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
239
240Test ClearLossOfSignalAlarm
241 [Documentation] Clear Loss Of Signal Alarm and verify event received
242 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700243 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_ALARM_LOS
Scott Baker27d04db2020-02-06 18:03:21 -0800244 ... ${onu_sn} ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
245 Verify Header ${header} Voltha.openolt.ONU_LOSS_OF_SIGNAL\.(\\d+) ONU
246 Should Be Equal ${deviceEvent}[deviceEventName] ONU_LOSS_OF_SIGNAL_CLEAR_EVENT
247 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
248
249Test RaisePonLossOfSignalAlarm
250 [Documentation] Raise Loss Of Signal Alarm and verify event received
251 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700252 ${header} ${deviceEvent} Raise Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700253 ... 0 OLT_LOSS_OF_SIGNAL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100254 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800255 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_RAISE_EVENT
256 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
257
258Test ClearPonLossOfSignalAlarm
259 [Documentation] Clear Loss Of Signal Alarm and verify event received
260 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700261 ${header} ${deviceEvent} Clear Olt Alarm And Get Event OLT_PON_LOS
Scott Bakeree03dd02020-03-12 11:48:06 -0700262 ... 0 OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100263 Verify Header ${header} Voltha.openolt.OLT_LOSS_OF_SIGNAL\.(\\d+) PON
Scott Baker27d04db2020-02-06 18:03:21 -0800264 Should Be Equal ${deviceEvent}[deviceEventName] OLT_LOSS_OF_SIGNAL_CLEAR_EVENT
265 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
266
267Test RaiseProcessingErrorAlarm
268 # Not Implemented
269 [Documentation] Raise Processing Error Alarm and verify event received
270 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700271 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800272 ... ${onu_sn} ONU_PROCESSING_ERROR_RAISE_EVENT
273 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
274 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_RAISE_EVENT
275 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
276
277Test ClearProcessingErrorAlarm
278 # Not Implemented
279 [Documentation] Clear Processing Error Alarm and verify event received
280 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700281 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_PROCESSING_ERROR
Scott Baker27d04db2020-02-06 18:03:21 -0800282 ... ${onu_sn} ONU_PROCESSING_ERROR_CLEAR_EVENT
283 Verify Header ${header} Voltha.openolt.ONU_PROCESSING_ERROR\.(\\d+) ONU
284 Should Be Equal ${deviceEvent}[deviceEventName] ONU_PROCESSING_ERROR_CLEAR_EVENT
285 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
286
287Test RaiseSignalDegradeAlarm
288 [Documentation] Raise Signal Degrade Alarm and verify event received
289 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700290 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800291 ... ${onu_sn} ONU_SIGNAL_DEGRADE_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100292 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800293 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_RAISE_EVENT
294 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
295
296Test ClearSignalDegradeAlarm
297 [Documentation] Clear Signal Degrade Alarm and verify event received
298 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700299 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNAL_DEGRADE
Scott Baker27d04db2020-02-06 18:03:21 -0800300 ... ${onu_sn} ONU_SIGNAL_DEGRADE_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100301 Verify Header ${header} Voltha.openolt.ONU_SIGNAL_DEGRADE\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800302 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNAL_DEGRADE_CLEAR_EVENT
303 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
304
305Test RaiseSignalsFailureAlarm
306 [Documentation] Raise Signals Fail Alarm and verify event received
307 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700308 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800309 ... ${onu_sn} ONU_SIGNALS_FAIL_RAISE_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100310 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800311 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_RAISE_EVENT
312 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
313
314Test ClearSignalsFailureAlarm
315 [Documentation] Clear Signals Fail Alarm and verify event received
316 [Tags] active
Scott Bakere7840002020-03-23 16:50:27 -0700317 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_SIGNALS_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800318 ... ${onu_sn} ONU_SIGNALS_FAIL_CLEAR_EVENT
Andrea Campanellaff8abb22021-02-22 16:00:40 +0100319 Verify Header ${header} Voltha.openolt.ONU_SIGNALS_FAIL\.(\\d+) ONU
Scott Baker27d04db2020-02-06 18:03:21 -0800320 Should Be Equal ${deviceEvent}[deviceEventName] ONU_SIGNALS_FAIL_CLEAR_EVENT
321 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
322
323Test RaiseStartupFailureAlarm
324 # Not Implemented
325 [Documentation] Raise Startup Failure Alarm and verify event received
326 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700327 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800328 ... ${onu_sn} ONU_STARTUP_FAILURE_RAISE_EVENT
329 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
330 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_RAISE_EVENT
331 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
332
333Test ClearStartupFailureAlarm
334 # Not Implemented
335 [Documentation] Clear Startup Failure Alarm and verify event received
336 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700337 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_STARTUP_FAILURE
Scott Baker27d04db2020-02-06 18:03:21 -0800338 ... ${onu_sn} ONU_STARTUP_FAILURE_CLEAR_EVENT
339 Verify Header ${header} Voltha.openolt.ONU_STARTUP_FAILURE\.(\\d+) ONU
340 Should Be Equal ${deviceEvent}[deviceEventName] ONU_STARTUP_FAILURE_CLEAR_EVENT
341 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
342
343Test RaiseTransmissionInterferenceAlarm
344 # Not Implemented
345 [Documentation] Raise Transmission Interference Alarm and verify event received
346 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700347 ${header} ${deviceEvent} Raise Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800348 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
349 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
350 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_RAISE_EVENT
351 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
352
353Test ClearTransmissionInterferenceAlarm
354 # Not Implemented
355 [Documentation] Clear Transmission Interference Alarm and verify event received
356 [Tags] not-active
Scott Bakere7840002020-03-23 16:50:27 -0700357 ${header} ${deviceEvent} Clear Onu Alarm And Get Event ONU_TRANSMISSION_INTERFERENCE_WARNING
Scott Baker27d04db2020-02-06 18:03:21 -0800358 ... ${onu_sn} ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
359 Verify Header ${header} Voltha.openolt.ONU_TRANSMISSION_INTERFERENCE\.(\\d+) ONU
360 Should Be Equal ${deviceEvent}[deviceEventName] ONU_TRANSMISSION_INTERFERENCE_CLEAR_EVENT
Scott Baker60e570d2020-02-02 22:10:13 -0800361 Should Be Equal ${deviceEvent}[resourceId] ${parent_id}
362
363*** Keywords ***
364Setup Suite
365 [Documentation] Set up the test suite
366 Common Test Suite Setup
367 # Ensure the voltctl pod is deployed and running
368 Apply Kubernetes Resources ./voltctl.yaml ${VOLTCTL_NAMESPACE}
369 Wait Until Keyword Succeeds ${timeout} 5s
370 ... Validate Pod Status ${VOLTCTL_POD_NAME} ${VOLTCTL_NAMESPACE} Running
371 # Call Setup keyword in utils library to create and enable device
372 Run Keyword If ${setup_device} Setup
373
374Teardown Suite
375 [Documentation] Clean up devices if desired
376 ... kills processes and cleans up interfaces on src+dst servers
ubuntu6b6e7d42020-03-02 12:35:42 -0800377 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Scott Baker60e570d2020-02-02 22:10:13 -0800378 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800379 Run Keyword If ${teardown_device} Delete All Devices and Verify
Scott Baker60e570d2020-02-02 22:10:13 -0800380 Run Keyword If ${teardown_device} Test Empty Device List
TorstenThieme4e2168e2021-06-22 14:01:47 +0000381 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 -0800382 ... device-remove ${of_id}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000383 Close All ONOS SSH Connections
Hardik Windlass8a189712022-05-11 09:55:54 +0530384 Run Keyword If ${has_dataplane} Clean Up All Nodes
Scott Baker60e570d2020-02-02 22:10:13 -0800385
Scott Bakeree03dd02020-03-12 11:48:06 -0700386# Onu Alarms
387
388Raise Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800389 [Documentation] Raise an Alarm and return event
390 [Arguments] ${name} ${sn} ${deviceEventName}
391 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700392 Raise Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800393 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800394 ${LastEventPostTimestamp} Set Variable ${since}
395 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800396 [return] ${header} ${deviceEvent}
397
Scott Bakeree03dd02020-03-12 11:48:06 -0700398Clear Onu Alarm And Get Event
Scott Baker27d04db2020-02-06 18:03:21 -0800399 [Documentation] Clear an Alarm and return event
400 [Arguments] ${name} ${sn} ${deviceEventName}
401 ${since} Get Current Time
Scott Bakeree03dd02020-03-12 11:48:06 -0700402 Clear Onu Alarm ${name} ${sn}
Scott Baker27d04db2020-02-06 18:03:21 -0800403 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
Scott Bakeree675552020-02-11 10:43:34 -0800404 ${LastEventPostTimestamp} Set Variable ${since}
405 Set Suite Variable ${LastEventPostTimestamp}
Scott Baker27d04db2020-02-06 18:03:21 -0800406 [return] ${header} ${deviceEvent}
407
Scott Bakeree03dd02020-03-12 11:48:06 -0700408Raise Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800409 [Documentation] Raise an Alarm
410 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700411 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
412 ... bbsimctl onu alarms raise ${name} ${sn}
Scott Baker60e570d2020-02-02 22:10:13 -0800413 Should Contain ${raiseOutput} Alarm Indication Sent
414
Scott Bakeree03dd02020-03-12 11:48:06 -0700415Clear Onu Alarm
Scott Baker60e570d2020-02-02 22:10:13 -0800416 [Documentation] Raise an Alarm
417 [Arguments] ${name} ${sn}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700418 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
419 ... bbsimctl onu alarms clear ${name} ${sn}
Scott Bakeree03dd02020-03-12 11:48:06 -0700420 Should Contain ${raiseOutput} Alarm Indication Sent
421
422# Olt Alarms
423
424Raise Olt Alarm And Get Event
425 [Documentation] Raise an Alarm and return event
426 [Arguments] ${name} ${intf_id} ${deviceEventName}
427 ${since} Get Current Time
428 Raise Olt Alarm ${name} ${intf_id}
429 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
430 ${LastEventPostTimestamp} Set Variable ${since}
431 Set Suite Variable ${LastEventPostTimestamp}
432 [return] ${header} ${deviceEvent}
433
434Clear Olt Alarm And Get Event
435 [Documentation] Clear an Alarm and return event
436 [Arguments] ${name} ${intf_id} ${deviceEventName}
437 ${since} Get Current Time
438 Clear Olt Alarm ${name} ${intf_id}
439 ${header} ${deviceEvent} Get Device Event ${deviceEventName} ${since}
440 ${LastEventPostTimestamp} Set Variable ${since}
441 Set Suite Variable ${LastEventPostTimestamp}
442 [return] ${header} ${deviceEvent}
443
444Raise Olt Alarm
445 [Documentation] Raise an Alarm
446 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700447 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
448 ... bbsimctl olt alarms raise ${name} ${intf_id}
Scott Bakeree03dd02020-03-12 11:48:06 -0700449 Should Contain ${raiseOutput} Alarm Indication Sent
450
451Clear Olt Alarm
452 [Documentation] Raise an Alarm
453 [Arguments] ${name} ${intf_id}
Andy Bavierb63f6d22020-03-12 15:34:37 -0700454 ${raiseOutput} Exec Pod ${BBSIMCTL_NAMESPACE} ${BBSIMCTL_POD_NAME}
455 ... bbsimctl olt alarms clear ${name} ${intf_id}
Scott Baker60e570d2020-02-02 22:10:13 -0800456 Should Contain ${raiseOutput} Alarm Indication Sent
457
458Get Device Event
459 [Documentation] Get the most recent alarm event from voltha.events
460 [Arguments] ${deviceEventName} ${since}
461 ${output} ${raiseErr} Exec Pod Separate Stderr ${VOLTCTL_NAMESPACE} ${VOLTCTL_POD_NAME}
Girish Gowdra698a04b2020-11-23 10:24:43 -0800462 ... voltctl event listen --show-body -t 1 -o json -f Titles=${deviceEventName}
Scott Baker60e570d2020-02-02 22:10:13 -0800463 ${json} To Json ${output}
464 ${count} Get Length ${json}
465 # If there is more than one event (which could happen if we quickly do a raise and a clear),
466 # then return the most recent one.
467 Should Be Larger Than ${count} 0
468 ${lastIndex} Evaluate ${count}-1
469 ${lastItem} Set Variable ${json}[${lastIndex}]
470 ${header} Set Variable ${lastItem}[header]
471 ${deviceEvent} Set Variable ${lastItem}[deviceEvent]
472 Log ${header}
473 Log ${deviceEvent}
474 [return] ${header} ${deviceEvent}
475
476Verify Header
477 [Documentation] Verify that a DeviceEvent's header is sane and the id matches regex
Scott Baker27d04db2020-02-06 18:03:21 -0800478 [Arguments] ${header} ${id} ${subCategory}
479 ${headerSubCategory} Evaluate $header.get("subCategory", "")
480 Should Be Equal ${headerSubCategory} ${subCategory}
Scott Baker60e570d2020-02-02 22:10:13 -0800481 Should Be Equal ${header}[type] DEVICE_EVENT
482 Should Match Regexp ${header}[id] ${id}
Scott Bakeree675552020-02-11 10:43:34 -0800483 # TODO Timestamps are now RFC3339 date strings. Add Verification
484 ${reportedTs} Set Variable ${header}[reportedTs]
485 ${raisedTs} Set Variable ${header}[raisedTs]
486 Should Be Newer Than Or Equal To ${reportedTs} ${LastEventPostTimestamp}
487 Should Be Newer Than Or Equal To ${raisedTs} ${LastEventPostTimestamp}