blob: 877fe87d82b42af14d21fad0f44ce2c12813227f [file] [log] [blame]
Hardik Windlassb9bdd502020-04-17 14:46:21 +05301# Copyright 2017 - 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 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/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
Andrea Campanella15619c72020-04-30 09:48:04 +020034Resource ../../libraries/power_switch.robot
Hardik Windlassb9bdd502020-04-17 14:46:21 +053035
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
52${teardown_device} False
53${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*** Test Cases ***
59Verify ONU after Rebooting Physically for DT
60 [Documentation] Test the ONU functionality by physically turning on/off ONU.
61 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
62 ... Test case runs only on the PODs that are configured with PowerSwitch that
63 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
64 [Tags] functionalDt PowerSwitchOnuRebootDt VOL-2819 PowerSwitch
Hardik Windlass9df139e2020-04-24 14:54:54 +053065 [Setup] Start Logging RebootOnu_PowerSwitch_Dt
Hardik Windlassb9bdd502020-04-17 14:46:21 +053066 [Teardown] Run Keywords Collect Logs
67 ... AND Stop Logging RebootOnu_PowerSwitch_Dt
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080068 ... AND Delete All Devices and Verify
Hardik Windlassb9bdd502020-04-17 14:46:21 +053069 # Add OLT device
70 Setup
71 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
72 Run Keyword If ${has_dataplane} Clean Up Linux
73 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
74 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
Hardik Windlass2eb47182020-05-19 20:24:12 +053075 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080076 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassb9bdd502020-04-17 14:46:21 +053077 ${src}= Set Variable ${hosts.src[${I}]}
78 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080079 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlass0560f802020-05-06 23:06:53 +053080 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +053081 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
82 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Hardik Windlass7c801e62020-05-04 19:33:21 +053083 # Disable Power Switch
Hardik Windlassb9bdd502020-04-17 14:46:21 +053084 Disable Switch Outlet ${src['power_switch_port']}
85 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
86 ... Wait Until Keyword Succeeds 60s 2s
87 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
88 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlass7c801e62020-05-04 19:33:21 +053089 # Remove Subscriber Access (To replicate DT workflow)
90 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
91 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri1b8d7b82020-05-29 21:10:12 -070092 Sleep 10s
Hardik Windlass7c801e62020-05-04 19:33:21 +053093 # Delete ONU Device (To replicate DT workflow)
94 Delete Device ${onu_device_id}
95 Sleep 5s
96 # Enable Power Switch
Hardik Windlassb9bdd502020-04-17 14:46:21 +053097 Enable Switch Outlet ${src['power_switch_port']}
Hardik Windlass40ccffb2020-05-11 14:12:07 +053098 # Waiting extra time for the ONU to come up
99 Sleep 60s
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530100 # Check ONU port is Enabled in ONOS
101 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700102 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass7c801e62020-05-04 19:33:21 +0530103 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
104 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
105 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530106 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700107 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530108 ... ENABLED ACTIVE REACHABLE
Hardik Windlass7c801e62020-05-04 19:33:21 +0530109 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530110 # Verify subscriber access flows are added for the ONU port
111 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
112 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
113 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlass2eb47182020-05-19 20:24:12 +0530114 #Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass7c801e62020-05-04 19:33:21 +0530115 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
116 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530117 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlass7c801e62020-05-04 19:33:21 +0530118 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
119 ... ${dst['container_name']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530120 Run Keyword And Ignore Error Collect Logs
121 END
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800122 # Verify flows for all OLTs
123 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate All OLT Flows
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530124
125Verify OLT after Rebooting Physically for DT
126 [Documentation] Test the physical reboot of the OLT
127 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
128 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
129 [Tags] functionalDt PhysicalOltRebootDt VOL-2817
Hardik Windlass9df139e2020-04-24 14:54:54 +0530130 [Setup] Start Logging RebootOlt_Physical_Dt
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530131 [Teardown] Run Keywords Collect Logs
132 ... AND Stop Logging RebootOlt_Physical_Dt
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800133 ... AND Delete All Devices and Verify
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530134 # Add OLT device
135 Setup
136 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
137 Run Keyword If ${has_dataplane} Clean Up Linux
138 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
139 # Reboot the OLT from the OLT CLI
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800140 FOR ${I} IN RANGE 0 ${olt_count}
141 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
142 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
143 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
144 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
145 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
146 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
147 ... sudo reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
148 Run Keyword And Ignore Error Collect Logs
149 END
150 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530151 ${src}= Set Variable ${hosts.src[${I}]}
152 ${dst}= Set Variable ${hosts.dst[${I}]}
153 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
154 ... Wait Until Keyword Succeeds 60s 2s
155 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
156 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
157 END
158 # Wait for the OLT to come back up
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800159 FOR ${I} IN RANGE 0 ${olt_count}
160 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
161 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
162 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
163 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
164 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
165 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
166 ... Check Remote System Reachability True ${olt_ssh_ip}
167 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
168 ... Validate OLT Device ENABLED ACTIVE
169 ... REACHABLE ${olt_serial_number}
170 END
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530171 # Waiting extra time for the ONUs to come up
172 Sleep 60s
173 Run Keyword And Ignore Error Collect Logs
174 Run Keyword If ${has_dataplane} Clean Up Linux
175 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
176
Hardik Windlass9df139e2020-04-24 14:54:54 +0530177Verify restart openolt-adapter container after subscriber provisioning for DT
178 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
179 ... Prerequisite : ONUs are authenticated and pingable.
180 [Tags] functionalDt Restart-OpenOlt-Dt
181 [Setup] Start Logging Restart-OpenOlt-Dt
182 [Teardown] Run Keywords Collect Logs
183 ... AND Stop Logging Restart-OpenOlt-Dt
184 # Add OLT device
185 setup
186 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
187 Run Keyword If ${has_dataplane} Clean Up Linux
188 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
189 ${waitforRestart} Set Variable 120s
190 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
191 Log ${podStatusOutput}
192 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Andrea Campanella3dcce272021-01-15 16:04:47 +0100193 ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530194 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
195 Sleep 5s
196 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
197 ... app ${podName} Running
Hardik Windlass9df139e2020-04-24 14:54:54 +0530198 # Wait for 1min after openolt adapter is restarted
199 Sleep 60s
200 Run Keyword If ${has_dataplane} Clean Up Linux
201 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
202 Run Keyword and Ignore Error Collect Logs
203 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
204 Log ${podStatusOutput}
205 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
206 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
207 Log to console Pod ${podName} restarted and sanity checks passed successfully
208
209Verify openolt adapter restart before subscriber provisioning for DT
210 [Documentation] Deploys an device instance and waits for it to authenticate. After
211 ... authentication is successful the rw-core deployment is scaled to 0 instances to
212 ... simulate a POD crash. The test then scales the rw-core back to a single instance
213 ... and configures ONOS for access. The test succeeds if the device is able to
214 ... complete the DHCP sequence.
215 [Tags] functionalDt olt-adapter-restart-Dt
216 [Setup] Start Logging OltAdapterRestart-Dt
217 #... AND Clear All Devices Then Create New Device
218 [Teardown] Run Keywords Collect Logs
219 ... AND Stop Logging OltAdapterRestart-Dt
220 # Add OLT and perform sanity test
221 #setup
222 Run Keyword If ${has_dataplane} Clean Up Linux
223 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
224 Set Global Variable ${of_id}
225
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800226 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530227 ${src}= Set Variable ${hosts.src[${I}]}
228 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800229 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530230 ${onu_device_id}= Get Device ID From SN ${src['onu']}
231 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
232 ... ${of_id}
233 # Bring up the device and verify it authenticates
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700234 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass9df139e2020-04-24 14:54:54 +0530235 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
236 END
237 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
Andrea Campanella3dcce272021-01-15 16:04:47 +0100238 Scale K8s Deployment by Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 0
239 Wait Until Keyword Succeeds ${timeout} 2s Pods Do Not Exist By Label ${NAMESPACE} app
240 ... ${OLT_ADAPTER_APP_LABEL}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530241 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
Andrea Campanella3dcce272021-01-15 16:04:47 +0100242 Scale K8s Deployment by Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530243 Wait Until Keyword Succeeds ${timeout} 2s
Andrea Campanella3dcce272021-01-15 16:04:47 +0100244 ... Check Expected Available Deployment Replicas By Pod Label ${NAMESPACE} app ${OLT_ADAPTER_APP_LABEL} 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530245
246 # Ensure the device is available in ONOS, this represents system connectivity being restored
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800247 FOR ${I} IN RANGE 0 ${olt_count}
248 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
249 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
250 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
251 ... ${olt_serial_number}
252 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
253 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
254 END
Hardik Windlass9df139e2020-04-24 14:54:54 +0530255
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800256 FOR ${I} IN RANGE 0 ${num_all_onus}
257 ${src}= Set Variable ${hosts.src[${I}]}
258 ${dst}= Set Variable ${hosts.dst[${I}]}
259 ${of_id}= Get ofID From OLT List ${src['olt']}
260 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
261 ... ${of_id}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530262 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
263 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
264 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
265 # Verify subscriber access flows are added for the ONU port
266 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
267 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
268 ... ${onu_port} ${nni_port} ${src['s_tag']}
269 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
270 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
271 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
272 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
273 ... ${dst['container_name']}
274 END
275
276Verify restart ofagent container after subscriber is provisioned for DT
277 [Documentation] Restart ofagent container after VOLTHA is operational.
278 ... Prerequisite : ONUs are authenticated and pingable.
279 [Tags] functionalDt ofagentRestart-Dt
280 [Setup] Start Logging ofagentRestart-Dt
281 [Teardown] Run Keywords Collect Logs
282 ... AND Stop Logging ofagentRestart-Dt
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530283 ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530284 # set timeout value
285 ${waitforRestart} Set Variable 120s
286 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
287 Log ${podStatusOutput}
288 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
289 ${podName} Set Variable ofagent
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530290 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530291 Sleep 60s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530292 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
293 ... app ${podName} Running
Hardik Windlass9df139e2020-04-24 14:54:54 +0530294 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
295 Run Keyword If ${has_dataplane} Clean Up Linux
296 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
297 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
298 Log ${podStatusOutput}
299 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
300 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
301 # Scale Down the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530302 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530303 Sleep 30s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800304 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530305 ${src}= Set Variable ${hosts.src[${I}]}
306 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800307 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530308 Run Keyword and Ignore Error Collect Logs
309 ${onu_device_id}= Get Device ID From SN ${src['onu']}
310 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
311 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
312 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700313 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hardik Windlass9df139e2020-04-24 14:54:54 +0530314 ... ENABLED ACTIVE REACHABLE
315 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
316 # Check ONU port is Disabled in ONOS
317 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700318 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530319 # Verify subscriber access flows are added for the ONU port
320 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
321 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
322 ... ${onu_port} ${nni_port} ${src['s_tag']}
323 # Verify Ping
324 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
325 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
326 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
327 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
328 Run Keyword and Ignore Error Collect Logs
329 END
330 # Scale Up the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530331 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530332 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
333 ... Running
334 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
335 Run Keyword If ${has_dataplane} Clean Up Linux
336 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
337 Log to console Pod ${podName} restarted and sanity checks passed successfully
338
339Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for DT
340 [Documentation] Deploys an device instance and waits for it to authenticate. After
341 ... authentication is successful the rw-core deployment is scaled to 0 instances to
342 ... simulate a POD crash. The test then scales the rw-core back to a single instance
343 ... and configures ONOS for access. The test succeeds if the device is able to
344 ... complete the DHCP sequence.
345 [Tags] functionalDt rwcore-restart-Dt
346 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-Dt
347 ... AND Clear All Devices Then Create New Device
348 [Teardown] Run Keywords Collect Logs
349 ... AND Stop Logging RwCoreFailAndRestart-Dt
350 #... AND Delete Device and Verify
351 Run Keyword and Ignore Error Collect Logs
352 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800353 FOR ${I} IN RANGE 0 ${olt_count}
354 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
355 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
356 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
357 ... ${olt_serial_number}
358 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
359 ... Get NNI Port in ONOS ${of_id}
360 # Set Global Variable ${nni_port}
361 END
362 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530363 ${src}= Set Variable ${hosts.src[${I}]}
364 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800365 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530366 ${onu_device_id}= Get Device ID From SN ${src['onu']}
367 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
368 ... ${of_id}
369 # Bring up the device and verify it authenticates
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700370 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass9df139e2020-04-24 14:54:54 +0530371 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded
372 END
373
374 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530375 Scale K8s Deployment voltha voltha-voltha-rw-core 0
376 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
Hardik Windlass9df139e2020-04-24 14:54:54 +0530377 # Ensure the ofagent POD goes "not-ready" as expected
378 Wait Until keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530379 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530380 # Scale up the core deployment and make sure both it and the ofagent deployment are back
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530381 Scale K8s Deployment voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530382 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530383 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530384 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530385 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530386 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
387 # so restart the port forwarding for the API service
David Bainbridge07321ff2020-06-12 13:55:42 -0700388 Restart VOLTHA Port Forward voltha-api
Hardik Windlass9df139e2020-04-24 14:54:54 +0530389 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
390 # represents system connectivity being restored
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800391 FOR ${I} IN RANGE 0 ${olt_count}
392 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
393 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
394 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
395 ... ${olt_serial_number}
396 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
397 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
398 END
Hardik Windlass9df139e2020-04-24 14:54:54 +0530399
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800400 FOR ${I} IN RANGE 0 ${num_all_onus}
Andy Bavier52094622020-05-12 15:54:24 -0700401 ${src}= Set Variable ${hosts.src[${I}]}
402 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800403 ${of_id}= Get ofID From OLT List ${src['olt']}
Andy Bavier52094622020-05-12 15:54:24 -0700404 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
405 ... ${of_id}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530406 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
407 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
408 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
409 # Verify subscriber access flows are added for the ONU port
410 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
411 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
412 ... ${onu_port} ${nni_port} ${src['s_tag']}
413 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
414 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
415 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
416 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
417 ... ${dst['container_name']}
418 END
419
Hemadf003682020-04-28 21:22:22 +0530420Verify OLT Soft Reboot for DT
421 [Documentation] Test soft reboot of the OLT using voltctl command
422 [Tags] VOL-2818 OLTSoftRebootDt notready
423 [Setup] Start Logging OLTSoftRebootDt
424 #... AND Setup
425 [Teardown] Run Keywords Collect Logs
426 ... AND Stop Logging OLTSoftRebootDt
427 #... AND Delete Device and Verify
Hemadf003682020-04-28 21:22:22 +0530428 # Reboot the OLT using "voltctl device reboot" command
429 Reboot Device ${olt_device_id}
430 Run Keyword And Ignore Error Collect Logs
431 #Verify that ping fails
432 FOR ${I} IN RANGE 0 ${num_onus}
433 ${src}= Set Variable ${hosts.src[${I}]}
434 ${dst}= Set Variable ${hosts.dst[${I}]}
435 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
436 ... Wait Until Keyword Succeeds 60s 2s
437 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
438 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
439 END
440 # Wait for the OLT to come back up
441 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700442 ... Check Remote System Reachability True ${olt_ssh_ip}
Hemadf003682020-04-28 21:22:22 +0530443 # Waiting extra time for the ONUs to come up
444 Sleep 60s
445 # Check OLT states
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700446 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE
Hemadf003682020-04-28 21:22:22 +0530447 ... ${olt_serial_number}
448 Run Keyword And Ignore Error Collect Logs
449 #Check after reboot that ONUs are active, DHCP and pingable
450 Run Keyword If ${has_dataplane} Clean Up Linux
451 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
452
Hema8c1a0322020-05-26 16:02:32 +0530453Verify ONU Soft Reboot for DT
454 [Documentation] Test soft reboot of the ONU using voltctl command
455 [Tags] VOL-2820 ONUSoftRebootDt notready
456 [Setup] Start Logging ONUSoftRebootDt
457 #... AND Setup
458 [Teardown] Run Keywords Collect Logs
459 ... AND Stop Logging ONUSoftRebootDt
460 #... AND Delete Device and Verify
Hema8c1a0322020-05-26 16:02:32 +0530461 #Reboot the ONU and verify that ping fails
462 FOR ${I} IN RANGE 0 ${num_onus}
463 ${src}= Set Variable ${hosts.src[${I}]}
464 ${dst}= Set Variable ${hosts.dst[${I}]}
465 ${onu_device_id}= Get Device ID From SN ${src['onu']}
466 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
467 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
468 Reboot Device ${onu_device_id}
469 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
470 ... Wait Until Keyword Succeeds 60s 2s
471 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
472 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
473 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
474 # Remove Subscriber Access (To replicate DT workflow)
475 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
476 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
477 # Delete ONU Device (To replicate DT workflow)
478 Delete Device ${onu_device_id}
479 Sleep 40s
480 # Check ONU port is Enabled in ONOS
481 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700482 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hema8c1a0322020-05-26 16:02:32 +0530483 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
484 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
485 ... volt-add-subscriber-access ${of_id} ${onu_port}
486 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700487 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hema8c1a0322020-05-26 16:02:32 +0530488 ... ENABLED ACTIVE REACHABLE
489 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
490 # Verify subscriber access flows are added for the ONU port
491 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
492 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
493 ... ${onu_port} ${nni_port} ${src['s_tag']}
494 #Run Keyword If ${has_dataplane} Clean Up Linux
495 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
496 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
497 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
498 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
499 ... ${dst['container_name']}
500 Run Keyword And Ignore Error Collect Logs
501 END
502 # Verify ONOS Flows
503 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
504 ${onos_flows_count}= Evaluate 4 * ${num_onus}
505 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
506 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
507 ... ${of_id} ${onos_flows_count}
508 # Verify VOLTHA Flows
509 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
510 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
511 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
512 ${onu_flows}= Set Variable 2
513 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
514 ${List_ONU_Serial} Create List
515 Set Suite Variable ${List_ONU_Serial}
516 Build ONU SN List ${List_ONU_Serial}
517 Log ${List_ONU_Serial}
518 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
519 ... ${List_ONU_Serial} ${onu_flows}
Hemadf003682020-04-28 21:22:22 +0530520
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530521*** Keywords ***
522Setup Suite
523 [Documentation] Set up the test suite
524 Common Test Suite Setup
Andrea Campanella15619c72020-04-30 09:48:04 +0200525 #power_switch.robot needs it to support different vendor's power switch
526 ${switch_type}= Get Variable Value ${web_power_switch.type}
527 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530528
529Clear All Devices Then Create New Device
530 [Documentation] Remove any devices from VOLTHA and ONOS
531 # Remove all devices from voltha and nos
532 Delete All Devices and Verify
533 # Execute normal test Setup Keyword
534 Setup
535