blob: e577468e40fda81803c130116ba59823d38e7999 [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
68 ... AND Delete Device and Verify
69 # 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
Hardik Windlassb9bdd502020-04-17 14:46:21 +053076 FOR ${I} IN RANGE 0 ${num_onus}
77 ${src}= Set Variable ${hosts.src[${I}]}
78 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass0560f802020-05-06 23:06:53 +053079 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +053080 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
81 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Hardik Windlass7c801e62020-05-04 19:33:21 +053082 # Disable Power Switch
Hardik Windlassb9bdd502020-04-17 14:46:21 +053083 Disable Switch Outlet ${src['power_switch_port']}
84 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
85 ... Wait Until Keyword Succeeds 60s 2s
86 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
87 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlass7c801e62020-05-04 19:33:21 +053088 # Remove Subscriber Access (To replicate DT workflow)
89 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
90 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri1b8d7b82020-05-29 21:10:12 -070091 Sleep 10s
Hardik Windlass7c801e62020-05-04 19:33:21 +053092 # Delete ONU Device (To replicate DT workflow)
93 Delete Device ${onu_device_id}
94 Sleep 5s
95 # Enable Power Switch
Hardik Windlassb9bdd502020-04-17 14:46:21 +053096 Enable Switch Outlet ${src['power_switch_port']}
Hardik Windlass40ccffb2020-05-11 14:12:07 +053097 # Waiting extra time for the ONU to come up
98 Sleep 60s
Hardik Windlassb9bdd502020-04-17 14:46:21 +053099 # Check ONU port is Enabled in ONOS
100 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700101 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass7c801e62020-05-04 19:33:21 +0530102 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}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530105 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700106 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530107 ... ENABLED ACTIVE REACHABLE
Hardik Windlass7c801e62020-05-04 19:33:21 +0530108 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530109 # Verify subscriber access flows are added for the ONU port
110 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
111 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
112 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlass2eb47182020-05-19 20:24:12 +0530113 #Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass7c801e62020-05-04 19:33:21 +0530114 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
115 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530116 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlass7c801e62020-05-04 19:33:21 +0530117 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
118 ... ${dst['container_name']}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530119 Run Keyword And Ignore Error Collect Logs
120 END
121 # Verify ONOS Flows
122 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
123 ${onos_flows_count}= Evaluate 4 * ${num_onus}
124 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
125 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
126 ... ${of_id} ${onos_flows_count}
127 # Verify VOLTHA Flows
128 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
129 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
130 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
131 ${onu_flows}= Set Variable 2
132 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
133 ${List_ONU_Serial} Create List
134 Set Suite Variable ${List_ONU_Serial}
135 Build ONU SN List ${List_ONU_Serial}
136 Log ${List_ONU_Serial}
137 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
138 ... ${List_ONU_Serial} ${onu_flows}
139
140Verify OLT after Rebooting Physically for DT
141 [Documentation] Test the physical reboot of the OLT
142 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
143 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
144 [Tags] functionalDt PhysicalOltRebootDt VOL-2817
Hardik Windlass9df139e2020-04-24 14:54:54 +0530145 [Setup] Start Logging RebootOlt_Physical_Dt
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530146 [Teardown] Run Keywords Collect Logs
147 ... AND Stop Logging RebootOlt_Physical_Dt
148 ... AND Delete Device and Verify
149 # Add OLT device
150 Setup
151 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
152 Run Keyword If ${has_dataplane} Clean Up Linux
153 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
154 # Reboot the OLT from the OLT CLI
155 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700156 ... sudo reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530157 Run Keyword And Ignore Error Collect Logs
158 FOR ${I} IN RANGE 0 ${num_onus}
159 ${src}= Set Variable ${hosts.src[${I}]}
160 ${dst}= Set Variable ${hosts.dst[${I}]}
161 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
162 ... Wait Until Keyword Succeeds 60s 2s
163 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
164 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
165 END
166 # Wait for the OLT to come back up
167 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700168 ... Check Remote System Reachability True ${olt_ssh_ip}
Andrea Campanella027d42a2020-07-30 16:36:09 +0200169 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
170 ... Validate OLT Device ENABLED ACTIVE
171 ... REACHABLE ${olt_serial_number}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530172 # Waiting extra time for the ONUs to come up
173 Sleep 60s
174 Run Keyword And Ignore Error Collect Logs
175 Run Keyword If ${has_dataplane} Clean Up Linux
176 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
177
Hardik Windlass9df139e2020-04-24 14:54:54 +0530178Verify restart openolt-adapter container after subscriber provisioning for DT
179 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
180 ... Prerequisite : ONUs are authenticated and pingable.
181 [Tags] functionalDt Restart-OpenOlt-Dt
182 [Setup] Start Logging Restart-OpenOlt-Dt
183 [Teardown] Run Keywords Collect Logs
184 ... AND Stop Logging Restart-OpenOlt-Dt
185 # Add OLT device
186 setup
187 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
188 Run Keyword If ${has_dataplane} Clean Up Linux
189 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
190 ${waitforRestart} Set Variable 120s
191 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
192 Log ${podStatusOutput}
193 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530194 ${podName} Set Variable adapter-open-olt
195 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
196 Sleep 5s
197 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
198 ... app ${podName} Running
Hardik Windlass9df139e2020-04-24 14:54:54 +0530199 # Wait for 1min after openolt adapter is restarted
200 Sleep 60s
201 Run Keyword If ${has_dataplane} Clean Up Linux
202 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
203 Run Keyword and Ignore Error Collect Logs
204 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
205 Log ${podStatusOutput}
206 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
207 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
208 Log to console Pod ${podName} restarted and sanity checks passed successfully
209
210Verify openolt adapter restart before subscriber provisioning 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 olt-adapter-restart-Dt
217 [Setup] Start Logging OltAdapterRestart-Dt
218 #... AND Clear All Devices Then Create New Device
219 [Teardown] Run Keywords Collect Logs
220 ... AND Stop Logging OltAdapterRestart-Dt
221 # Add OLT and perform sanity test
222 #setup
223 Run Keyword If ${has_dataplane} Clean Up Linux
224 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
225 Set Global Variable ${of_id}
226
227 FOR ${I} IN RANGE 0 ${num_onus}
228 ${src}= Set Variable ${hosts.src[${I}]}
229 ${dst}= Set Variable ${hosts.dst[${I}]}
230 ${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
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530238 Scale K8s Deployment voltha open-olt-voltha-adapter-openolt 0
239 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha open-olt-voltha-adapter-openolt
Hardik Windlass9df139e2020-04-24 14:54:54 +0530240 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530241 Scale K8s Deployment voltha open-olt-voltha-adapter-openolt 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530242 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530243 ... Check Expected Available Deployment Replicas voltha open-olt-voltha-adapter-openolt 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530244
245 # Ensure the device is available in ONOS, this represents system connectivity being restored
246 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
247 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
248
249 FOR ${I} IN RANGE 0 ${num_onus}
250 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
251 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
252 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
253 # Verify subscriber access flows are added for the ONU port
254 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
255 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
256 ... ${onu_port} ${nni_port} ${src['s_tag']}
257 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
258 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
259 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
260 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
261 ... ${dst['container_name']}
262 END
263
264Verify restart ofagent container after subscriber is provisioned for DT
265 [Documentation] Restart ofagent container after VOLTHA is operational.
266 ... Prerequisite : ONUs are authenticated and pingable.
267 [Tags] functionalDt ofagentRestart-Dt
268 [Setup] Start Logging ofagentRestart-Dt
269 [Teardown] Run Keywords Collect Logs
270 ... AND Stop Logging ofagentRestart-Dt
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530271 ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530272 # set timeout value
273 ${waitforRestart} Set Variable 120s
274 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
275 Log ${podStatusOutput}
276 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
277 ${podName} Set Variable ofagent
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530278 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530279 Sleep 60s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530280 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
281 ... app ${podName} Running
Hardik Windlass9df139e2020-04-24 14:54:54 +0530282 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
283 Run Keyword If ${has_dataplane} Clean Up Linux
284 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
285 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
286 Log ${podStatusOutput}
287 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
288 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
289 # Scale Down the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530290 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530291 Sleep 30s
292 FOR ${I} IN RANGE 0 ${num_onus}
293 ${src}= Set Variable ${hosts.src[${I}]}
294 ${dst}= Set Variable ${hosts.dst[${I}]}
295 Run Keyword and Ignore Error Collect Logs
296 ${onu_device_id}= Get Device ID From SN ${src['onu']}
297 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
298 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
299 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700300 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hardik Windlass9df139e2020-04-24 14:54:54 +0530301 ... ENABLED ACTIVE REACHABLE
302 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
303 # Check ONU port is Disabled in ONOS
304 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700305 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530306 # Verify subscriber access flows are added for the ONU port
307 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
308 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
309 ... ${onu_port} ${nni_port} ${src['s_tag']}
310 # Verify Ping
311 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
312 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
313 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
314 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
315 Run Keyword and Ignore Error Collect Logs
316 END
317 # Scale Up the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530318 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530319 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
320 ... Running
321 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
322 Run Keyword If ${has_dataplane} Clean Up Linux
323 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
324 Log to console Pod ${podName} restarted and sanity checks passed successfully
325
326Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for DT
327 [Documentation] Deploys an device instance and waits for it to authenticate. After
328 ... authentication is successful the rw-core deployment is scaled to 0 instances to
329 ... simulate a POD crash. The test then scales the rw-core back to a single instance
330 ... and configures ONOS for access. The test succeeds if the device is able to
331 ... complete the DHCP sequence.
332 [Tags] functionalDt rwcore-restart-Dt
333 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-Dt
334 ... AND Clear All Devices Then Create New Device
335 [Teardown] Run Keywords Collect Logs
336 ... AND Stop Logging RwCoreFailAndRestart-Dt
337 #... AND Delete Device and Verify
338 Run Keyword and Ignore Error Collect Logs
339 Run Keyword If ${has_dataplane} Clean Up Linux
340 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
341 Set Global Variable ${of_id}
342 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
343 ... Get NNI Port in ONOS ${of_id}
344 Set Global Variable ${nni_port}
345 FOR ${I} IN RANGE 0 ${num_onus}
346 ${src}= Set Variable ${hosts.src[${I}]}
347 ${dst}= Set Variable ${hosts.dst[${I}]}
348 ${onu_device_id}= Get Device ID From SN ${src['onu']}
349 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
350 ... ${of_id}
351 # Bring up the device and verify it authenticates
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700352 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass9df139e2020-04-24 14:54:54 +0530353 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded
354 END
355
356 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530357 Scale K8s Deployment voltha voltha-voltha-rw-core 0
358 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
Hardik Windlass9df139e2020-04-24 14:54:54 +0530359 # Ensure the ofagent POD goes "not-ready" as expected
360 Wait Until keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530361 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530362 # Scale up the core deployment and make sure both it and the ofagent deployment are back
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530363 Scale K8s Deployment voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530364 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530365 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530366 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530367 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530368 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
369 # so restart the port forwarding for the API service
David Bainbridge07321ff2020-06-12 13:55:42 -0700370 Restart VOLTHA Port Forward voltha-api
Hardik Windlass9df139e2020-04-24 14:54:54 +0530371 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
372 # represents system connectivity being restored
373 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
374 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
375
376 FOR ${I} IN RANGE 0 ${num_onus}
Andy Bavier52094622020-05-12 15:54:24 -0700377 ${src}= Set Variable ${hosts.src[${I}]}
378 ${dst}= Set Variable ${hosts.dst[${I}]}
379 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
380 ... ${of_id}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530381 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
382 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
383 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
384 # Verify subscriber access flows are added for the ONU port
385 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
386 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
387 ... ${onu_port} ${nni_port} ${src['s_tag']}
388 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
389 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
390 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
391 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
392 ... ${dst['container_name']}
393 END
394
Hemadf003682020-04-28 21:22:22 +0530395Verify OLT Soft Reboot for DT
396 [Documentation] Test soft reboot of the OLT using voltctl command
397 [Tags] VOL-2818 OLTSoftRebootDt notready
398 [Setup] Start Logging OLTSoftRebootDt
399 #... AND Setup
400 [Teardown] Run Keywords Collect Logs
401 ... AND Stop Logging OLTSoftRebootDt
402 #... AND Delete Device and Verify
403 ## Performing Sanity Test to make sure subscribers are all DHCP and pingable
404 #Run Keyword If ${has_dataplane} Clean Up Linux
405 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
406 # Reboot the OLT using "voltctl device reboot" command
407 Reboot Device ${olt_device_id}
408 Run Keyword And Ignore Error Collect Logs
409 #Verify that ping fails
410 FOR ${I} IN RANGE 0 ${num_onus}
411 ${src}= Set Variable ${hosts.src[${I}]}
412 ${dst}= Set Variable ${hosts.dst[${I}]}
413 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
414 ... Wait Until Keyword Succeeds 60s 2s
415 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
416 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
417 END
418 # Wait for the OLT to come back up
419 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700420 ... Check Remote System Reachability True ${olt_ssh_ip}
Hemadf003682020-04-28 21:22:22 +0530421 # Waiting extra time for the ONUs to come up
422 Sleep 60s
423 # Check OLT states
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700424 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE
Hemadf003682020-04-28 21:22:22 +0530425 ... ${olt_serial_number}
426 Run Keyword And Ignore Error Collect Logs
427 #Check after reboot that ONUs are active, DHCP and pingable
428 Run Keyword If ${has_dataplane} Clean Up Linux
429 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
430
Hema8c1a0322020-05-26 16:02:32 +0530431Verify ONU Soft Reboot for DT
432 [Documentation] Test soft reboot of the ONU using voltctl command
433 [Tags] VOL-2820 ONUSoftRebootDt notready
434 [Setup] Start Logging ONUSoftRebootDt
435 #... AND Setup
436 [Teardown] Run Keywords Collect Logs
437 ... AND Stop Logging ONUSoftRebootDt
438 #... AND Delete Device and Verify
439 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
440 #Run Keyword If ${has_dataplane} Clean Up Linux
441 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
442 #Reboot the ONU and verify that ping fails
443 FOR ${I} IN RANGE 0 ${num_onus}
444 ${src}= Set Variable ${hosts.src[${I}]}
445 ${dst}= Set Variable ${hosts.dst[${I}]}
446 ${onu_device_id}= Get Device ID From SN ${src['onu']}
447 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
448 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
449 Reboot Device ${onu_device_id}
450 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
451 ... Wait Until Keyword Succeeds 60s 2s
452 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
453 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
454 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
455 # Remove Subscriber Access (To replicate DT workflow)
456 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
457 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
458 # Delete ONU Device (To replicate DT workflow)
459 Delete Device ${onu_device_id}
460 Sleep 40s
461 # Check ONU port is Enabled in ONOS
462 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700463 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hema8c1a0322020-05-26 16:02:32 +0530464 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
465 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
466 ... volt-add-subscriber-access ${of_id} ${onu_port}
467 # Verify ONU state in voltha
Suchitra Vemuricdc32d82020-07-17 12:24:46 -0700468 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hema8c1a0322020-05-26 16:02:32 +0530469 ... ENABLED ACTIVE REACHABLE
470 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
471 # Verify subscriber access flows are added for the ONU port
472 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
473 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
474 ... ${onu_port} ${nni_port} ${src['s_tag']}
475 #Run Keyword If ${has_dataplane} Clean Up Linux
476 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
477 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
478 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
479 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
480 ... ${dst['container_name']}
481 Run Keyword And Ignore Error Collect Logs
482 END
483 # Verify ONOS Flows
484 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
485 ${onos_flows_count}= Evaluate 4 * ${num_onus}
486 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
487 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
488 ... ${of_id} ${onos_flows_count}
489 # Verify VOLTHA Flows
490 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
491 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
492 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
493 ${onu_flows}= Set Variable 2
494 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
495 ${List_ONU_Serial} Create List
496 Set Suite Variable ${List_ONU_Serial}
497 Build ONU SN List ${List_ONU_Serial}
498 Log ${List_ONU_Serial}
499 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
500 ... ${List_ONU_Serial} ${onu_flows}
Hemadf003682020-04-28 21:22:22 +0530501
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530502*** Keywords ***
503Setup Suite
504 [Documentation] Set up the test suite
505 Common Test Suite Setup
Andrea Campanella15619c72020-04-30 09:48:04 +0200506 #power_switch.robot needs it to support different vendor's power switch
507 ${switch_type}= Get Variable Value ${web_power_switch.type}
508 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530509
510Clear All Devices Then Create New Device
511 [Documentation] Remove any devices from VOLTHA and ONOS
512 # Remove all devices from voltha and nos
513 Delete All Devices and Verify
514 # Execute normal test Setup Keyword
515 Setup
516