blob: 1cf19cf3eeae643b6d24ff341807d63ca8a33116 [file] [log] [blame]
TorstenThieme440b7c02020-12-18 15:42:57 +00001# Copyright 2020 - 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 ***
TorstenThiemec3c23232021-01-13 13:06:31 +000016Documentation Test different Reconcile scenarios of ONU Go adapter with all three workflows ATT, DT and TT.
TorstenThieme440b7c02020-12-18 15:42:57 +000017... Test suite is dedicated for only one ONU! Run robot with bbsim-kind.yaml only!
18... Not for DT/TT workflow!
19... Hint: default timeout in BBSim to mimic OLT reboot is 60 seconds!
20... This behaviour of BBSim can be modified by 'oltRebootDelay: 60' in BBSim section of helm chart or
21... used values.yaml during 'voltha up'.
22Suite Setup Setup Suite
23Suite Teardown Teardown Suite
24Test Setup Setup
25Test Teardown Teardown
26Library Collections
27Library String
28Library OperatingSystem
29Library XML
30Library RequestsLibrary
31Library ../../libraries/DependencyLibrary.py
32Resource ../../libraries/onos.robot
33Resource ../../libraries/voltctl.robot
34Resource ../../libraries/voltha.robot
35Resource ../../libraries/utils.robot
36Resource ../../libraries/k8s.robot
37Resource ../../libraries/onu_utilities.robot
38Resource ../../variables/variables.robot
39
40*** Variables ***
Hardik Windlass4288c6a2021-09-28 07:22:06 +000041${NAMESPACE} voltha
42${INFRA_NAMESPACE} default
TorstenThieme440b7c02020-12-18 15:42:57 +000043${timeout} 60s
44${of_id} 0
45${logical_id} 0
46${has_dataplane} True
47${external_libs} True
48${teardown_device} True
49${scripts} ../../scripts
50# Per-test logging on failure is turned off by default; set this variable to enable
51${container_log_dir} ${None}
52# flag for first test, needed due default timeout in BBSim to mimic OLT reboot of 60 seconds
53${firsttest} True
TorstenThiemec3c23232021-01-13 13:06:31 +000054# determines the environment workflow: DT, TT or ATT (default)
55# example: -v workflow:DT
56${workflow} ATT
TorstenThieme47983692021-06-17 10:43:35 +000057# KV Store Prefix
58# example: -v kvstoreprefix:voltha_voltha
59${kvstoreprefix} voltha_voltha
TorstenThieme440b7c02020-12-18 15:42:57 +000060# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
61# example: -v debugmode:True
62${debugmode} False
63# logging flag to enable Collect Logs, can be passed via the command line too
64# example: -v logging:True
65${logging} False
66# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
67# example: -v pausebeforecleanup:True
68${pausebeforecleanup} False
69# if True some outputs to console are done during running tests e.g. long duration flow test
70# example: -v print2console:True
71${print2console} False
72# if True (hard) kill will be used to restart onu adapter, else (soft) restart mechanism of k8s will be used
73# example: -v usekill2restart:True
74${usekill2restart} False
TorstenThieme45071602021-03-16 12:14:37 +000075# if True etcd check will be executed in test case teardown, if False etcd check will be executed in suite teardown
76# example: -v etcdcheckintestteardown:False
77${etcdcheckintestteardown} True
TorstenThieme440b7c02020-12-18 15:42:57 +000078${data_dir} ../data
TorstenThieme70bc5262021-01-19 12:12:55 +000079${suppressaddsubscriber} True
TorstenThieme440b7c02020-12-18 15:42:57 +000080
Hardik Windlassb1bda362021-11-24 11:54:36 +000081# flag to choose the subscriber provisioning command type in ONOS
82# TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other.
83# if set to True, command used is "volt-add-subscriber-unitag"
84# if set to False, comand used is "volt-add-subscriber-access"
85${unitag_sub} False
TorstenThieme440b7c02020-12-18 15:42:57 +000086
87*** Test Cases ***
88Reconcile In Starting-OpenOmci
89 [Documentation] Validates the Reconcile in Starting-OpenOmci
90 ... Reconcile test during starting-openomci in AT&T-workflow:
91 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +000092 ... - wait for device reason starting-openomci
TorstenThieme440b7c02020-12-18 15:42:57 +000093 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +000094 ... - wait for open-onu-adapter-go to restart
95 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +000096 ... - delete ONU and MIB-template in KV-store
97 [Tags] functionalOnuGo ReconcileStartingOpenOmciOnuGo
98 [Setup] Run Keywords Start Logging ReconcileStartingOpenOmciOnuGo
99 ... AND Setup Test
100 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemee9017be2021-03-05 16:59:31 +0000101 Do Reconcile In Determined State starting-openomci
TorstenThieme3494ceb2021-07-19 09:47:24 +0000102 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
103 ... AND Run Keyword If ${logging} Collect Logs
TorstenThieme440b7c02020-12-18 15:42:57 +0000104 ... AND Teardown Test
105 ... AND Stop Logging ReconcileStartingOpenOmciOnuGo
106
107Reconcile In Initial-Mib-Downloaded
108 [Documentation] Validates the Reconcile in initial-mib-downloaded
109 ... Reconcile test during initial-mib-downloaded in AT&T-workflow:
110 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000111 ... - wait for device reason initial-mib-downloaded
TorstenThieme440b7c02020-12-18 15:42:57 +0000112 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000113 ... - wait for open-onu-adapter-go to restart
114 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000115 ... - delete ONU and MIB-template in KV-store
116 [Tags] functionalOnuGo ReconcileInitialMibDownloadedOnuGo
117 [Setup] Run Keywords Start Logging ReconcileInitialMibDownloadedOnuGo
118 ... AND Setup Test
119 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemee9017be2021-03-05 16:59:31 +0000120 Do Reconcile In Determined State initial-mib-downloaded
TorstenThieme3494ceb2021-07-19 09:47:24 +0000121 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
122 ... AND Run Keyword If ${logging} Collect Logs
TorstenThieme440b7c02020-12-18 15:42:57 +0000123 ... AND Teardown Test
124 ... AND Stop Logging ReconcileInitialMibDownloadedOnuGo
125
126Reconcile In Omci-Flows-Pushed
127 [Documentation] Validates the Reconcile in omci-flows-pushed
128 ... Former testcase: Reconcile Onu Device in Testsuite Voltha_ONUStateTest.robot
129 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
130 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000131 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000132 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000133 ... - wait for open-onu-adapter-go to restart
134 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000135 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000136 ... - wait for device corresponding onu reason e.g. tech-profile-config-delete-success
137 ... - check UNI-ports disabled in ONOS
TorstenThieme440b7c02020-12-18 15:42:57 +0000138 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000139 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000140 ... - delete ONU and MIB-template in KV-store
141 [Tags] functionalOnuGo ReconcileOmciFlowsPushedOnuGo
142 [Setup] Run Keywords Start Logging ReconcileOmciFlowsPushedOnuGo
143 ... AND Setup Test
144 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemee9017be2021-03-05 16:59:31 +0000145 Do Reconcile In Omci-Flows-Pushed
TorstenThieme3494ceb2021-07-19 09:47:24 +0000146 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
147 ... AND Run Keyword If ${logging} Collect Logs
TorstenThieme440b7c02020-12-18 15:42:57 +0000148 ... AND Teardown Test
149 ... AND Stop Logging ReconcileOmciFlowsPushedOnuGo
150
151Reconcile For Disabled Onu Device
152 [Documentation] Validates the Reconcile for disabled Onu device
153 ... Reconcile test for disabled Onu device in AT&T-workflow:
154 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000155 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000156 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000157 ... - wait for device corresponding onu reason e.g. tech-profile-config-delete-success
158 ... - check UNI-ports disabled in ONOS
159 ... - kill the open-onu-adapter-go
160 ... - wait for open-onu-adapter-go to restart
161 ... - check device reason is still the same before restart
TorstenThieme440b7c02020-12-18 15:42:57 +0000162 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000163 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000164 ... - delete ONU and MIB-template in KV-store
165 [Tags] functionalOnuGo ReconcileDisabledOnuDeviceOnuGo
166 [Setup] Run Keywords Start Logging ReconcileDisabledOnuDeviceOnuGo
167 ... AND Setup Test
168 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemee9017be2021-03-05 16:59:31 +0000169 Do Reconcile For Disabled Onu Device
TorstenThieme3494ceb2021-07-19 09:47:24 +0000170 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
171 ... AND Run Keyword If ${logging} Collect Logs
TorstenThieme440b7c02020-12-18 15:42:57 +0000172 ... AND Teardown Test
173 ... AND Stop Logging ReconcileDisabledOnuDeviceOnuGo
174
TorstenThieme712b2962021-11-17 14:16:15 +0000175Olt Deletion After Adapter Restart
176 [Documentation] Validates the OLT deletion after adapter restart
177 ... - prefered environment is two ONUs are active on each of two OLTs, but test works also with single ONU/OLT
178 ... - restart the ONU adapter preferred via "kubectl delete pod"
179 ... - delete one OLT immediately after the restart has been initiated
180 ... - wait until the restart of the ONU adapter and the reconcile processing are finished
181 ... - check whether the ONUs on the remaining OLT have been properly reconciled (if avaialable)
182 ... - check whether the ONUs at the deleted OLT have disappeared from the device list
183 ... - KV store data of these ONUs are deleted under:
184 ... - <kvStorePrefix>/openonu/<deviceId>
185 ... - <kvStorePrefix>/openonu/pm-data/<deviceId>
186 ... - check for not deleted device(s) reason is still the same before restart (if available)
187 ... - delete ONU and MIB-template in KV-store
188 ... Check [VOL-4443] for more details
189 [Tags] functionalOnuGo OltDeletionAfterAdapterRestartOnuGo
190 [Setup] Run Keywords Start Logging OltDeletionAfterAdapterRestartOnuGo
191 ... AND Setup Test
192 Run Keyword If ${has_dataplane} Clean Up Linux
193 Do Olt Deletion After Adapter Restart
194 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
195 ... AND Run Keyword If ${logging} Collect Logs
196 ... AND Teardown Test
197 ... AND Stop Logging OltDeletionAfterAdapterRestartOnuGo
198
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000199Flow Deletion After Adapter Restart
200 [Documentation] Validates the flow(s) deletion after adapter restart
201 ... - perform sanity test include add subscriber
202 ... - restart the ONU adapter preferred via "kubectl delete pod"
203 ... - remove flow(s) from one ONU immediately after the restart has been initiated
204 ... - wait until the restart of the ONU adapter and the reconcile processing are finished
205 ... - check removed flow(s) from ONU
206 ... - check for not removed flows still the same before restart (if available)
207 [Tags] functionalOnuGo FlowDeletionAfterAdapterRestartOnuGo
208 [Setup] Run Keywords Start Logging FlowDeletionAfterAdapterRestartOnuGo
209 ... AND Setup Test
210 Run Keyword If ${has_dataplane} Clean Up Linux
211 Do Flow Deletion After Adapter Restart
212 [Teardown] Run Keywords Run Keyword If ${logging} Get Logical Id of OLT
213 ... AND Run Keyword If ${logging} Collect Logs
214 ... AND Teardown Test
215 ... AND Stop Logging FlowDeletionAfterAdapterRestartOnuGo
216
TorstenThieme440b7c02020-12-18 15:42:57 +0000217*** Keywords ***
218Setup Suite
219 [Documentation] Set up the test suite
Andrea Campanella82add372021-11-05 12:01:15 +0100220 Start Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme440b7c02020-12-18 15:42:57 +0000221 ${LogInfo}= Catenate
222 ... \r\nPassed arguments:
223 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme47983692021-06-17 10:43:35 +0000224 ... print2console:${print2console}, usekill2restart:${usekill2restart}, workflow:${workflow},
225 ... kvstoreprefix:${kvstoreprefix}
TorstenThieme440b7c02020-12-18 15:42:57 +0000226 Log ${LogInfo} console=yes
227 Common Test Suite Setup
TorstenThieme440b7c02020-12-18 15:42:57 +0000228 # delete etcd MIB Template Data
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000229 Delete MIB Template Data ${INFRA_NAMESPACE}
TorstenThieme45071602021-03-16 12:14:37 +0000230 # delete etcd onu data
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000231 Delete ONU Go Adapter ETCD Data namespace=${INFRA_NAMESPACE} validate=True
Andrea Campanella82add372021-11-05 12:01:15 +0100232 Run Keyword If ${logging} Collect Logs
233 Stop Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme440b7c02020-12-18 15:42:57 +0000234
TorstenThieme70bc5262021-01-19 12:12:55 +0000235
TorstenThieme440b7c02020-12-18 15:42:57 +0000236Teardown Suite
237 [Documentation] Replaces the Suite Teardown in utils.robot.
238 ... Cleans up and checks all ONU ports disabled in ONOS.
239 ... Furthermore gives the possibility to pause the execution.
Andrea Campanella82add372021-11-05 12:01:15 +0100240 Start Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThieme440b7c02020-12-18 15:42:57 +0000241 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
242 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
243 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
244 Run Keyword If ${teardown_device} Delete All Devices and Verify
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000245 Run Keyword If ${usekill2restart} Restart Pod By Label ${NAMESPACE} app adapter-open-onu
TorstenThieme45071602021-03-16 12:14:37 +0000246 Run Keyword Unless ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000247 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
TorstenThieme731a7592021-07-01 14:26:54 +0000248 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout}
Andrea Campanella82add372021-11-05 12:01:15 +0100249 Run Keyword If ${logging} Collect Logs
250 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThieme440b7c02020-12-18 15:42:57 +0000251 Close All ONOS SSH Connections
252
253Setup Test
254 [Documentation] Pre-test Setup
255 #test for empty device list
256 Test Empty Device List
257 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
258 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
259 Run Keyword If ${has_dataplane} Sleep 60s
260 #restart open-onu pod to reset crash loop back off mechansim of kubenetes
TorstenThieme37165402021-09-03 11:39:40 +0000261 Run Keyword If "${firsttest}"=="False" and "${usekill2restart}"=="True"
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000262 ... Restart Pod By Label ${NAMESPACE} app adapter-open-onu
TorstenThieme440b7c02020-12-18 15:42:57 +0000263 Run Keyword If "${firsttest}"=="False" Sleep 35s
264 ${firsttest} Set Variable False
265 Set Suite Variable ${firsttest}
266 # Create a list of olt ids (logical and device_id)
267 ${olt_ids} Create List
268 FOR ${I} IN RANGE 0 ${num_olts}
269 #create/preprovision device
Andrea Campanella3dcce272021-01-15 16:04:47 +0100270 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
TorstenThieme44136642021-02-12 13:41:17 +0000271 ... Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport]
272 ... ELSE Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport] ${list_olts}[${I}][type]
TorstenThieme440b7c02020-12-18 15:42:57 +0000273 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
274 #validate olt states
275 Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass8b446492021-06-10 06:25:23 +0000276 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id} by_dev_id=True
TorstenThieme440b7c02020-12-18 15:42:57 +0000277 Sleep 5s
278 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
279 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
280 ... of_id ${of_id} sn ${olt_serial_number}
281 Append To List ${olt_ids} ${olt}
282 END
283 Set Global Variable ${olt_ids}
284
285Teardown Test
286 [Documentation] Post-test Teardown
TorstenThieme45071602021-03-16 12:14:37 +0000287 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
288 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
289 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemee9017be2021-03-05 16:59:31 +0000290 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThieme440b7c02020-12-18 15:42:57 +0000291 # delete etcd MIB Template Data
Matteo Scandolo6b524122021-10-22 14:34:29 -0700292 Delete MIB Template Data ${INFRA_NAMESPACE}
TorstenThiemeb355eb62021-03-09 14:04:55 +0000293 # check etcd data are empty
TorstenThieme45071602021-03-16 12:14:37 +0000294 Run Keyword If ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000295 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
TorstenThieme440b7c02020-12-18 15:42:57 +0000296 Sleep 5s
297
298Do Reconcile In Determined State
299 [Documentation] This keyword reconciles ONU device when passed reason is reached and
300 ... check the state afterwards.
301 ... Following steps will be executed:
302 ... - enable OLT device
303 ... - wait for passed openonu reason
304 ... - restart openonu adaptor
TorstenThiemec3c23232021-01-13 13:06:31 +0000305 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000306 [Arguments] ${expected_onu_reason}
TorstenThiemec3c23232021-01-13 13:06:31 +0000307 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State
308 ... ${expected_onu_reason}
309 Should Be True ${onu_state_nb}<=5
310 ... Wrong expected onu reason ${expected_onu_reason}, must be lower than 'omci-flows-pushed'!
TorstenThieme440b7c02020-12-18 15:42:57 +0000311 FOR ${I} IN RANGE 0 ${num_olts}
312 #get olt serial number
313 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
314 #validate olt states
315 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
316 Enable Device ${olt_device_id}
317 END
318 Current State Test All Onus ${expected_onu_reason}
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000319 Reconcile Onu Adapter ${NAMESPACE} ${usekill2restart} ACTIVE
TorstenThiemec3c23232021-01-13 13:06:31 +0000320 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
TorstenThieme136ebf72021-02-26 14:27:07 +0000321 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
TorstenThiemec3c23232021-01-13 13:06:31 +0000322 ... ELSE Perform Sanity Test
TorstenThieme440b7c02020-12-18 15:42:57 +0000323
324Do Reconcile For Disabled Onu Device
325 [Documentation] This keyword reconciles ONU device for a disabled onu device and
326 ... check the state afterwards.
327 ... Following steps will be executed:
328 ... - enable OLT device
TorstenThiemec3c23232021-01-13 13:06:31 +0000329 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000330 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000331 ... - wait for corresponding openonu reason
TorstenThieme440b7c02020-12-18 15:42:57 +0000332 ... - check UNI-ports disabled in ONOS
333 ... - restart openonu adaptor
334 ... - check openonu adaptor is ready again
TorstenThiemec3c23232021-01-13 13:06:31 +0000335 ... - check device reason is still before restart
TorstenThieme440b7c02020-12-18 15:42:57 +0000336 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000337 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000338 FOR ${I} IN RANGE 0 ${num_olts}
339 #get olt serial number
340 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
341 #validate olt states
342 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
343 Enable Device ${olt_device_id}
344 END
TorstenThiemec3c23232021-01-13 13:06:31 +0000345 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
TorstenThieme136ebf72021-02-26 14:27:07 +0000346 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
TorstenThiemec3c23232021-01-13 13:06:31 +0000347 ... ELSE Perform Sanity Test
TorstenThieme440b7c02020-12-18 15:42:57 +0000348 Disable Onu Device
TorstenThieme0ec95eb2021-11-23 14:56:26 +0000349 Current State Test All Onus tech-profile-config-delete-success
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000350 Reconcile Onu Adapter ${NAMESPACE} ${usekill2restart} UNKNOWN
TorstenThieme0ec95eb2021-11-23 14:56:26 +0000351 Current State Test All Onus tech-profile-config-delete-success
TorstenThieme731a7592021-07-01 14:26:54 +0000352 Wait for all ONU Ports in ONOS Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
TorstenThieme440b7c02020-12-18 15:42:57 +0000353 Enable Onu Device
TorstenThieme70bc5262021-01-19 12:12:55 +0000354 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
TorstenThieme136ebf72021-02-26 14:27:07 +0000355 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
TorstenThieme70bc5262021-01-19 12:12:55 +0000356 ... ELSE Perform Sanity Test ${suppressaddsubscriber}
TorstenThieme440b7c02020-12-18 15:42:57 +0000357
358Do Reconcile In Omci-Flows-Pushed
359 [Documentation] This keyword reconciles ONU device in omci-flows-pushed and check the state afterwards.
360 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
361 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000362 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000363 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000364 ... - wait for open-onu-adapter-go to restart
365 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000366 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000367 ... - wait for corresponding device reason
368 ... - check UNI-ports disabled in ONOS
TorstenThieme440b7c02020-12-18 15:42:57 +0000369 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000370 ... - perform sanity test supress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000371 FOR ${I} IN RANGE 0 ${num_olts}
372 #get olt serial number
373 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
374 #validate olt states
375 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
376 Enable Device ${olt_device_id}
377 END
TorstenThiemec3c23232021-01-13 13:06:31 +0000378 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
TorstenThieme136ebf72021-02-26 14:27:07 +0000379 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
TorstenThiemec3c23232021-01-13 13:06:31 +0000380 ... ELSE Perform Sanity Test
TorstenThieme96fe9ee2021-10-21 10:24:08 +0000381 Reconcile Onu Adapter ${NAMESPACE} ${usekill2restart} ACTIVE
TorstenThieme70bc5262021-01-19 12:12:55 +0000382 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
TorstenThieme136ebf72021-02-26 14:27:07 +0000383 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
TorstenThieme70bc5262021-01-19 12:12:55 +0000384 ... ELSE Perform Sanity Test ${suppressaddsubscriber}
TorstenThieme440b7c02020-12-18 15:42:57 +0000385 Disable Onu Device
TorstenThieme0ec95eb2021-11-23 14:56:26 +0000386 Current State Test All Onus tech-profile-config-delete-success
TorstenThieme731a7592021-07-01 14:26:54 +0000387 Wait for all ONU Ports in ONOS Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
TorstenThieme440b7c02020-12-18 15:42:57 +0000388 Enable Onu Device
TorstenThieme70bc5262021-01-19 12:12:55 +0000389 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
TorstenThieme136ebf72021-02-26 14:27:07 +0000390 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
TorstenThieme70bc5262021-01-19 12:12:55 +0000391 ... ELSE Perform Sanity Test ${suppressaddsubscriber}
TorstenThieme712b2962021-11-17 14:16:15 +0000392
393
394Do Olt Deletion After Adapter Restart
395 [Documentation] This keyword deletes OLT after adapter restart and checks deleted device(s) and data
396 ... - prefered environment is two ONUs are active on each of two OLTs, but test works also with single ONU/OLT
397 ... - restart the ONU adapter preferred via "kubectl delete pod"
398 ... - delete one OLT immediately after the restart has been initiated
399 ... - wait until the restart of the ONU adapter and the reconcile processing are finished
400 ... - check whether the ONUs on the remaining OLT have been properly reconciled (if avaialable)
401 ... - check whether the ONUs at the deleted OLT have disappeared from the device list
402 ... - KV store data of these ONUs are deleted under:
403 ... - <kvStorePrefix>/openonu/<deviceId>
404 ... - <kvStorePrefix>/openonu/pm-data/<deviceId>
405 ... - check for not deleted device(s) reason is still the same before restart (if available)
406 ... - delete ONU and MIB-template in KV-store
407 ... Check [VOL-4443] for more details
408 FOR ${I} IN RANGE 0 ${num_olts}
409 #get olt serial number
410 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
411 #validate olt states
412 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
413 Enable Device ${olt_device_id}
414 END
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000415 # bring all onus to active -> OMCI-Flows-Pushed
TorstenThieme712b2962021-11-17 14:16:15 +0000416 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
417 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
418 ... ELSE Perform Sanity Test
419 # OLT#1 will be deleted, get its SN
420 ${olt_to_be_deleted}= Set Variable ${olts[0]['serial']}
421 ${olt_to_be_deleted_device_id}= Get OLTDeviceID From OLT List ${olt_to_be_deleted}
422 # collect all ONU device ids belonging to OLT to be deleted
423 ${onu_device_id_list_should_be_deleted} Create List
424 Build ONU Device Id List ${onu_device_id_list_should_be_deleted} ${olt_to_be_deleted}
425 Log ${onu_device_id_list_should_be_deleted}
426 Reconcile Onu Adapter ${NAMESPACE} ${usekill2restart} ACTIVE ${olt_to_be_deleted}
427 # validate OLT and all corresponding ONUs are removed
428 Validate all ONUS for OLT Removed ${num_all_onus} ${hosts} ${olt_to_be_deleted} ${timeout}
429 Validate Device Removed ${olt_to_be_deleted}
430 # validate for alle removed ONUs KV store date deleted
431 FOR ${onu_device_id} IN @{onu_device_id_list_should_be_deleted}
432 Log ${onu_device_id}
433 Wait Until Keyword Succeeds ${timeout} 1s Validate Onu Data In Etcd Removed ${INFRA_NAMESPACE}
434 ... ${onu_device_id} ${kvstoreprefix} without_pm_data=False
435 END
436 FOR ${I} IN RANGE 0 ${num_all_onus}
437 ${src}= Set Variable ${hosts.src[${I}]}
438 Continue For Loop If "${olt_to_be_deleted}"=="${src['olt']}"
439 Current State Test omci-flows-pushed ${src['onu']}
440 END
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000441
442Do Flow Deletion After Adapter Restart
443 [Documentation] This keyword removes flow(s) after adapter restart and checks removed flow(s)
444 ... - perform sanity test include add subscriber
445 ... - restart the ONU adapter preferred via "kubectl delete pod"
446 ... - remove flow(s) from one ONU immediately after the restart has been initiated
447 ... - wait until the restart of the ONU adapter and the reconcile processing are finished
448 ... - check removed flow(s) from ONU
449 ... - check for not removed flows still the same before restart (if available)
450 FOR ${I} IN RANGE 0 ${num_olts}
451 #get olt serial number
452 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
453 #validate olt states
454 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
455 Enable Device ${olt_device_id}
456 END
457 # bring all onus to active -> OMCI-Flows-Pushed
458 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
459 ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
460 ... ELSE Perform Sanity Test
461 # log ONOS flows before remove
462 ${flow}= Execute ONOS CLI Command use single connection
463 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
464 Log ${flow}
465 # validate OLT flows before remove
466 ${onu_device_id_list} Create List
467 Build ONU Device Id List ${onu_device_id_list}
468 Log ${onu_device_id_list}
469 FOR ${onu_device_id} IN @{onu_device_id_list}
470 Log ${onu_device_id}
471 ${rc} ${output}= Run and Return Rc and Output
472 ... voltctl -c ${VOLTCTL_CONFIG} device flows ${onu_device_id} -m 8MB -o json
473 Should Be Equal As Integers ${rc} 0
474 ${jsondata}= To Json ${output}
475 Log ${jsondata}
476 END
477 # Collect data for remove flow(s)
478 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${hosts.src[0]['olt']}
479 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${hosts.src[0]['onu']}
480 ... ${of_id} ${hosts.src[0]['uni_id']}
481 ${params_for_remove_flow}= Create Dictionary of_id=${of_id} onu_port=${onu_port}
482 # Collect number of flows for comparing after Reconcile
483 ${olt_flows_list} Create List
484 FOR ${I} IN RANGE 0 ${num_olts}
485 ${olt_of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${list_olts}[${I}][sn]
486 ${flows}= Count flows ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_of_id} added
487 ${olt_flows}= Create Dictionary olt=${olt_of_id} flows=${flows}
488 Append To List ${olt_flows_list} ${olt_flows}
489 END
490 ${flows_onu}= Count flows ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} added ${onu_port}
491 # Restart onu adapter with deleting flows from first onu
492 Reconcile Onu Adapter ${NAMESPACE} ${usekill2restart} ACTIVE flow_delete_params=${params_for_remove_flow}
493 # validate flows in ONOS after remove
494 ${flow}= Execute ONOS CLI Command use single connection
495 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
496 Log ${flow}
497 ${expected_flows_onu}= Set Variable If "${workflow}"=="ATT" 1 0
498 Wait Until Keyword Succeeds ${timeout} 2s Validate number of flows ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
499 ... ${expected_flows_onu} ${of_id} any ${onu_port}
TorstenThiemed6492882021-12-16 08:10:02 +0000500 ${flow}= Execute ONOS CLI Command use single connection
501 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
502 Log ${flow}
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000503 # Beside onu port specific flows additional flows deleted depending on workflow
504 ${additional_flows_deleted}= Set Variable If
505 ... "${workflow}"=="DT" 1
506 ... "${workflow}"=="TT" 3
507 ... "${workflow}"=="ATT" 0
508 FOR ${I} IN RANGE 0 ${num_olts}
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000509 ${expected_flows}= Run Keyword If "${of_id}"=="${olt_flows_list}[${I}][olt]"
510 ... Evaluate ${olt_flows_list}[${I}][flows]-${flows_onu}-${additional_flows_deleted}
511 ... ELSE Set Variable ${olt_flows_list}[${I}][flows]
TorstenThiemed6492882021-12-16 08:10:02 +0000512 Wait Until Keyword Succeeds ${timeout} 2s Validate ONOS Flows per OLT ${list_olts}[${I}][sn]
513 ... ${expected_flows}
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000514 END
TorstenThiemed6492882021-12-16 08:10:02 +0000515 ${flow}= Execute ONOS CLI Command use single connection
516 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
517 Log ${flow}
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000518 # validate etcd data
519 ${List_ONU_Serial} Create List
520 Build ONU SN List ${List_ONU_Serial}
521 ${onu_sn_no_flows}= Set Variable ${hosts.src[0]['onu']}
522 FOR ${onu_sn} IN @{List_ONU_Serial}
523 ${must_exist}= Set Variable If "${onu_sn}"=="${onu_sn_no_flows}" False True
TorstenThiemed6492882021-12-16 08:10:02 +0000524 Wait Until Keyword Succeeds ${timeout} 2s Validate Tech Profiles and Flows in ETCD Data Per Onu
525 ... ${onu_sn} ${INFRA_NAMESPACE} ${kvstoreprefix} ${must_exist}
TorstenThiemef7cd2be2021-12-06 14:30:11 +0000526 END
527 ${onu_device_id_no_flows}= Get Device ID From SN ${hosts.src[0]['onu']}
528 FOR ${onu_device_id} IN @{onu_device_id_list}
529 Log ${onu_device_id}
530 ${must_exist}= Set Variable If "${onu_device_id}"=="${onu_device_id_no_flows}" False True
531 Validate OLT Flows Per Onu ${onu_device_id} ${must_exist}
532 END