blob: 065a4039766d05774ed26a794fcb00a26540f63e [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)
94 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
95 ... ${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
101 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
102 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
103 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
104 ... 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
TorstenThieme136ebf72021-02-26 14:27:07 +0000170Verify restart openonu-adapter container after subscriber provisioning for TT
171 [Documentation] Restart openonu-adapter container after VOLTHA is operational.
172 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass04896f62021-03-05 16:15:11 +0530173 [Tags] functionalTT Restart-OpenOnu-TT
TorstenThieme136ebf72021-02-26 14:27:07 +0000174 [Setup] Start Logging Restart-OpenOnu-TT
175 [Teardown] Run Keywords Collect Logs
176 ... AND Stop Logging Restart-OpenOnu-TT
177 ... AND Delete All Devices and Verify
178 # Add OLT device
179 Setup
180 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
181 Run Keyword If ${has_dataplane} Clean Up Linux
182 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
183 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
184 Log ${podStatusOutput}
185 ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
186 ${podName} Set Variable adapter-open-onu
187 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
188 Sleep 5s
189 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
190 ... app ${podName} Running
191 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
192 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
193 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
194 Log ${podStatusOutput}
195 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
196 Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
197 Log to console Pod ${podName} restarted and sanity checks passed successfully
198
Hardik Windlassd3f63892021-03-25 08:28:02 +0000199Verify restart openolt-adapter container after subscriber provisioning for TT
200 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
201 [Tags] functionalTT Restart-OpenOlt-TT
202 [Setup] Start Logging Restart-OpenOlt-TT
203 [Teardown] Run Keywords Collect Logs
204 ... AND Stop Logging Restart-OpenOlt-TT
205 Setup
206 Run Keyword If ${has_dataplane} Clean Up Linux
207 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
208 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
209 Log ${podStatusOutput}
210 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
211 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
212 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
213 Sleep 5s
214 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
215 ... app ${podName} Running
216 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
217 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
218 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
219 Log ${podStatusOutput}
220 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
221 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
222 Log to console Pod ${podName} restarted and sanity checks passed successfully
223
224Verify restart ofagent container after subscriber is provisioned for TT
225 [Documentation] Restart ofagent container after VOLTHA is operational.
226 [Tags] functionalTT ofagentRestart-TT notready
227 [Setup] Start Logging ofagentRestart-TT
228 [Teardown] Run Keywords Collect Logs
229 ... AND Stop Logging ofagentRestart-TT
230 ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
231 # set timeout value
232 ${waitforRestart} Set Variable 120s
233 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
234 Log ${podStatusOutput}
235 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
236 ${podName} Set Variable ofagent
237 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
238 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
239 ... app ${podName} Running
240 Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName}
241 Run Keyword If ${has_dataplane} Clean Up Linux
242 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
243 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
244 Log ${podStatusOutput}
245 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
246 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
247 # Scale Down the Of-Agent Deployment
248 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0
249 Sleep 30s
250 FOR ${I} IN RANGE 0 ${num_all_onus}
251 ${src}= Set Variable ${hosts.src[${I}]}
252 ${dst}= Set Variable ${hosts.dst[${I}]}
253 ${of_id}= Get ofID From OLT List ${src['olt']}
254 ${onu_device_id}= Get Device ID From SN ${src['onu']}
255 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
256 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
257 # Verify ONU state in voltha
258 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
259 ... ENABLED ACTIVE REACHABLE
260 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
261 # Check ONU port is Disabled in ONOS
262 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
263 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
264 # Verify Ping
265 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
266 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
267 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
268 END
269 # Scale Up the Of-Agent Deployment
270 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
271 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
272 ... Running
273 Run Keyword If ${has_dataplane} Clean Up Linux
274 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber}
275 Log to console Pod ${podName} restarted and sanity checks passed successfully
276
277Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for TT
278 [Documentation] Deploys an device instance. After that rw-core deployment is scaled to 0 instances to
279 ... simulate a POD crash. The test then scales the rw-core back to a single instance
280 ... and configures ONOS for access. The test succeeds if the device is able to
281 ... complete the DHCP sequence.
Hardik Windlass3e3c9942021-04-09 11:37:15 +0000282 [Tags] functionalTT rwcore-restart-TT
Hardik Windlassd3f63892021-03-25 08:28:02 +0000283 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-TT
284 ... AND Clear All Devices Then Create New Device
285 [Teardown] Run Keywords Collect Logs
286 ... AND Stop Logging RwCoreFailAndRestart-TT
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 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
292 ... ${olt_serial_number}
293 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
294 ... Get NNI Port in ONOS ${of_id}
295 END
296 FOR ${I} IN RANGE 0 ${num_all_onus}
297 ${src}= Set Variable ${hosts.src[${I}]}
298 ${dst}= Set Variable ${hosts.dst[${I}]}
299 ${of_id}= Get ofID From OLT List ${src['olt']}
300 ${onu_device_id}= Get Device ID From SN ${src['onu']}
301 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
302 ... ${of_id}
303 # Bring up the device and verify it authenticates
304 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
305 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded
306 END
307
308 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
309 Scale K8s Deployment voltha voltha-voltha-rw-core 0
310 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
311 # Ensure the ofagent POD goes "not-ready" as expected
312 Wait Until keyword Succeeds ${timeout} 2s
313 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0
314 # Scale up the core deployment and make sure both it and the ofagent deployment are back
315 Scale K8s Deployment voltha voltha-voltha-rw-core 1
316 Wait Until Keyword Succeeds ${timeout} 2s
317 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
318 Wait Until Keyword Succeeds ${timeout} 2s
319 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1
320 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
321 # so restart the port forwarding for the API service
322 Restart VOLTHA Port Forward voltha-api
323 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
324 # represents system connectivity being restored
325 FOR ${I} IN RANGE 0 ${olt_count}
326 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
327 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
328 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
329 ... ${olt_serial_number}
330 Wait Until Keyword Succeeds 120s 2s Device Is Available In ONOS
331 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
332 END
Hardik Windlass3e3c9942021-04-09 11:37:15 +0000333 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
TorstenThieme136ebf72021-02-26 14:27:07 +0000334
335*** Keywords ***
336Setup Suite
337 [Documentation] Set up the test suite
338 Common Test Suite Setup
339 ${switch_type}= Get Variable Value ${web_power_switch.type}
340 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
341
TorstenThieme136ebf72021-02-26 14:27:07 +0000342Teardown Suite
343 [Documentation] Tear down steps for the suite
344 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass04896f62021-03-05 16:15:11 +0530345 Run Keyword If ${teardown_device} Delete All Devices and Verify
Hardik Windlassd3f63892021-03-25 08:28:02 +0000346
347Clear All Devices Then Create New Device
348 [Documentation] Remove any devices from VOLTHA and ONOS & then Create new devices
349 # Remove all devices from voltha and onos
350 Delete All Devices and Verify
351 # Execute normal test Setup Keyword
352 Setup