blob: 30ba3168c0101df991c267db2239e053343c7388 [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 ***
41${namespace} voltha
42${timeout} 60s
43${of_id} 0
44${logical_id} 0
45${has_dataplane} True
46${external_libs} True
47${teardown_device} True
48${scripts} ../../scripts
49# Per-test logging on failure is turned off by default; set this variable to enable
50${container_log_dir} ${None}
51# flag for first test, needed due default timeout in BBSim to mimic OLT reboot of 60 seconds
52${firsttest} True
TorstenThiemec3c23232021-01-13 13:06:31 +000053# determines the environment workflow: DT, TT or ATT (default)
54# example: -v workflow:DT
55${workflow} ATT
TorstenThieme440b7c02020-12-18 15:42:57 +000056# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
57# example: -v debugmode:True
58${debugmode} False
59# logging flag to enable Collect Logs, can be passed via the command line too
60# example: -v logging:True
61${logging} False
62# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
63# example: -v pausebeforecleanup:True
64${pausebeforecleanup} False
65# if True some outputs to console are done during running tests e.g. long duration flow test
66# example: -v print2console:True
67${print2console} False
68# if True (hard) kill will be used to restart onu adapter, else (soft) restart mechanism of k8s will be used
69# example: -v usekill2restart:True
70${usekill2restart} False
71${data_dir} ../data
72
73
74*** Test Cases ***
75Reconcile In Starting-OpenOmci
76 [Documentation] Validates the Reconcile in Starting-OpenOmci
77 ... Reconcile test during starting-openomci in AT&T-workflow:
78 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +000079 ... - wait for device reason starting-openomci
TorstenThieme440b7c02020-12-18 15:42:57 +000080 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +000081 ... - wait for open-onu-adapter-go to restart
82 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +000083 ... - delete ONU and MIB-template in KV-store
84 [Tags] functionalOnuGo ReconcileStartingOpenOmciOnuGo
85 [Setup] Run Keywords Start Logging ReconcileStartingOpenOmciOnuGo
86 ... AND Setup Test
87 Run Keyword If ${has_dataplane} Clean Up Linux
88 Run Keyword If '${num_all_onus}'=='1'
89 ... Do Reconcile In Determined State starting-openomci
90 ... ELSE Pass Execution ${skip_message} skipped
91 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
92 ... AND Teardown Test
93 ... AND Stop Logging ReconcileStartingOpenOmciOnuGo
94
95Reconcile In Initial-Mib-Downloaded
96 [Documentation] Validates the Reconcile in initial-mib-downloaded
97 ... Reconcile test during initial-mib-downloaded in AT&T-workflow:
98 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +000099 ... - wait for device reason initial-mib-downloaded
TorstenThieme440b7c02020-12-18 15:42:57 +0000100 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000101 ... - wait for open-onu-adapter-go to restart
102 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000103 ... - delete ONU and MIB-template in KV-store
104 [Tags] functionalOnuGo ReconcileInitialMibDownloadedOnuGo
105 [Setup] Run Keywords Start Logging ReconcileInitialMibDownloadedOnuGo
106 ... AND Setup Test
107 Run Keyword If ${has_dataplane} Clean Up Linux
108 Run Keyword If '${num_all_onus}'=='1'
109 ... Do Reconcile In Determined State initial-mib-downloaded
110 ... ELSE Pass Execution ${skip_message} skipped
111 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
112 ... AND Teardown Test
113 ... AND Stop Logging ReconcileInitialMibDownloadedOnuGo
114
115Reconcile In Omci-Flows-Pushed
116 [Documentation] Validates the Reconcile in omci-flows-pushed
117 ... Former testcase: Reconcile Onu Device in Testsuite Voltha_ONUStateTest.robot
118 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
119 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000120 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000121 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000122 ... - wait for open-onu-adapter-go to restart
123 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000124 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000125 ... - wait for device corresponding onu reason e.g. tech-profile-config-delete-success
126 ... - check UNI-ports disabled in ONOS
TorstenThieme440b7c02020-12-18 15:42:57 +0000127 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000128 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000129 ... - delete ONU and MIB-template in KV-store
130 [Tags] functionalOnuGo ReconcileOmciFlowsPushedOnuGo
131 [Setup] Run Keywords Start Logging ReconcileOmciFlowsPushedOnuGo
132 ... AND Setup Test
133 Run Keyword If ${has_dataplane} Clean Up Linux
134 Run Keyword If '${num_all_onus}'=='1'
135 ... Do Reconcile In Omci-Flows-Pushed
136 ... ELSE Pass Execution ${skip_message} skipped
137 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
138 ... AND Teardown Test
139 ... AND Stop Logging ReconcileOmciFlowsPushedOnuGo
140
141Reconcile For Disabled Onu Device
142 [Documentation] Validates the Reconcile for disabled Onu device
143 ... Reconcile test for disabled Onu device in AT&T-workflow:
144 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000145 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000146 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000147 ... - wait for device corresponding onu reason e.g. tech-profile-config-delete-success
148 ... - check UNI-ports disabled in ONOS
149 ... - kill the open-onu-adapter-go
150 ... - wait for open-onu-adapter-go to restart
151 ... - check device reason is still the same before restart
TorstenThieme440b7c02020-12-18 15:42:57 +0000152 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000153 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000154 ... - delete ONU and MIB-template in KV-store
155 [Tags] functionalOnuGo ReconcileDisabledOnuDeviceOnuGo
156 [Setup] Run Keywords Start Logging ReconcileDisabledOnuDeviceOnuGo
157 ... AND Setup Test
158 Run Keyword If ${has_dataplane} Clean Up Linux
159 Run Keyword If '${num_all_onus}'=='1'
160 ... Do Reconcile For Disabled Onu Device
161 ... ELSE Pass Execution ${skip_message} skipped
162 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
163 ... AND Teardown Test
164 ... AND Stop Logging ReconcileDisabledOnuDeviceOnuGo
165
166*** Keywords ***
167Setup Suite
168 [Documentation] Set up the test suite
169 ${LogInfo}= Catenate
170 ... \r\nPassed arguments:
171 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThiemec3c23232021-01-13 13:06:31 +0000172 ... print2console:${print2console}, usekill2restart:${usekill2restart}, workflow:${workflow}
TorstenThieme440b7c02020-12-18 15:42:57 +0000173 Log ${LogInfo} console=yes
174 Common Test Suite Setup
175 # prepare skip message in yellow for console log
176 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
177 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
178 ${skip_message} Catenate ${skipped} | ${skip} |
179 Set Suite Variable ${skip_message}
180 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
181 Set Suite Variable ${onos_ssh_connection}
182 # delete etcd MIB Template Data
183 Delete MIB Template Data
184
185Teardown Suite
186 [Documentation] Replaces the Suite Teardown in utils.robot.
187 ... Cleans up and checks all ONU ports disabled in ONOS.
188 ... Furthermore gives the possibility to pause the execution.
189 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
190 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
191 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
192 Run Keyword If ${teardown_device} Delete All Devices and Verify
193 Run Keyword If ${usekill2restart} Restart Pod ${namespace} open-onu
194 Validate Onu Data In Etcd 0
195 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout}
196 Close All ONOS SSH Connections
197
198Setup Test
199 [Documentation] Pre-test Setup
200 #test for empty device list
201 Test Empty Device List
202 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
203 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
204 Run Keyword If ${has_dataplane} Sleep 60s
205 #restart open-onu pod to reset crash loop back off mechansim of kubenetes
206 Run Keyword If "${firsttest}"=="False" and "${usekill2restart}"=="True" Restart Pod ${namespace} open-onu
207 Run Keyword If "${firsttest}"=="False" Sleep 35s
208 ${firsttest} Set Variable False
209 Set Suite Variable ${firsttest}
210 # Create a list of olt ids (logical and device_id)
211 ${olt_ids} Create List
212 FOR ${I} IN RANGE 0 ${num_olts}
213 #create/preprovision device
214 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
215 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
216 #validate olt states
217 Wait Until Keyword Succeeds ${timeout} 5s
218 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
219 Sleep 5s
220 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
221 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
222 ... of_id ${of_id} sn ${olt_serial_number}
223 Append To List ${olt_ids} ${olt}
224 END
225 Set Global Variable ${olt_ids}
226
227Teardown Test
228 [Documentation] Post-test Teardown
229 Run Keyword If ${teardown_device} Delete All Devices and Verify
230 # delete etcd MIB Template Data
231 Delete MIB Template Data
232 Sleep 5s
233
234Do Reconcile In Determined State
235 [Documentation] This keyword reconciles ONU device when passed reason is reached and
236 ... check the state afterwards.
237 ... Following steps will be executed:
238 ... - enable OLT device
239 ... - wait for passed openonu reason
240 ... - restart openonu adaptor
TorstenThiemec3c23232021-01-13 13:06:31 +0000241 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000242 [Arguments] ${expected_onu_reason}
TorstenThiemec3c23232021-01-13 13:06:31 +0000243 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State
244 ... ${expected_onu_reason}
245 Should Be True ${onu_state_nb}<=5
246 ... Wrong expected onu reason ${expected_onu_reason}, must be lower than 'omci-flows-pushed'!
TorstenThieme440b7c02020-12-18 15:42:57 +0000247 FOR ${I} IN RANGE 0 ${num_olts}
248 #get olt serial number
249 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
250 #validate olt states
251 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
252 Enable Device ${olt_device_id}
253 END
254 Current State Test All Onus ${expected_onu_reason}
255 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
256 ... ELSE Restart And Check Onu Adaptor ${namespace}
TorstenThiemec3c23232021-01-13 13:06:31 +0000257 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
258 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
259 ... ELSE Perform Sanity Test
TorstenThieme440b7c02020-12-18 15:42:57 +0000260
261Do Reconcile For Disabled Onu Device
262 [Documentation] This keyword reconciles ONU device for a disabled onu device and
263 ... check the state afterwards.
264 ... Following steps will be executed:
265 ... - enable OLT device
TorstenThiemec3c23232021-01-13 13:06:31 +0000266 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000267 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000268 ... - wait for corresponding openonu reason
TorstenThieme440b7c02020-12-18 15:42:57 +0000269 ... - check UNI-ports disabled in ONOS
270 ... - restart openonu adaptor
271 ... - check openonu adaptor is ready again
TorstenThiemec3c23232021-01-13 13:06:31 +0000272 ... - check device reason is still before restart
TorstenThieme440b7c02020-12-18 15:42:57 +0000273 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000274 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000275 FOR ${I} IN RANGE 0 ${num_olts}
276 #get olt serial number
277 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
278 #validate olt states
279 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
280 Enable Device ${olt_device_id}
281 END
TorstenThiemec3c23232021-01-13 13:06:31 +0000282 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
283 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
284 ... ELSE Perform Sanity Test
TorstenThieme440b7c02020-12-18 15:42:57 +0000285 Disable Onu Device
TorstenThiemec3c23232021-01-13 13:06:31 +0000286 ${alternativeonustates}= Create List omci-flows-deleted omci-admin-lock
287 Current State Test All Onus tech-profile-config-delete-success alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000288 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
289 ... ELSE Restart And Check Onu Adaptor ${namespace}
TorstenThiemec3c23232021-01-13 13:06:31 +0000290 Current State Test All Onus tech-profile-config-delete-success alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000291 Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
292 Enable Onu Device
TorstenThiemec3c23232021-01-13 13:06:31 +0000293 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
294 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
295 ... ELSE Perform Sanity Test True
TorstenThieme440b7c02020-12-18 15:42:57 +0000296
297Do Reconcile In Omci-Flows-Pushed
298 [Documentation] This keyword reconciles ONU device in omci-flows-pushed and check the state afterwards.
299 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
300 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
TorstenThiemec3c23232021-01-13 13:06:31 +0000301 ... - perform sanity test include add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000302 ... - kill the open-onu-adapter-go
TorstenThiemec3c23232021-01-13 13:06:31 +0000303 ... - wait for open-onu-adapter-go to restart
304 ... - perform sanity test suppress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000305 ... - disable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000306 ... - wait for corresponding device reason
307 ... - check UNI-ports disabled in ONOS
TorstenThieme440b7c02020-12-18 15:42:57 +0000308 ... - enable onu device
TorstenThiemec3c23232021-01-13 13:06:31 +0000309 ... - perform sanity test supress add subscriber
TorstenThieme440b7c02020-12-18 15:42:57 +0000310 FOR ${I} IN RANGE 0 ${num_olts}
311 #get olt serial number
312 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
313 #validate olt states
314 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
315 Enable Device ${olt_device_id}
316 END
TorstenThiemec3c23232021-01-13 13:06:31 +0000317 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
318 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
319 ... ELSE Perform Sanity Test
TorstenThieme440b7c02020-12-18 15:42:57 +0000320 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
321 ... ELSE Restart And Check Onu Adaptor ${namespace}
TorstenThiemec3c23232021-01-13 13:06:31 +0000322 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
323 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
324 ... ELSE Perform Sanity Test True
TorstenThieme440b7c02020-12-18 15:42:57 +0000325 Disable Onu Device
TorstenThiemec3c23232021-01-13 13:06:31 +0000326 ${alternativeonustates}= Create List omci-flows-deleted omci-admin-lock
327 Current State Test All Onus tech-profile-config-delete-success alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000328 Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
TorstenThieme440b7c02020-12-18 15:42:57 +0000329 Enable Onu Device
TorstenThiemec3c23232021-01-13 13:06:31 +0000330 Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
331 ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
332 ... ELSE Perform Sanity Test True