blob: 88f9b0a5798ddfeb6e76c309133821ffa92a99d9 [file] [log] [blame]
Akash Soni35cafc32023-12-20 12:48:08 +05301# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
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 ***
17Documentation Test various end-to-end scenarios
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/vgc.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils_vgc.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
34Resource ../../libraries/power_switch.robot
35
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${VOLTHA_POD_NUM} 8
39${NAMESPACE} voltha
40${INFRA_NAMESPACE} default
41${STACK_NAME} voltha
42# For below variable value, using deployment name as using grep for
43# parsing radius pod name, we can also use full radius pod name
44${RESTART_POD_NAME} radius
45${timeout} 120s
46${of_id} 0
47${logical_id} 0
48${has_dataplane} True
Guru Prasanna0ae8e692025-05-02 15:03:40 +053049${kafka} voltha-voltha-api
50${KAFKA_PORT} 55555
Akash Soni35cafc32023-12-20 12:48:08 +053051${teardown_device} False
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
64*** Test Cases ***
65Verify restart openonu-adapter container after subscriber provisioning for DT
66 [Documentation] Restart openonu-adapter container after VOLTHA is operational.
67 ... Prerequisite : ONUs are authenticated and pingable.
68 [Tags] Restart-OpenOnu-Dt soak raj
69 [Setup] Start Logging Restart-OpenOnu-Dt
70 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
71 ... AND Stop Logging Restart-OpenOnu-Dt
72
73 # Add OLT device
74
75 Run Keyword If '${SOAK_TEST}'=='False' Setup
76 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
77 Run Keyword If ${has_dataplane} Clean Up Linux
78 Perform Sanity Test DT
79 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
80 Log ${podStatusOutput}
81 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
82 ${podName} Set Variable adapter-open-onu
83 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
84 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
85 ... app ${podName} Running
86 # Wait for 1 min after openonu adapter is restarted
87 Run Keyword If ${has_dataplane} Clean Up Linux
88 Perform Sanity Test DT
89 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
90 Log ${podStatusOutput}
91 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
92 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
93 Log to console Pod ${podName} restarted and sanity checks passed successfully
rbodapatfe5bb152025-03-17 11:34:42 +053094 # "Once the onu adapter is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if the OLT is deleted
95 # before the ONUs are reconiled successfully there would be stale entries. This scenario is not handled in VOLTHA as
96 # of now. And there is no other to check if the reconcile has happened for all the ONUs. Due to this limitations a
97 # sleep of 60s is introduced to give enough time for onu adapter to reconcile the ONUs."
98 Sleep 60s
Akash Soni35cafc32023-12-20 12:48:08 +053099 Run Keyword If '${SOAK_TEST}'=='False' Delete All Devices and Verify
100
101Verify restart openolt-adapter container after subscriber provisioning for DT
102 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
103 ... Prerequisite : ONUs are authenticated and pingable.
104 [Tags] Restart-OpenOlt-Dt soak raj
105 [Setup] Start Logging Restart-OpenOlt-Dt
106 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
107 ... AND Stop Logging Restart-OpenOlt-Dt
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530108 # Add OLT_device
Akash Soni35cafc32023-12-20 12:48:08 +0530109 Run Keyword If '${SOAK_TEST}'=='False' setup
110 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
111 Run Keyword If ${has_dataplane} Clean Up Linux
112 Perform Sanity Test DT
113 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
114 Log ${podStatusOutput}
115 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
116 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
117 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
118 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
119 ... app ${podName} Running
120 # Wait for 1 min after openolt adapter is restarted
121 Run Keyword If ${has_dataplane} Clean Up Linux
122 Perform Sanity Test DT
123 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
124 Log ${podStatusOutput}
125 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
126 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
rbodapatfe5bb152025-03-17 11:34:42 +0530127 # "Once the olt adapter is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if try to delete OLT
128 # before the OLT's are reconiled successfully there would be recocile error. This scenario is not handled in VOLTHA as
129 # of now. And there is no other to check if the reconcile has happened for all the OLTs. Due to this limitations a
130 # sleep of 60s is introduced to give enough time for OLT adapter to reconcile the OLTs."
131 Sleep 60s
Akash Soni35cafc32023-12-20 12:48:08 +0530132 Log to console Pod ${podName} restarted and sanity checks passed successfully
133
134Verify openolt adapter restart before subscriber provisioning for DT
135 [Documentation] Restart openolt-adapter container before adding the subscriber.
136 [Tags] functionalDt olt-adapter-restart-Dt raj
137 [Setup] Start Logging OltAdapterRestart-Dt
138 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
139 ... AND Stop Logging OltAdapterRestart-Dt
140 # Add OLT device
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530141 Sleep 120s
142 Deactivate Subscribers In VGC
Akash Soni35cafc32023-12-20 12:48:08 +0530143 Clear All Devices Then Create New Device
144 Run Keyword If ${has_dataplane} Clean Up Linux
145 Set Global Variable ${of_id}
146
147 FOR ${I} IN RANGE 0 ${num_all_onus}
148 ${src}= Set Variable ${hosts.src[${I}]}
149 ${dst}= Set Variable ${hosts.dst[${I}]}
150 ${of_id}= Get ofID From OLT List ${src['olt']}
151 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in VGC ${src['onu']}
152 ... ${of_id} ${src['uni_id']}
153 ${onu_device_id}= Get Device ID From SN ${src['onu']}
154 Wait Until Keyword Succeeds ${timeout} 5s
155 ... Validate Device ENABLED ACTIVE REACHABLE
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530156 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded by_dev_id=True
Akash Soni35cafc32023-12-20 12:48:08 +0530157 END
158 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
159 Scale K8s Deployment by Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 0
160 Wait Until Keyword Succeeds ${timeout} 2s Pods Do Not Exist By Label ${NAMESPACE} app
161 ... ${OLT_ADAPTER_APP_LABEL}
162 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
163 Scale K8s Deployment by Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 1
164 Wait Until Keyword Succeeds ${timeout} 2s
165 ... Check Expected Available Deployment Replicas By Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 1
166 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL}
167
168 # Ensure the device is available in ONOS, this represents system connectivity being restored
169 FOR ${I} IN RANGE 0 ${olt_count}
170 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
171 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
172 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
173 ... ${olt_serial_number}
174 Wait Until Keyword Succeeds 120s 2s Device Is Available In VGC
175 ... ${of_id}
176 END
177
178 FOR ${I} IN RANGE 0 ${num_all_onus}
179 ${src}= Set Variable ${hosts.src[${I}]}
180 ${dst}= Set Variable ${hosts.dst[${I}]}
181 ${of_id}= Get ofID From OLT List ${src['olt']}
182 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
183 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in VGC ${src['onu']}
184 ... ${of_id} ${src['uni_id']}
185 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
186 Add Subscriber Details ${of_id} ${onu_port}
187 # Verify Meters in ONOS
188 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
189 ... Verify Meters in VGC Ietf ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id} ${onu_port}
190 # Verify subscriber access flows are added for the ONU port
191 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
192 ... Verify Subscriber Access Flows Added for ONU DT in VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
193 ... ${onu_port} ${nni_port} ${src['s_tag']}
194 Wait Until Keyword Succeeds ${timeout} 5s Validate Device
195 ... ENABLED ACTIVE REACHABLE
196 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
197 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
198 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
199 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
200 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
201 ... ${dst['container_name']}
rbodapatfe5bb152025-03-17 11:34:42 +0530202 # "Once the olt adapter is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if try to delete OLT
203 # before the OLT's are reconiled successfully there would be recocile error. This scenario is not handled in VOLTHA as
204 # of now. And there is no other to check if the reconcile has happened for all the OLTs. Due to this limitations a
205 # sleep of 60s is introduced to give enough time for OLT adapter to reconcile the OLTs."
206 Sleep 60s
Akash Soni35cafc32023-12-20 12:48:08 +0530207 END
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530208 Deactivate Subscribers In VGC
Akash Soni35cafc32023-12-20 12:48:08 +0530209
210Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for DT
211 [Documentation] Deploys an device instance and waits for it to authenticate. After
212 ... authentication is successful the rw-core deployment is scaled to 0 instances to
213 ... simulate a POD crash. The test then scales the rw-core back to a single instance
214 ... and configures ONOS for access. The test succeeds if the device is able to
215 ... complete the DHCP sequence.
216 [Tags] functionalDt rwcore-restart-Dt raj
217 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-Dt
218 ... AND Clear All Devices Then Create New Device
219 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
220 ... AND Stop Logging RwCoreFailAndRestart-Dt
221 #... AND Delete Device and Verify
222 Run Keyword If ${has_dataplane} Clean Up Linux
223 FOR ${I} IN RANGE 0 ${olt_count}
224 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
225 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
226 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
227 ... ${olt_serial_number}
228 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
229 END
230 FOR ${I} IN RANGE 0 ${num_all_onus}
231 ${src}= Set Variable ${hosts.src[${I}]}
232 ${dst}= Set Variable ${hosts.dst[${I}]}
233 ${of_id}= Get ofID From OLT List ${src['olt']}
234 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
235 ... Get ONU Port in VGC ${src['onu']} ${of_id} ${src['uni_id']}
236 ${onu_device_id}= Get Device ID From SN ${src['onu']}
237 # Bring up the device and verify it authenticates
238 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530239 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded by_dev_id=True
Akash Soni35cafc32023-12-20 12:48:08 +0530240 END
241
242 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
243 Scale K8s Deployment voltha voltha-voltha-rw-core 0
244 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
245 # Ensure the ofagent POD goes "not-ready" as expected
246 Wait Until keyword Succeeds ${timeout} 2s
rbodapatfe5bb152025-03-17 11:34:42 +0530247 ... Check Expected Available Deployment Replicas voltha voltha-voltha-go-controller 1
Akash Soni35cafc32023-12-20 12:48:08 +0530248 # Scale up the core deployment and make sure both it and the ofagent deployment are back
249 Scale K8s Deployment voltha voltha-voltha-rw-core 1
250 Wait Until Keyword Succeeds ${timeout} 2s
251 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
252 Wait Until Keyword Succeeds ${timeout} 2s
rbodapatfe5bb152025-03-17 11:34:42 +0530253 ... Check Expected Available Deployment Replicas voltha voltha-voltha-go-controller 1
Akash Soni35cafc32023-12-20 12:48:08 +0530254 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
255 # so restart the port forwarding for the API service
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530256 Restart VOLTHA Port Forward voltha-api 55555:55555
Akash Soni35cafc32023-12-20 12:48:08 +0530257 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
258 # represents system connectivity being restored
259 FOR ${I} IN RANGE 0 ${olt_count}
260 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
261 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
262 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
263 ... ${olt_serial_number}
264 Wait Until Keyword Succeeds 120s 2s Device Is Available In VGC
265 ... ${of_id}
266 END
267
268 FOR ${I} IN RANGE 0 ${num_all_onus}
269 ${src}= Set Variable ${hosts.src[${I}]}
270 ${dst}= Set Variable ${hosts.dst[${I}]}
271 ${of_id}= Get ofID From OLT List ${src['olt']}
272 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
273 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
274 ... Get ONU Port in VGC ${src['onu']} ${of_id} ${src['uni_id']}
275 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
276 Post Request VGC services/${of_id}/${onu_port}
277 # Verify subscriber access flows are added for the ONU port
278 Wait Until Keyword Succeeds ${timeout} 5s
279 ... Verify Subscriber Access Flows Added for ONU DT in VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
280 ... ${onu_port} ${nni_port} ${src['s_tag']}
281 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
282 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
283 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
284 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
285 ... ${dst['container_name']}
286 END
Abhay Kumar107b03b2026-01-30 07:20:08 +0000287 Restart VOLTHA Port Forward voltha-api 55555:55555\
288 ${cmd} Set Variable ps -ef | grep -E "[k]ubectl.*-n[[:space:]]*voltha.*port-forward.*voltha-voltha-api.*55555:55555" | awk '{print $2}' | xargs -r kill -9
289 ${rc} ${pid} Run And Return Rc And Output ${cmd}
290 ${port_fwd} Start Process kubectl -n voltha port-forward svc/${kafka} ${KAFKA_PORT}:${KAFKA_PORT} & shell=true
Akash Soni35cafc32023-12-20 12:48:08 +0530291
292Verify OLT Soft Reboot for DT
293 [Documentation] Test soft reboot of the OLT using voltctl command
294 [Tags] VOL-2818 OLTSoftRebootDt functionalDt raj
295 [Setup] Start Logging OLTSoftRebootDt
296 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
297 ... AND Stop Logging OLTSoftRebootDt
298 FOR ${I} IN RANGE 0 ${olt_count}
299 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
300 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
301 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
302 ... Validate OLT Device ENABLED ACTIVE
303 ... REACHABLE ${olt_serial_number}
304 # Reboot the OLT using "voltctl device reboot" command
Guru Prasanna0ae8e692025-05-02 15:03:40 +0530305 Wait Until Keyword Succeeds 360s 5s Reboot Device ${olt_device_id}
Akash Soni35cafc32023-12-20 12:48:08 +0530306 # Wait for the OLT to actually go down
307 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
308 ... ${olt_serial_number}
309 END
310 #Verify that ping fails
311 FOR ${I} IN RANGE 0 ${num_all_onus}
312 ${src}= Set Variable ${hosts.src[${I}]}
313 ${dst}= Set Variable ${hosts.dst[${I}]}
314 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
315 ... Wait Until Keyword Succeeds ${timeout} 2s
316 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
317 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
318 END
319 # Check OLT states
320 FOR ${I} IN RANGE 0 ${olt_count}
321 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
322 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
323 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
324 # Wait for the OLT to come back up
325 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
326 ... Check Remote System Reachability True ${olt_ssh_ip}
327 # Check OLT states
328 Wait Until Keyword Succeeds 360s 5s
329 ... Validate OLT Device ENABLED ACTIVE
330 ... REACHABLE ${olt_serial_number}
331 END
332 # Waiting extra time for the ONUs to come up
333 Sleep 60s
334 #Check after reboot that ONUs are active, DHCP/pingable
335 Run Keyword If ${has_dataplane} Clean Up Linux
336 Perform Sanity Test DT
337
338Verify restart openonu-adapter container for DT
339 [Documentation] Restart openonu-adapter container after VOLTHA is operational.
340 ... Run the ping continuously in background during container restart,
341 ... and verify that there should be no affect on the dataplane.
342 ... Also, verify that the voltha control plane functionality is not affected.
343 [Tags] functionalDt RestartOpenOnuPingDt raj
344 [Setup] Start Logging RestartOpenOnuPingDt
345 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
346 ... AND Stop Logging RestartOpenOnuPingDt
347 Clear All Devices Then Create New Device
348 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
349 Run Keyword If ${has_dataplane} Clean Up Linux
350 Perform Sanity Test DT
351 FOR ${I} IN RANGE 0 ${num_all_onus}
352 ${src}= Set Variable ${hosts.src[${I}]}
353 ${dst}= Set Variable ${hosts.dst[${I}]}
354 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
355 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
356 ... Wait Until Keyword Succeeds ${timeout} 2s
357 ... Run Ping In Background ${ping_output_file} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
358 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
359 END
360 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
361 Log ${podStatusOutput}
362 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
363 ${podName} Set Variable adapter-open-onu
364 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
365 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
366 ... app ${podName} Running
367 # Wait for 1 min after openonu adapter is restarted
368 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
369 Log ${podStatusOutput}
370 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
371 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
372 FOR ${I} IN RANGE 0 ${num_all_onus}
373 ${src}= Set Variable ${hosts.src[${I}]}
374 ${dst}= Set Variable ${hosts.dst[${I}]}
375 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
376 ... Wait Until Keyword Succeeds ${timeout} 2s
377 ... Stop Ping Running In Background ${src['ip']} ${src['user']} ${src['pass']}
378 ... ${src['container_type']} ${src['container_name']}
379 END
380 FOR ${I} IN RANGE 0 ${num_all_onus}
381 ${src}= Set Variable ${hosts.src[${I}]}
382 ${dst}= Set Variable ${hosts.dst[${I}]}
383 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
384 ${ping_output}= Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
385 ... Wait Until Keyword Succeeds ${timeout} 2s
386 ... Retrieve Remote File Contents ${ping_output_file} ${src['ip']} ${src['user']} ${src['pass']}
387 ... ${src['container_type']} ${src['container_name']}
388 Run Keyword If ${has_dataplane} Check Ping Result True ${ping_output}
389 END
390 # Verify Control Plane Functionality by Deleting and Re-adding the Subscriber
rbodapatfe5bb152025-03-17 11:34:42 +0530391 # "Once the onu adapter is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if the OLT is deleted
392 # before the ONUs are reconiled successfully there would be stale entries. This scenario is not handled in VOLTHA as
393 # of now. And there is no other to check if the reconcile has happened for all the ONUs. Due to this limitations a
394 # sleep of 60s is introduced to give enough time for onu adapter to reconcile the ONUs."
395 Sleep 60s
Akash Soni35cafc32023-12-20 12:48:08 +0530396 Verify Control Plane After Pod Restart DT
397
398Verify restart openolt-adapter container for DT
399 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
400 ... Run the ping continuously in background during container restart,
401 ... and verify that there should be no affect on the dataplane.
402 ... Also, verify that the voltha control plane functionality is not affected.
403 [Tags] functionalDt RestartOpenOltPingDt raj
404 [Setup] Start Logging RestartOpenOltPingDt
405 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
406 ... AND Stop Logging RestartOpenOltPingDt
407 Clear All Devices Then Create New Device
408 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
409 Run Keyword If ${has_dataplane} Clean Up Linux
410 Perform Sanity Test DT
411 FOR ${I} IN RANGE 0 ${num_all_onus}
412 ${src}= Set Variable ${hosts.src[${I}]}
413 ${dst}= Set Variable ${hosts.dst[${I}]}
414 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
415 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
416 ... Wait Until Keyword Succeeds ${timeout} 2s
417 ... Run Ping In Background ${ping_output_file} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
418 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
419 END
420 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
421 Log ${podStatusOutput}
422 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
423 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
424 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
425 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
426 ... app ${podName} Running
427 # Wait for 1 min after openolt adapter is restarted
428 Sleep 60s
429 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
430 Log ${podStatusOutput}
431 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
432 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
433 FOR ${I} IN RANGE 0 ${num_all_onus}
434 ${src}= Set Variable ${hosts.src[${I}]}
435 ${dst}= Set Variable ${hosts.dst[${I}]}
436 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
437 ... Wait Until Keyword Succeeds ${timeout} 2s
438 ... Stop Ping Running In Background ${src['ip']} ${src['user']} ${src['pass']}
439 ... ${src['container_type']} ${src['container_name']}
440 END
441 FOR ${I} IN RANGE 0 ${num_all_onus}
442 ${src}= Set Variable ${hosts.src[${I}]}
443 ${dst}= Set Variable ${hosts.dst[${I}]}
444 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
445 ${ping_output}= Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
446 ... Wait Until Keyword Succeeds ${timeout} 2s
447 ... Retrieve Remote File Contents ${ping_output_file} ${src['ip']} ${src['user']} ${src['pass']}
448 ... ${src['container_type']} ${src['container_name']}
449 Run Keyword If ${has_dataplane} Check Ping Result True ${ping_output}
450 END
451 # Verify Control Plane Functionality by Deleting and Re-adding the Subscriber
rbodapatfe5bb152025-03-17 11:34:42 +0530452 # "Once the olt adapter is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if try to delete OLT
453 # before the OLT's are reconiled successfully there would be recocile error. This scenario is not handled in VOLTHA as
454 # of now. And there is no other to check if the reconcile has happened for all the OLTs. Due to this limitations a
455 # sleep of 60s is introduced to give enough time for OLT adapter to reconcile the OLTs."
456 Sleep 60s
Akash Soni35cafc32023-12-20 12:48:08 +0530457 Verify Control Plane After Pod Restart DT
458
459Verify restart rw-core container for DT
460 [Documentation] Restart rw-core container after VOLTHA is operational.
461 ... Run the ping continuously in background during container restart,
462 ... and verify that there should be no affect on the dataplane.
463 ... Also, verify that the voltha control plane functionality is not affected.
464 [Tags] functionalDt RestartRwCorePingDt raj
465 [Setup] Start Logging RestartRwCorePingDt
466 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
467 ... AND Stop Logging RestartRwCorePingDt
468 Clear All Devices Then Create New Device
469 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
470 Run Keyword If ${has_dataplane} Clean Up Linux
471 Perform Sanity Test DT
472 FOR ${I} IN RANGE 0 ${num_all_onus}
473 ${src}= Set Variable ${hosts.src[${I}]}
474 ${dst}= Set Variable ${hosts.dst[${I}]}
475 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
476 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
477 ... Wait Until Keyword Succeeds ${timeout} 2s
478 ... Run Ping In Background ${ping_output_file} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
479 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
480 END
481 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
482 Log ${podStatusOutput}
483 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
484 ${podName} Set Variable rw-core
485 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
486 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
487 ... app ${podName} Running
488 # Wait for 1 min after rw-core is restarted
489 Sleep 60s
490 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
491 # so restart the port forwarding for the API service
492 Restart VOLTHA Port Forward voltha-api
493 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
494 Log ${podStatusOutput}
495 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
496 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
497 FOR ${I} IN RANGE 0 ${num_all_onus}
498 ${src}= Set Variable ${hosts.src[${I}]}
499 ${dst}= Set Variable ${hosts.dst[${I}]}
500 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
501 ... Wait Until Keyword Succeeds ${timeout} 2s
502 ... Stop Ping Running In Background ${src['ip']} ${src['user']} ${src['pass']}
503 ... ${src['container_type']} ${src['container_name']}
504 END
505 FOR ${I} IN RANGE 0 ${num_all_onus}
506 ${src}= Set Variable ${hosts.src[${I}]}
507 ${dst}= Set Variable ${hosts.dst[${I}]}
508 ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
509 ${ping_output}= Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
510 ... Wait Until Keyword Succeeds ${timeout} 2s
511 ... Retrieve Remote File Contents ${ping_output_file} ${src['ip']} ${src['user']} ${src['pass']}
512 ... ${src['container_type']} ${src['container_name']}
513 Run Keyword If ${has_dataplane} Check Ping Result True ${ping_output}
514 END
515 # Verify Control Plane Functionality by Deleting and Re-adding the Subscriber
rbodapatfe5bb152025-03-17 11:34:42 +0530516 # "Once the rw core is restarted, it takes a bit of time for the OLT's/ONUs to reconcile, if try to delete OLT
517 # before the OLT's are reconiled successfully there would be recocile error. This scenario is not handled in VOLTHA as
518 # of now. And there is no other to check if the reconcile has happened for all the OLTs. Due to this limitations a
519 # sleep of 60s is introduced to give enough time for rw core to reconcile the OLTs."
520 Sleep 60s
Abhay Kumar107b03b2026-01-30 07:20:08 +0000521 ${cmd} Set Variable ps -ef | grep -E "[k]ubectl.*-n[[:space:]]*voltha.*port-forward.*voltha-voltha-api.*55555:55555" | awk '{print $2}' | xargs -r kill -9
522 ${rc} ${pid} Run And Return Rc And Output ${cmd}
523 ${port_fwd} Start Process kubectl -n voltha port-forward svc/${kafka} ${KAFKA_PORT}:${KAFKA_PORT} & shell=true
Akash Soni35cafc32023-12-20 12:48:08 +0530524 Verify Control Plane After Pod Restart DT
525
526*** Keywords ***
527Setup Suite
528 [Documentation] Set up the test suite
529 Common Test Suite Setup
530 #power_switch.robot needs it to support different vendor's power switch
531 ${switch_type}= Get Variable Value ${web_power_switch.type}
532 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
533 # Run Pre-test Setup for Soak Job
534 # Note: As soak requirement, it expects that the devices under test are already created and enabled
535 Run Keyword If '${SOAK_TEST}'=='True' Setup Soak
536
537
538Clear All Devices Then Create New Device
539 [Documentation] Remove any devices from VOLTHA and ONOS
540 # Remove all devices from voltha and nos
541 Delete All Devices and Verify
542 # Execute normal test Setup Keyword
543 Setup
544
545Verify Control Plane After Pod Restart DT
546 [Documentation] Verifies the control plane functionality after the voltha pod restart
547 ... by deleting and re-adding the subscriber
548 FOR ${I} IN RANGE 0 ${num_all_onus}
549 ${src}= Set Variable ${hosts.src[${I}]}
550 ${dst}= Set Variable ${hosts.dst[${I}]}
551 ${of_id}= Get ofID From OLT List ${src['olt']}
552 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
553 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
554 ... Get ONU Port in VGC ${src['onu']} ${of_id} ${src['uni_id']}
555 ${onu_device_id}= Wait Until Keyword Succeeds ${timeout} 2s Get Device ID From SN ${src['onu']}
556 # Remove Subscriber Access
557 Remove Subscriber Access ${of_id} ${onu_port}
558 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
559 ... Wait Until Keyword Succeeds ${timeout} 2s
560 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
561 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
562 # Disable and Re-Enable the ONU (To replicate DT current workflow)
563 # TODO: Delete and Auto-Discovery Add of ONU (not yet supported)
564 Disable Device ${onu_device_id}
565 Wait Until Keyword Succeeds ${timeout} 5s
566 ... Validate Device DISABLED UNKNOWN
567 ... REACHABLE ${src['onu']}
568 Enable Device ${onu_device_id}
569 Wait Until Keyword Succeeds ${timeout} 5s
570 ... Validate Device ENABLED ACTIVE
571 ... REACHABLE ${src['onu']}
572 # Add Subscriber Access
573 Add Subscriber Details ${of_id} ${onu_port}
574 # Verify subscriber access flows are added for the ONU port
575 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
576 ... Verify Subscriber Access Flows Added for ONU DT in VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
577 ... ${onu_port} ${nni_port} ${src['s_tag']}
578 Wait Until Keyword Succeeds ${timeout} 5s
579 ... Validate Device ENABLED ACTIVE
580 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-flows-pushed
581 # Workaround for issue seen in VOL-4489. Keep this workaround until VOL-4489 is fixed.
582 Run Keyword If ${has_dataplane} Reboot XGSPON ONU ${src['olt']} ${src['onu']} omci-flows-pushed
583 # Workaround ends here for issue seen in VOL-4489.
584 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
585 ... Wait Until Keyword Succeeds ${timeout} 2s
586 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
587 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
588 END