blob: cd5698318dbf8fe40ed5bd18d1257cab9f1ef4c6 [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 ***
16Documentation Test deifferent Reconcile scenarios of ONU Go adapter with ATT workflows only
17... 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
53# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
54# example: -v debugmode:True
55${debugmode} False
56# logging flag to enable Collect Logs, can be passed via the command line too
57# example: -v logging:True
58${logging} False
59# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
60# example: -v pausebeforecleanup:True
61${pausebeforecleanup} False
62# if True some outputs to console are done during running tests e.g. long duration flow test
63# example: -v print2console:True
64${print2console} False
65# if True (hard) kill will be used to restart onu adapter, else (soft) restart mechanism of k8s will be used
66# example: -v usekill2restart:True
67${usekill2restart} False
68${data_dir} ../data
69
70
71*** Test Cases ***
72Reconcile In Starting-OpenOmci
73 [Documentation] Validates the Reconcile in Starting-OpenOmci
74 ... Reconcile test during starting-openomci in AT&T-workflow:
75 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
76 ... -- wait for device reason starting-openomci
77 ... - kill the open-onu-adapter-go
78 ... -- wait for open-onu-adapter-go to restart
79 ... -- wait for device reason omci-flows-pushed
80 ... --- check for default EAPOL-flow and enabled UNI-port in ONOS
81 ... - delete ONU and MIB-template in KV-store
82 [Tags] functionalOnuGo ReconcileStartingOpenOmciOnuGo
83 [Setup] Run Keywords Start Logging ReconcileStartingOpenOmciOnuGo
84 ... AND Setup Test
85 Run Keyword If ${has_dataplane} Clean Up Linux
86 Run Keyword If '${num_all_onus}'=='1'
87 ... Do Reconcile In Determined State starting-openomci
88 ... ELSE Pass Execution ${skip_message} skipped
89 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
90 ... AND Teardown Test
91 ... AND Stop Logging ReconcileStartingOpenOmciOnuGo
92
93Reconcile In Initial-Mib-Downloaded
94 [Documentation] Validates the Reconcile in initial-mib-downloaded
95 ... Reconcile test during initial-mib-downloaded in AT&T-workflow:
96 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
97 ... -- wait for device reason initial-mib-downloaded
98 ... - kill the open-onu-adapter-go
99 ... -- wait for open-onu-adapter-go to restart
100 ... -- wait for device reason omci-flows-pushed
101 ... --- check for default EAPOL-flow and enabled UNI-port in ONOS
102 ... - delete ONU and MIB-template in KV-store
103 [Tags] functionalOnuGo ReconcileInitialMibDownloadedOnuGo
104 [Setup] Run Keywords Start Logging ReconcileInitialMibDownloadedOnuGo
105 ... AND Setup Test
106 Run Keyword If ${has_dataplane} Clean Up Linux
107 Run Keyword If '${num_all_onus}'=='1'
108 ... Do Reconcile In Determined State initial-mib-downloaded
109 ... ELSE Pass Execution ${skip_message} skipped
110 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
111 ... AND Teardown Test
112 ... AND Stop Logging ReconcileInitialMibDownloadedOnuGo
113
114Reconcile In Omci-Flows-Pushed
115 [Documentation] Validates the Reconcile in omci-flows-pushed
116 ... Former testcase: Reconcile Onu Device in Testsuite Voltha_ONUStateTest.robot
117 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
118 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
119 ... -- wait for device reason omci-flows-pushed
120 ... - kill the open-onu-adapter-go
121 ... -- wait for open-onu-adapter-go to restart
122 ... -- wait for device reason omci-flows-pushed
123 ... - disable onu device
124 ... -- wait for device reason tech-profile-config-delete-success
125 ... -- check UNI-ports disabled in ONOS
126 ... - enable onu device
127 ... -- wait for device reason omci-flows-pushed
128 ... --- check for default EAPOL-flow and enabled UNI-port in ONOS
129 ... - 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)
145 ... -- wait for device reason omci-flows-pushed
146 ... - disable onu device
147 ... -- wait for device reason 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 tech-profile-config-delete-success
152 ... - enable onu device
153 ... -- wait for device reason onu-reenabled
154 ... --- check for default EAPOL-flow and enabled UNI-port in ONOS
155 ... - delete ONU and MIB-template in KV-store
156 [Tags] functionalOnuGo ReconcileDisabledOnuDeviceOnuGo
157 [Setup] Run Keywords Start Logging ReconcileDisabledOnuDeviceOnuGo
158 ... AND Setup Test
159 Run Keyword If ${has_dataplane} Clean Up Linux
160 Run Keyword If '${num_all_onus}'=='1'
161 ... Do Reconcile For Disabled Onu Device
162 ... ELSE Pass Execution ${skip_message} skipped
163 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
164 ... AND Teardown Test
165 ... AND Stop Logging ReconcileDisabledOnuDeviceOnuGo
166
167*** Keywords ***
168Setup Suite
169 [Documentation] Set up the test suite
170 ${LogInfo}= Catenate
171 ... \r\nPassed arguments:
172 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
173 ... print2console:${print2console}
174 Log ${LogInfo} console=yes
175 Common Test Suite Setup
176 # prepare skip message in yellow for console log
177 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
178 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
179 ${skip_message} Catenate ${skipped} | ${skip} |
180 Set Suite Variable ${skip_message}
181 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
182 Set Suite Variable ${onos_ssh_connection}
183 # delete etcd MIB Template Data
184 Delete MIB Template Data
185
186Teardown Suite
187 [Documentation] Replaces the Suite Teardown in utils.robot.
188 ... Cleans up and checks all ONU ports disabled in ONOS.
189 ... Furthermore gives the possibility to pause the execution.
190 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
191 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
192 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
193 Run Keyword If ${teardown_device} Delete All Devices and Verify
194 Run Keyword If ${usekill2restart} Restart Pod ${namespace} open-onu
195 Validate Onu Data In Etcd 0
196 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout}
197 Close All ONOS SSH Connections
198
199Setup Test
200 [Documentation] Pre-test Setup
201 #test for empty device list
202 Test Empty Device List
203 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
204 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
205 Run Keyword If ${has_dataplane} Sleep 60s
206 #restart open-onu pod to reset crash loop back off mechansim of kubenetes
207 Run Keyword If "${firsttest}"=="False" and "${usekill2restart}"=="True" Restart Pod ${namespace} open-onu
208 Run Keyword If "${firsttest}"=="False" Sleep 35s
209 ${firsttest} Set Variable False
210 Set Suite Variable ${firsttest}
211 # Create a list of olt ids (logical and device_id)
212 ${olt_ids} Create List
213 FOR ${I} IN RANGE 0 ${num_olts}
214 #create/preprovision device
215 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
216 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
217 #validate olt states
218 Wait Until Keyword Succeeds ${timeout} 5s
219 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
220 Sleep 5s
221 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
222 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
223 ... of_id ${of_id} sn ${olt_serial_number}
224 Append To List ${olt_ids} ${olt}
225 END
226 Set Global Variable ${olt_ids}
227
228Teardown Test
229 [Documentation] Post-test Teardown
230 Run Keyword If ${teardown_device} Delete All Devices and Verify
231 # delete etcd MIB Template Data
232 Delete MIB Template Data
233 Sleep 5s
234
235Do Reconcile In Determined State
236 [Documentation] This keyword reconciles ONU device when passed reason is reached and
237 ... check the state afterwards.
238 ... Following steps will be executed:
239 ... - enable OLT device
240 ... - wait for passed openonu reason
241 ... - restart openonu adaptor
242 ... - check openonu adaptor is ready again
243 ... - wait for openonu reason 'omci-flows-pushed'
244 ... - check default (eapol) flow
245 ... - port check
246 [Arguments] ${expected_onu_reason}
247 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}
257 Current State Test All Onus omci-flows-pushed
258 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM ${timeout}
259 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
260 ... ${num_all_onus}
261 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
262 log ${flowsresult}
263
264Do Reconcile For Disabled Onu Device
265 [Documentation] This keyword reconciles ONU device for a disabled onu device and
266 ... check the state afterwards.
267 ... Following steps will be executed:
268 ... - enable OLT device
269 ... - wait for openonu reason 'omci-flows-pushed'
270 ... - disable onu device
271 ... - wait for openonu reason 'tech-profile-config-delete-success'
272 ... - check UNI-ports disabled in ONOS
273 ... - restart openonu adaptor
274 ... - check openonu adaptor is ready again
275 ... - check device reason is still 'tech-profile-config-delete-success'
276 ... - enable onu device
277 ... - wait for openonu reason 'onu-reenabled'
278 ... - check default (eapol) flow
279 ... - port check
280 FOR ${I} IN RANGE 0 ${num_olts}
281 #get olt serial number
282 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
283 #validate olt states
284 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
285 Enable Device ${olt_device_id}
286 END
287 Current State Test All Onus omci-flows-pushed
288 Disable Onu Device
289 Current State Test All Onus tech-profile-config-delete-success
290 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
291 ... ELSE Restart And Check Onu Adaptor ${namespace}
292 Current State Test All Onus tech-profile-config-delete-success
293 Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
294 Enable Onu Device
295 Current State Test All Onus onu-reenabled alternativeonustate=omci-flows-pushed
296 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM ${timeout}
297 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
298 ... ${num_all_onus}
299 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
300 log ${flowsresult}
301
302Do Reconcile In Omci-Flows-Pushed
303 [Documentation] This keyword reconciles ONU device in omci-flows-pushed and check the state afterwards.
304 ... Reconcile test during omci-flows-pushed in AT&T-workflow:
305 ... - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
306 ... -- wait for device reason omci-flows-pushed
307 ... - kill the open-onu-adapter-go
308 ... -- wait for open-onu-adapter-go to restart
309 ... -- wait for device reason omci-flows-pushed
310 ... - disable onu device
311 ... -- wait for device reason tech-profile-config-delete-success
312 ... -- check UNI-ports disabled in ONOS
313 ... - enable onu device
314 ... -- wait for device reason omci-flows-pushed
315 ... --- check for default EAPOL-flow and enabled UNI-port in ONOS
316 ... - delete ONU and MIB-template in KV-store
317 FOR ${I} IN RANGE 0 ${num_olts}
318 #get olt serial number
319 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
320 #validate olt states
321 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
322 Enable Device ${olt_device_id}
323 END
324 Current State Test All Onus omci-flows-pushed
325 Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
326 ... ELSE Restart And Check Onu Adaptor ${namespace}
327 Current State Test All Onus omci-flows-pushed
328 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM ${timeout}
329 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
330 ... ${num_all_onus}
331 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
332 log ${flowsresult}
333 Disable Onu Device
334 Current State Test All Onus tech-profile-config-delete-success
335 Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
336 # Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout}
337 Enable Onu Device
338 Current State Test All Onus omci-flows-pushed
339 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM ${timeout}
340 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
341 ... ${num_all_onus}
342 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
343 log ${flowsresult}