blob: 260d0ab1a1541eafc563a38a0d9685d2bea2c3d9 [file] [log] [blame]
Andrea Speranza8b6f46f2022-08-23 14:22:15 +02001# Copyright 2022 - 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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
17Suite Setup Setup Suite
18Test Setup Setup
19Test Teardown Teardown
20Suite Teardown Teardown Suite
21Library XML
22Library String
23Library DateTime
24Library Process
25Library Collections
26Library RequestsLibrary
27Library OperatingSystem
28Resource ../../libraries/bbf_adapter_utilities.robot
29Library ../../libraries/DependencyLibrary.py
30Resource ../../libraries/onos.robot
31Resource ../../libraries/voltctl.robot
32Resource ../../libraries/voltha.robot
33Resource ../../libraries/utils.robot
34Resource ../../libraries/k8s.robot
35Resource ../../variables/variables.robot
36Resource ../../libraries/power_switch.robot
37
38*** Variables ***
39${POD_NAME} flex-ocp-cord
40${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
41${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
42${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
43${HELM_CHARTS_DIR} ~/helm-charts
44${VOLTHA_POD_NUM} 8
45${NAMESPACE} voltha
46${INFRA_NAMESPACE} default
47${timeout} 60s
48${of_id} 0
49${logical_id} 0
50${has_dataplane} False
51${teardown_device} True
52${scripts} ../../scripts
53
54# Per-test logging on failure is turned off by default; set this variable to enable
55${container_log_dir} ${None}
56
57# logging flag to enable Collect Logs, can be passed via the command line too
58# example: -v logging:False
59${logging} True
60
61# Flag specific to Soak Jobs
62${SOAK_TEST} False
63${bbsim_port} 50060
64
65#Suppress the subscribe phase
66${supress_add_subscriber} False
67
68#Enable or Disable the MacLearning verifier for MacLearning ONOS APP
69${maclearningenabled} False #Not yet used but it is a placeholder
70
71*** Test Cases ***
72BBF Adapter Aggregation Test
73 [Documentation] Do a runtime test enabling all the device
74 ... and verify if VOLTHA and BBF have the same view,
75 ... with the correct translation, of the network
76 [Tags] sanityBbfAdapter
77 [Setup] Start Logging sanityBbfAdapter
78 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
79 ... AND Stop Logging sanityBbfAdapter
80 Run Keyword Setup ${SOAK_TEST}
81 Run Keyword If ${has_dataplane} Clean Up Linux
82 Get BBF Device Aggregation ${NAMESPACE} ${CURDIR}/data.xml ${scripts}
83 Log ${supress_add_subscriber}
84 Perform Sanity Test of BBFadapter Aggregation ./data.xml ${supress_add_subscriber}
85 Teardown Suite
86
87Test Disable and Enable ONU for BBF
88 [Documentation] Disable ONUs from the BBF Adapter (PlaceHolder with VOLTHA)
89 ... Verify all the states in voltha and in the BBF Adapter (like a compare).
90 ... Enable the ONUs from the BBF adapter, verify the enable states in voltha
91 ... and in BBF Adapter (like a compare).
92 ... It is also possible to verify a connectivity, with a no block test.
93 [Tags] bbfAdapterFunctionality disableEnableONUBBF
94 [Setup] Start Logging disableEnableONUBBF
95 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
96 ... AND Stop Logging disableEnableONUBBF
97 # Create a single Setup for Multiple Test Case
98 Run Keyword Setup ${SOAK_TEST}
99 Run Keyword If ${has_dataplane} Clean Up Linux
100 # Disable, verify state, Enable and verify stato for each ONU
101 FOR ${I} IN RANGE 0 ${num_all_onus}
102 ${src}= Set Variable ${hosts.src[${I}]}
103 ${dst}= Set Variable ${hosts.dst[${I}]}
104 ${of_id}= Get ofID From OLT List ${src['olt']}
105 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
106 ... ${of_id} ${src['uni_id']}
107 ${onu_device_id}= Get Device ID From SN ${src['onu']}
108 # Subscribe the ONU if requested for the tests
109 Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
110 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
111 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
112 # Disbale the device (actually with voltha in future with BBF Adapter)
113 Disable Device ${onu_device_id}
114 Disable Device in BBF ${onu_device_id}
115 # Retrive from BBF Adapter an Update XML that contain the ONUs
116 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
117 # Define some states that the ONU reason can be
118 ${onu_reasons}= Create List omci-flows-deleted
119 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} omci-admin-lock
120 Log ${onu_reasons}
121 # Verify in Voltha the State of the ONU
122 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
123 ... Validate Device DISABLED UNKNOWN
124 ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
125 # Verify in the BBF Adapter the State of the ONU
126 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
127 ... Validate Onu in BBF DISABLED UNKNOWN
128 ... REACHABLE ${src['onu']} ${onu_reasons}
129 # Verify if the disabling of the ONU desable also the UNI port
130 Wait Until Keyword Succeeds ${timeout} 2s
131 ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
132 # Verify if there are not connectivity to the ONU
133 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
134 ... Wait Until Keyword Succeeds ${timeout} 2s
135 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
136 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
137 # Enable the device (actually with voltha in future with BBF Adapter)
138 Enable Device ${onu_device_id}
139 Enable Device in BBF ${onu_device_id}
140 # Retrive from BBF Adapter an Update XML that contain the ONUs
141 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
142 # Define some states that the ONU reason can be
143 ${onu_reasons}= Create List omci-flows-pushed
144 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
145 Log ${onu_reasons}
146 # Verify in the Voltha the State of the ONU
147 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
148 ... Validate Device ENABLED ACTIVE
149 ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
150 # Verify in the BBF Adapter the State of the ONU
151 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
152 ... Validate Onu in BBF ENABLED ACTIVE
153 ... REACHABLE ${src['onu']} ${onu_reasons}
154 # Verify if the disabling of the ONU desable also the UNI port
155 Wait Until Keyword Succeeds ${timeout} 2s
156 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
157 # Verify if there are not connectivity to the ONU
158 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
159 ... Wait Until Keyword Succeeds ${timeout} 2s
160 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
161 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
162 END
163
164Test Disable and Enable OLT for BBF
165 [Documentation] Disable OLTs from the BBF Adapter (Placeholder with Voltha).
166 ... Verify the disable states of OLTs in Voltha and in the BBF Adapter (like a compare).
167 ... Enable the OLTs from the BBF adapter, verify the states in voltha
168 ... and in BBF Adapter (like a compare).
169 ... It is also possible to verify a connectivity, with a no block test.
170 [Tags] bbfAdapterFunctionality disableEnableOLTBBF
171 [Setup] Start Logging disableEnableOLTBBF
172 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
173 ... AND Stop Logging disableEnableOLTBBF
174 # Disable each OLT and Validate it state
175 FOR ${I} IN RANGE 0 ${olt_count}
176 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
177 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
178 ${of_id}= Get ofID From OLT List ${olt_serial_number}
179 # Retrive from BBF Adapter an Update XML that contain the ONUs
180 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
181 # Verify in Voltha the State of the OLT
182 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
183 ... Validate OLT Device ENABLED ACTIVE REACHABLE
184 ... ${olt_serial_number}
185 # Verify in BBF Adapter the State of the ONU
186 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
187 ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
188 ... ${olt_serial_number} ${olt_device_id}
189 # Disbale the device (actually with voltha in future with BBF Adapter)
190 Disable Device ${olt_device_id}
191 Disable Device in BBF ${olt_device_id}
192 # Retrive from BBF Adapter an Update XML that contain the ONUs
193 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
194 # Verify in Voltha the State of the OLT
195 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
196 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
197 ... ${olt_serial_number}
198 # Verify in BBF Adapter the State of the ONU
199 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
200 ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
201 ... ${olt_serial_number} ${olt_device_id}
202 END
203 # Enable the OLT back and check OLT operstatus are back to "ACTIVE"
204 FOR ${I} IN RANGE 0 ${olt_count}
205 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
206 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
207 ${of_id}= Get ofID From OLT List ${olt_serial_number}
208 # Enable the device (actually with voltha in future with BBF Adapter)
209 Enable Device ${olt_device_id}
210 Enable Device in BBF ${olt_device_id}
211 # Retrive from BBF Adapter an Update XML that contain the ONUs
212 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
213 # Verify in Voltha the State of the OLT
214 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
215 ... Validate OLT Device ENABLED ACTIVE REACHABLE
216 ... ${olt_serial_number}
217 # Verify in BBF Adapter the State of the ONU
218 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
219 ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
220 ... ${olt_serial_number} ${olt_device_id}
221 END
222
223Test Disable and Delete OLT for BBF
224 [Documentation] Disable OLTs from the BBF Adapter (PlaceHolder with Voltha)
225 ... Verify the disable state of the OLT in voltha and in the BBF Adapter,
226 ... Delete the OLTs from the BBF adapter, verify if it was done correctly in voltha
227 ... and in BBF Adapter.
228 [Tags] bbfAdapterFunctionality disableEnableOLTBBF
229 [Setup] Start Logging disableEnableOLTBBF
230 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
231 ... AND Stop Logging disableEnableOLTBBF
232 # Disable and Validate OLT Device
233 FOR ${I} IN RANGE 0 ${olt_count}
234 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
235 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
236 Disable Device ${olt_device_id}
237 Disable Device in BBF ${olt_device_id}
238 ${of_id}= Get ofID From OLT List ${olt_serial_number}
239 # Retrive from BBF Adapter an Update XML that contain the ONUs
240 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
241 # Retrive from BBF Adapter an Update XML that contain the ONUs
242 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
243 # Retrive from BBF Adapter an Update XML that contain all the devices
244 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
245 # Verify in Voltha the State of the OLT
246 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
247 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
248 ... ${olt_serial_number}
249 Validate Olt Disabled in BBF ${olt_serial_number} ${olt_device_id}
250
251 ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
252 # Validate ONUs
253 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
254 ... Validate ONUs After OLT Disable
255 ... ${num_onus} ${olt_serial_number}
256 Validate ONUs After OLT Disable in BBF ${olt_serial_number}
257 # Delete the device (actually with voltha in future with BBF Adapter)
258 Delete Device ${olt_device_id}
259 Delete Device in BBF ${olt_device_id}
260 # Retrive from BBF Adapter an Update XML that contain all the devices
261 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
262 # Check that the OLT are actually removed from the system
263 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
264 ... ${olt_serial_number}
265 # Check if the OLT has been removed from the system
266 Validate Device Removed in BBF ${olt_serial_number}
267 # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
268 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
269 ... ${olt_serial_number} ${timeout}
270 # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
271 Validate All Onus for OLT Removed in BBF ${olt_serial_number}
272 #Wait Until Keyword Succeeds ${timeout} 5s
273 #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
274 END
275 Teardown Suite
276
277Test Delete and ReAdd OLT for BBF
278 [Documentation] Delete OLTs from the BBF Adapter (PlaceHolder with Voltha)
279 ... Verify if the OLT and ONUs connected was really delete in voltha and in the BBF Adapter.
280 ... Readd all the OLTs from the BBF adapter, verify the enable state in voltha
281 ... and in BBF Adapter and check the correct status after the readd.
282 [Tags] bbfAdapterFunctionality DeleteReAddOLTBBF
283 [Setup] Start Logging DeleteReAddOLTBBF
284 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
285 ... AND Stop Logging DeleteReAddOLTBBF
286 Run Keyword Setup ${SOAK_TEST}
287 Run Keyword If ${has_dataplane} Clean Up Linux
288 FOR ${I} IN RANGE 0 ${olt_count}
289 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
290 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
291 # Delete the device (actually with voltha in future with BBF Adapter)
292 Delete Device ${olt_device_id}
293 Delete Device in BBF ${olt_device_id}
294 # Retrive from BBF Adapter an Update XML that contain all the devices
295 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
296 # Check if the OLT has been removed from the system
297 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
298 ... Validate Device Removed ${olt_serial_number}
299 # Check if the OLT has been removed from the BBF Adapter
300 Validate Device Removed in BBF ${olt_serial_number}
301 # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
302 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
303 ... ${olt_serial_number} ${timeout}
304 # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
305 Validate all ONUS for OLT Removed in BBF ${olt_serial_number}
306 #Wait Until Keyword Succeeds ${timeout} 5s
307 #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
308 END
309 # Recreate the OLTs
310 Run Keyword Setup ${SOAK_TEST}
311 # Retrive from BBF Adapter an Update XML that contain the ONUs
312 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
313 FOR ${I} IN RANGE 0 ${olt_count}
314 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
315 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
316 # Verify in Voltha the State of the OLT
317 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
318 ... Validate OLT Device ENABLED ACTIVE REACHABLE
319 ... ${olt_serial_number}
320 # Verify in BBF Adapter the State of the ONU
321 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
322 ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
323 ... ${olt_serial_number} ${olt_device_id}
324 END
325 Teardown Suite
326
327Test Disable ONUs and OLT for BBF
328 [Documentation] Disable ONUs and OLTs, verify if the OLT and ONUs connected
329 ... was really disable in voltha and in the BBF Adapter.
330 ... Delete ONUs and OLTs, verify if the ONUs and OLT was really deleted
331 ... in voltha and BBF Adapter.
332 [Tags] bbfAdapterFunctionality DisableONUOLTBBF
333 [Setup] Start Logging DisableONUOLTBBF
334 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
335 ... AND Stop Logging DisableONUOLTBBF
336 Run Keyword Setup ${SOAK_TEST}
337 Run Keyword If ${has_dataplane} Clean Up Linux
338 # Define some states that the ONU reason can be
339 FOR ${I} IN RANGE 0 ${num_all_onus}
340 ${src}= Set Variable ${hosts.src[${I}]}
341 ${dst}= Set Variable ${hosts.dst[${I}]}
342 ${onu_device_id}= Get Device ID From SN ${src['onu']}
343 ${of_id}= Get ofID From OLT List ${src['olt']}
344 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
345 ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
346 ${olt_device_id}= Get OLTDeviceID From OLT List ${src['olt']}
347 # Subscribe the ONU if requested for the tests
348 Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
349 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
350 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
351 # Onu reasons selection
352 @{onu_reasons}= Create List omci-flows-pushed
353 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
354 # Retrive from BBF Adapter an Update XML that contain the ONUs
355 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
356 # Verify in the Voltha the State of the ONU
357 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
358 ... Validate Device ENABLED ACTIVE
359 ... REACHABLE ${src['onu']} onu=True onu_reason=${onu_reasons}
360 # Verify in the BBF Adapter the State of the ONU
361 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
362 ... Validate Onu in BBF ENABLED ACTIVE
363 ... REACHABLE ${src['onu']} ${onu_reasons}
364 # Retrive from BBF Adapter an Update XML that contain the ONUs
365 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
366 # Verify in Voltha the State of the OLT
367 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
368 ... Validate OLT Device ENABLED ACTIVE
369 ... REACHABLE ${src['olt']}
370 # Verify in BBF Adapter the State of the ONU
371 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
372 ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
373 ... ${src['olt']} ${olt_device_id}
374 # Disbale the device (actually with voltha in future with BBF Adapter)
375 Disable Device ${onu_device_id}
376 Disable Device in BBF ${onu_device_id}
377 # Onu reasons selection
378 ${onu_reasons}= Create List omci-flows-deleted
379 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} omci-admin-lock
380 Log ${onu_reasons}
381 # Retrive from BBF Adapter an Update XML that contain the ONUs
382 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
383 # Verify in the Voltha the State of the ONU
384 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
385 ... Validate Device DISABLED UNKNOWN
386 ... REACHABLE ${src['onu']} ${onu_reasons} onu=True
387 # Verify in the BBF Adapter the State of the ONU
388 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
389 ... Validate Onu in BBF DISABLED UNKNOWN
390 ... REACHABLE ${src['onu']} ${onu_reasons}
391 # Check if the OLT where the ONU is connected have the correct state
392 # after the disbaling one ONU connected
393 # Retrive from BBF Adapter an Update XML that contain the ONUs
394 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
395 # Verify in Voltha the State of the OLT
396 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
397 ... Validate OLT Device ENABLED ACTIVE
398 ... REACHABLE ${src['olt']}
399 # Verify in BBF Adapter the State of the ONU
400 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
401 ... Validate Olt in BBF ENABLED ACTIVE REACHABLE
402 ... ${src['olt']} ${olt_device_id}
403 END
404 # Disable all OLTs and check if the state after disable are correct
405 FOR ${I} IN RANGE 0 ${olt_count}
406 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
407 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
408 Disable Device ${olt_device_id}
409 Disable Device in BBF ${olt_device_id}
410 # Retrive from BBF Adapter an Update XML that contain the ONUs
411 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
412 # Verify in Voltha the State of the OLT
413 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
414 ... ${olt_serial_number}
415 # Verify in BBF Adapter the State of the ONU
416 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
417 ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
418 ... ${olt_serial_number} ${olt_device_id}
419 END
420
421Delete Disabled ONUs and OLT for BBF
422 [Documentation] Continue of the before test.
423 ... Validate the Disble state of ONUs and Oltes,
424 ... Delete Disabled Onus and Disabled Olts and verify the correct
425 ... elimination of all devices from Voltha and BBF Adapter.
426 [Tags] bbfAdapterFunctionality DeleteONUOLTBBF
427 [Setup] Start Logging DeleteONUOLTBBF
428 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
429 ... AND Stop Logging DeleteONUOLTBBF
430 # Validate ONUs states after OLT disable
431 ${onu_reasons}= Create List stopping-openomci
432 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} stopping-openomci
433 Log ${onu_reasons}
434 FOR ${I} IN RANGE 0 ${num_all_onus}
435 ${src}= Set Variable ${hosts.src[${I}]}
436 ${dst}= Set Variable ${hosts.dst[${I}]}
437 ${onu_device_id}= Get Device ID From SN ${src['onu']}
438 ${olt_device_id}= Get OLTDeviceID From OLT List ${src['olt']}
439 # Retrive from BBF Adapter an Update XML that contain the ONUs
440 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
441 # Verify in the Voltha the State of the ONU
442 Wait Until Keyword Succeeds ${timeout} 5s
443 ... Validate Device DISABLED DISCOVERED
444 ... UNREACHABLE ${src['onu']} ${onu_reasons} onu=True
445 # Verify in the BBF Adapter the State of the ONU
446 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
447 ... Validate Onu in BBF DISABLED DISCOVERED
448 ... UNREACHABLE ${src['onu']} ${onu_reasons}
449 # Delete the device (actually with voltha in future with BBF Adapter)
450 Delete Device ${onu_device_id}
451 Delete Device in BBF ${onu_device_id}
452 # Retrive from BBF Adapter an Update XML that contain all the devices
453 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
454 Validate Device Removed in BBF ${src['onu']}
455 # Retrive from BBF Adapter an Update XML that contain the ONUs
456 OLT XML update From BBF ${CURDIR}/data.xml ${scripts}
457 # Verify in Voltha the State of the OLT
458 Wait Until Keyword Succeeds ${timeout} 5s
459 ... Validate OLT Device DISABLED UNKNOWN
460 ... REACHABLE ${src['olt']}
461 # Verify in BBF Adapter the State of the ONU
462 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
463 ... Validate Olt in BBF DISABLED UNKNOWN REACHABLE
464 ... ${src['olt']} ${olt_device_id}
465 END
466 # Delete all OLTs
467 # Delete All Devices and Verify
468 FOR ${I} IN RANGE 0 ${olt_count}
469 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
470 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
471 # Delete the device (actually with voltha in future with BBF Adapter)
472 Delete Device ${olt_device_id}
473 Delete Device in BBF ${olt_device_id}
474 # Retrive from BBF Adapter an Update XML that contain all the devices
475 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
476 # Check that the OLT and the ONUs are actually removed from the system
477 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
478 ... ${olt_serial_number}
479 # Check if the OLT has been removed from the system
480 Validate Device Removed in BBF ${olt_serial_number}
481 # Validate if all the ONUS connected at the OLT revomed are also been removed in VOLTHA
482 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
483 ... ${olt_serial_number} ${timeout}
484 # Validate if all the ONUS connected at the OLT revomed are also been removed in BBF Adapter
485 Validate all ONUS for OLT Removed in BBF ${olt_serial_number}
486 #Wait Until Keyword Succeeds ${timeout} 5s
487 #... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
488 END
489 Teardown Suite
490
491Test ONU Delete and Auto-Discovery for BBF
492 [Documentation] Validate the Autodiscory of an ONUs in case of Delete.
493 ... Delete the device and verify if them was really deleted.
494 ... Verify if all the Onus are re discovered in the correct way.
495 ... Verify the state after and before a subscription if needed.
496 ... Verify the connectivity if needed.
497 [Tags] bbfAdapterFunctionality ONUAutoDiscoveryBBF
498 [Setup] Start Logging ONUAutoDiscoveryBBF
499 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
500 ... AND Stop Logging ONUAutoDiscoveryBBF
501 Clear All Devices Then Create New Device
502 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
503 Run Keyword If ${has_dataplane} Clean Up Linux
504 FOR ${I} IN RANGE 0 ${num_all_onus}
505 ${src}= Set Variable ${hosts.src[${I}]}
506 ${dst}= Set Variable ${hosts.dst[${I}]}
507 ${of_id}= Get ofID From OLT List ${src['olt']}
508 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
509 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
510 ${onu_device_id}= Get Device ID From SN ${src['onu']}
511 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in ONOS ${of_id}
512 # Subscribe the ONU if requested for the tests
513 Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
514 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
515 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
516 # Verify ONU state in voltha
517 # Retrive from BBF Adapter an Update XML that contain the ONUs
518 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
519 @{onu_reasons}= Create List omci-flows-pushed
520 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
521 # Verify in the Voltha the State of the ONU
522 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
523 ... Validate Device ENABLED ACTIVE REACHABLE
524 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
525 # Verify in the BBF Adapter the State of the ONU
526 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
527 ... Validate Onu in BBF ENABLED ACTIVE
528 ... REACHABLE ${src['onu']} ${onu_reasons}
529 # Delete ONU and Verify Ping Fails
530 # Delete the device (actually with voltha in future with BBF Adapter)
531 Delete Device ${onu_device_id}
532 Delete Device in BBF ${onu_device_id}
533 # Retrive from BBF Adapter an Update XML that contain all the devices
534 ALL DEVICES XML update From BBF ${CURDIR}/data.xml ${scripts}
535 # Verify if the ONU has been removed from the system
536 Validate Device Removed in BBF ${src['onu']}
537 Run Keyword If ${has_dataplane} Verify ping is successful except for given device
538 ... ${num_all_onus} ${src['onu']}
539 # Verify that no pending flows exist for the ONU port
540 Wait Until Keyword Succeeds ${timeout} 2s
541 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
542 # ONU Auto-Discovery
543 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
544 ... Get ONU Port in ONOS ${src['onu']} ${of_id} ${src['uni_id']}
545 # Check ONU port is Enabled in ONOS
546 Wait Until Keyword Succeeds ${timeout} 2s
547 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
548 ${onu_device_id}= Get Device ID From SN ${src['onu']}
549 Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
550 # Re-Add Subscriber
551 Run Keyword If '${supress_add_subscriber}' == 'False' Wait Until Keyword Succeeds ${timeout} 2s
552 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
553 ... volt-add-subscriber-access ${of_id} ${onu_port}
554 # Verify that no pending flows exist for the ONU port
555 Wait Until Keyword Succeeds ${timeout} 2s
556 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
557 # Verify ONU state in voltha
558 # Retrive from BBF Adapter an Update XML that contain the ONUs
559 ONU XML update From BBF ${CURDIR}/data.xml ${scripts}
560 @{onu_reasons}= Create List omci-flows-pushed
561 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} initial-mib-downloaded
562 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
563 ... Validate Device ENABLED ACTIVE REACHABLE
564 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
565 # Verify in the BBF Adapter the State of the ONU
566 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
567 ... Validate Onu in BBF ENABLED ACTIVE
568 ... REACHABLE ${src['onu']} ${onu_reasons}
569 # Verify Meters in ONOS
570 #Wait Until Keyword Succeeds ${timeout} 5s
571 #... Verify Meters in ONOS Ietf ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
572 Run Keyword If ${has_dataplane} Validate DHCP and Ping True
573 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
574 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
575 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
576 ... ${dst['container_name']}
577 END
578 # Verify flows for all OLTs
579 #Wait Until Keyword Succeeds ${timeout} 5s Validate All OLT Flows
580
581
582*** Keywords ***
583Setup Suite
584 [Documentation] Set up the test suite
585 Common Test Suite Setup
586 #power_switch.robot needs it to support different vendor's power switch
587 ${switch_type}= Get Variable Value ${web_power_switch.type}
588 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
589
590Clear All Devices Then Create New Device
591 [Documentation] Remove any devices from VOLTHA and ONOS
592 # Remove all devices from voltha and nos
593 Run Keyword Delete All Devices and Verify
594 # Execute normal test Setup Keyword
595 Run Keyword Setup ${SOAK_TEST}