blob: 0c87b303e2efb2f5f110aa87219669b4191af5f7 [file] [log] [blame]
TorstenThieme136ebf72021-02-26 14:27:07 +00001# Copyright 2021 - 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 ***
17Documentation Test various functional end-to-end scenarios for TT workflow
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/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
34Resource ../../libraries/power_switch.robot
35
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
41${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
42${HELM_CHARTS_DIR} ~/helm-charts
43${VOLTHA_POD_NUM} 8
44${NAMESPACE} voltha
45# For below variable value, using deployment name as using grep for
46# parsing radius pod name, we can also use full radius pod name
47${RESTART_POD_NAME} radius
48${timeout} 60s
49${of_id} 0
50${logical_id} 0
51${has_dataplane} True
Hardik Windlass04896f62021-03-05 16:15:11 +053052${teardown_device} True
TorstenThieme136ebf72021-02-26 14:27:07 +000053${scripts} ../../scripts
54
55# Per-test logging on failure is turned off by default; set this variable to enable
56${container_log_dir} ${None}
57
58${suppressaddsubscriber} True
59
60*** Test Cases ***
Hardik Windlass364ec452021-04-14 07:12:28 +000061Verify ONU after Rebooting Physically for TT
62 [Documentation] Test the ONU functionality by physically turning on/off ONU.
63 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTT test was executed)
64 ... Test case runs only on the PODs that are configured with PowerSwitch that
65 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
66 [Tags] functionalTT PowerSwitchOnuRebootTT PowerSwitch
67 [Setup] Start Logging RebootOnu_PowerSwitch_TT
68 [Teardown] Run Keywords Collect Logs
69 ... AND Stop Logging RebootOnu_PowerSwitch_TT
70 ... AND Delete All Devices and Verify
71 # Add OLT device
72 Setup
73 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
74 Run Keyword If ${has_dataplane} Clean Up Linux
75 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
76 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
77 Run Keyword If ${has_dataplane} Clean Up Linux
78 FOR ${I} IN RANGE 0 ${num_all_onus}
79 ${src}= Set Variable ${hosts.src[${I}]}
80 ${dst}= Set Variable ${hosts.dst[${I}]}
81 ${service_type}= Get Variable Value ${src['service_type']} "null"
82 ${of_id}= Get ofID From OLT List ${src['olt']}
83 ${onu_device_id}= Get Device ID From SN ${src['onu']}
84 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
85 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
86 # Disable Power Switch
87 Disable Switch Outlet ${src['power_switch_port']}
88 # TODO: Add verification for MCAST
89 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
90 ... Wait Until Keyword Succeeds 60s 2s
91 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
92 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
93 # Remove Subscriber Access (To replicate TT workflow)
TorstenThieme4e2168e2021-06-22 14:01:47 +000094 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Hardik Windlass364ec452021-04-14 07:12:28 +000095 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
96 Sleep 5s
97 # Enable Power Switch
98 Enable Switch Outlet ${src['power_switch_port']}
99 # Check ONU port is Enabled in ONOS
100 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000101 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass364ec452021-04-14 07:12:28 +0000102 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme4e2168e2021-06-22 14:01:47 +0000103 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlass364ec452021-04-14 07:12:28 +0000104 ... volt-add-subscriber-access ${of_id} ${onu_port}
105 # Verify ONU state in voltha
106 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
107 ... ENABLED ACTIVE REACHABLE
108 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
109 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
110 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
111 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
112 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
113 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
114 ... ${dst['container_name']}
115 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
116 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
117 ... ${dst} ${suppressaddsubscriber}
118 END
119
120Verify OLT after Rebooting Physically for TT
121 [Documentation] Test the physical reboot of the OLT
122 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTT test was executed)
123 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
124 [Tags] functionalTT PhysicalOltRebootTT
125 [Setup] Start Logging RebootOlt_Physical_TT
126 [Teardown] Run Keywords Collect Logs
127 ... AND Stop Logging RebootOlt_Physical_TT
128 ... AND Delete All Devices and Verify
129 # Add OLT device
130 Setup
131 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
132 Run Keyword If ${has_dataplane} Clean Up Linux
133 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
134 # Reboot the OLT from the OLT CLI
135 FOR ${I} IN RANGE 0 ${olt_count}
136 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
137 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
138 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
139 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
140 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
141 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
142 ... reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
143 END
144 FOR ${I} IN RANGE 0 ${num_all_onus}
145 ${src}= Set Variable ${hosts.src[${I}]}
146 ${dst}= Set Variable ${hosts.dst[${I}]}
147 ${service_type}= Get Variable Value ${src['service_type']} "null"
148 # TODO: Add verification for MCAST
149 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
150 ... Wait Until Keyword Succeeds 60s 2s
151 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
152 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
153 END
154 # Wait for the OLT to come back up
155 FOR ${I} IN RANGE 0 ${olt_count}
156 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
157 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
158 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
159 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
160 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
161 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
162 ... Check Remote System Reachability True ${olt_ssh_ip}
163 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
164 ... Validate OLT Device ENABLED ACTIVE
165 ... REACHABLE ${olt_serial_number}
166 END
167 Run Keyword If ${has_dataplane} Clean Up Linux
168 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
169
Hardik Windlass8a8d81c2021-04-22 15:33:42 +0000170Verify ONU Soft Reboot for TT
171 [Documentation] Test the ONU Soft Reboot functionality.
172 [Tags] functionalTT OnuSoftRebootTT
173 [Setup] Start Logging SoftRebootOnu_TT
174 [Teardown] Run Keywords Collect Logs
175 ... AND Stop Logging SoftRebootOnu_TT
176 ... AND Delete All Devices and Verify
177 # Add OLT device
178 Setup
179 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
180 Run Keyword If ${has_dataplane} Clean Up Linux
181 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
182 FOR ${I} IN RANGE 0 ${num_all_onus}
183 ${src}= Set Variable ${hosts.src[${I}]}
184 ${dst}= Set Variable ${hosts.dst[${I}]}
185 ${service_type}= Get Variable Value ${src['service_type']} "null"
186 ${of_id}= Get ofID From OLT List ${src['olt']}
187 ${onu_device_id}= Get Device ID From SN ${src['onu']}
188 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
189 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
190 Reboot Device ${onu_device_id}
191 # TODO: Add verification for MCAST
192 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
193 ... Wait Until Keyword Succeeds ${timeout} 2s
194 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
195 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
196 # Remove Subscriber Access (To replicate TT workflow)
TorstenThieme4e2168e2021-06-22 14:01:47 +0000197 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Hardik Windlass8a8d81c2021-04-22 15:33:42 +0000198 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
199 # Check ONU port is Enabled in ONOS
200 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000201 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass8a8d81c2021-04-22 15:33:42 +0000202 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme4e2168e2021-06-22 14:01:47 +0000203 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlass8a8d81c2021-04-22 15:33:42 +0000204 ... volt-add-subscriber-access ${of_id} ${onu_port}
205 # Verify ONU state in voltha
206 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
207 ... ENABLED ACTIVE REACHABLE
208 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
209 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
210 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
211 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
212 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
213 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
214 ... ${dst['container_name']}
215 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
216 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
217 ... ${dst} ${suppressaddsubscriber}
218 END
219 Run Keyword If ${has_dataplane} Clean Up Linux
220 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
221
Hardik Windlass656661a2021-04-23 03:46:31 +0000222Verify OLT Soft Reboot for TT
223 [Documentation] Test the OLT Soft Reboot functionality.
224 [Tags] functionalTT OltSoftRebootTT
225 [Setup] Start Logging SoftRebootOlt_TT
226 [Teardown] Run Keywords Collect Logs
227 ... AND Stop Logging SoftRebootOlt_TT
228 ... AND Delete All Devices and Verify
229 # Add OLT device
230 Setup
231 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
232 Run Keyword If ${has_dataplane} Clean Up Linux
233 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
234 # Reboot the OLT from the OLT CLI
235 FOR ${I} IN RANGE 0 ${olt_count}
236 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
237 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
238 # Reboot the OLT using "voltctl device reboot" command
239 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +0200240 # Wait for the OLT to actually go down
241 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
242 ... ${olt_serial_number}
Hardik Windlass656661a2021-04-23 03:46:31 +0000243 END
244 FOR ${I} IN RANGE 0 ${num_all_onus}
245 ${src}= Set Variable ${hosts.src[${I}]}
246 ${dst}= Set Variable ${hosts.dst[${I}]}
247 ${service_type}= Get Variable Value ${src['service_type']} "null"
248 # TODO: Add verification for MCAST
249 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
250 ... Wait Until Keyword Succeeds ${timeout} 2s
251 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
252 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
253 END
254 # Wait for the OLT to come back up
255 FOR ${I} IN RANGE 0 ${olt_count}
256 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
257 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
258 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
259 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
260 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
261 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
262 ... Check Remote System Reachability True ${olt_ssh_ip}
263 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
264 ... Validate OLT Device ENABLED ACTIVE
265 ... REACHABLE ${olt_serial_number}
266 END
267 Run Keyword If ${has_dataplane} Clean Up Linux
268 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
269
TorstenThieme136ebf72021-02-26 14:27:07 +0000270Verify restart openonu-adapter container after subscriber provisioning for TT
271 [Documentation] Restart openonu-adapter container after VOLTHA is operational.
272 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass04896f62021-03-05 16:15:11 +0530273 [Tags] functionalTT Restart-OpenOnu-TT
TorstenThieme136ebf72021-02-26 14:27:07 +0000274 [Setup] Start Logging Restart-OpenOnu-TT
275 [Teardown] Run Keywords Collect Logs
276 ... AND Stop Logging Restart-OpenOnu-TT
277 ... AND Delete All Devices and Verify
278 # Add OLT device
279 Setup
280 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
281 Run Keyword If ${has_dataplane} Clean Up Linux
282 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
283 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
284 Log ${podStatusOutput}
285 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
286 ${podName} Set Variable adapter-open-onu
287 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
288 Sleep 5s
289 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
290 ... app ${podName} Running
291 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
292 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
293 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
294 Log ${podStatusOutput}
295 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
296 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
297 Log to console Pod ${podName} restarted and sanity checks passed successfully
298
Emrehan UZUN2884ed52021-05-04 15:36:31 +0000299Verify restart openolt-adapter container before subscriber provisioning for TT
300 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
301 [Tags] functionalTT Restart-OpenOlt-Before-Subscription-TT
302 [Setup] Start Logging Restart-OpenOlt-Before-Subscription-TT
303 [Teardown] Run Keywords Collect Logs
304 ... AND Stop Logging Restart-OpenOlt-Before-Subscription-TT
305 ... AND Delete All Devices and Verify
306 # Add OLT device
307 Setup
308 Run Keyword If ${has_dataplane} Clean Up Linux
309 FOR ${I} IN RANGE 0 ${olt_count}
310 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
311 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
312 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
313 ... ${olt_serial_number}
314 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
315 ... Get NNI Port in ONOS ${of_id}
316 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
317 ... Verify Default Downstream Flows are added in ONOS for OLT TT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
318 ... ${nni_port}
319 END
320 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
321 Log ${podStatusOutput}
322 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
323 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
324 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
325 Sleep 5s
326 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
327 ... app ${podName} Running
328 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
329 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
330 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
331 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
332 Log to console Pod ${podName} restarted and sanity checks passed successfully
333
Hardik Windlassd3f63892021-03-25 08:28:02 +0000334Verify restart openolt-adapter container after subscriber provisioning for TT
335 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
336 [Tags] functionalTT Restart-OpenOlt-TT
337 [Setup] Start Logging Restart-OpenOlt-TT
338 [Teardown] Run Keywords Collect Logs
339 ... AND Stop Logging Restart-OpenOlt-TT
340 Setup
341 Run Keyword If ${has_dataplane} Clean Up Linux
342 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
343 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
344 Log ${podStatusOutput}
345 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
346 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
347 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
348 Sleep 5s
349 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
350 ... app ${podName} Running
351 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
352 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
353 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
354 Log ${podStatusOutput}
355 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
356 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
357 Log to console Pod ${podName} restarted and sanity checks passed successfully
358
359Verify restart ofagent container after subscriber is provisioned for TT
360 [Documentation] Restart ofagent container after VOLTHA is operational.
Hardik Windlassa9ec90d2021-05-27 11:33:22 +0000361 [Tags] functionalTT ofagentRestart-TT
Hardik Windlassd3f63892021-03-25 08:28:02 +0000362 [Setup] Start Logging ofagentRestart-TT
363 [Teardown] Run Keywords Collect Logs
364 ... AND Stop Logging ofagentRestart-TT
365 ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
366 # set timeout value
367 ${waitforRestart} Set Variable 120s
368 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
369 Log ${podStatusOutput}
370 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
371 ${podName} Set Variable ofagent
372 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
373 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
374 ... app ${podName} Running
375 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
376 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlassa9ec90d2021-05-27 11:33:22 +0000377 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT ${suppressaddsubscriber}
Hardik Windlassd3f63892021-03-25 08:28:02 +0000378 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
379 Log ${podStatusOutput}
380 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
381 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
382 # Scale Down the Of-Agent Deployment
383 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0
384 Sleep 30s
385 FOR ${I} IN RANGE 0 ${num_all_onus}
386 ${src}= Set Variable ${hosts.src[${I}]}
387 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlassa9ec90d2021-05-27 11:33:22 +0000388 ${service_type}= Get Variable Value ${src['service_type']} "null"
Hardik Windlassd3f63892021-03-25 08:28:02 +0000389 ${of_id}= Get ofID From OLT List ${src['olt']}
390 ${onu_device_id}= Get Device ID From SN ${src['onu']}
391 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
392 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
393 # Verify ONU state in voltha
394 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
395 ... ENABLED ACTIVE REACHABLE
396 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
397 # Check ONU port is Disabled in ONOS
398 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000399 ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassd3f63892021-03-25 08:28:02 +0000400 # Verify Ping
Hardik Windlassa9ec90d2021-05-27 11:33:22 +0000401 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
402 ... Run Keyword And Continue On Failure Check Ping True
Hardik Windlassd3f63892021-03-25 08:28:02 +0000403 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
404 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
405 END
406 # Scale Up the Of-Agent Deployment
407 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
408 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
409 ... Running
410 Run Keyword If ${has_dataplane} Clean Up Linux
411 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
412 Log to console Pod ${podName} restarted and sanity checks passed successfully
413
414Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for TT
415 [Documentation] Deploys an device instance. After that rw-core deployment is scaled to 0 instances to
416 ... simulate a POD crash. The test then scales the rw-core back to a single instance
417 ... and configures ONOS for access. The test succeeds if the device is able to
418 ... complete the DHCP sequence.
Hardik Windlass3e3c9942021-04-09 11:37:15 +0000419 [Tags] functionalTT rwcore-restart-TT
Hardik Windlassd3f63892021-03-25 08:28:02 +0000420 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-TT
421 ... AND Clear All Devices Then Create New Device
422 [Teardown] Run Keywords Collect Logs
423 ... AND Stop Logging RwCoreFailAndRestart-TT
424 Run Keyword If ${has_dataplane} Clean Up Linux
425 FOR ${I} IN RANGE 0 ${olt_count}
426 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
427 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
428 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
429 ... ${olt_serial_number}
430 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
431 ... Get NNI Port in ONOS ${of_id}
432 END
433 FOR ${I} IN RANGE 0 ${num_all_onus}
434 ${src}= Set Variable ${hosts.src[${I}]}
435 ${dst}= Set Variable ${hosts.dst[${I}]}
436 ${of_id}= Get ofID From OLT List ${src['olt']}
437 ${onu_device_id}= Get Device ID From SN ${src['onu']}
438 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
439 ... ${of_id}
440 # Bring up the device and verify it authenticates
441 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass8b446492021-06-10 06:25:23 +0000442 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded by_dev_id=True
Hardik Windlassd3f63892021-03-25 08:28:02 +0000443 END
444
445 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
446 Scale K8s Deployment voltha voltha-voltha-rw-core 0
447 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
448 # Ensure the ofagent POD goes "not-ready" as expected
449 Wait Until keyword Succeeds ${timeout} 2s
450 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0
451 # Scale up the core deployment and make sure both it and the ofagent deployment are back
452 Scale K8s Deployment voltha voltha-voltha-rw-core 1
453 Wait Until Keyword Succeeds ${timeout} 2s
454 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
455 Wait Until Keyword Succeeds ${timeout} 2s
456 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1
457 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
458 # so restart the port forwarding for the API service
459 Restart VOLTHA Port Forward voltha-api
460 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
461 # represents system connectivity being restored
462 FOR ${I} IN RANGE 0 ${olt_count}
463 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
464 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
465 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
466 ... ${olt_serial_number}
467 Wait Until Keyword Succeeds 120s 2s Device Is Available In ONOS
468 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
469 END
Hardik Windlass3e3c9942021-04-09 11:37:15 +0000470 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
TorstenThieme136ebf72021-02-26 14:27:07 +0000471
472*** Keywords ***
473Setup Suite
474 [Documentation] Set up the test suite
475 Common Test Suite Setup
476 ${switch_type}= Get Variable Value ${web_power_switch.type}
477 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
478
TorstenThieme136ebf72021-02-26 14:27:07 +0000479Teardown Suite
480 [Documentation] Tear down steps for the suite
481 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass04896f62021-03-05 16:15:11 +0530482 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000483 Close All ONOS SSH Connections
Hardik Windlassd3f63892021-03-25 08:28:02 +0000484
485Clear All Devices Then Create New Device
486 [Documentation] Remove any devices from VOLTHA and ONOS & then Create new devices
487 # Remove all devices from voltha and onos
488 Delete All Devices and Verify
489 # Execute normal test Setup Keyword
490 Setup