blob: 5056e4e02c8c887e703f422ff46921f72c07313f [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 Vemuriec5da062020-07-16 22:05:29 -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 Vemuri919c2e72020-07-15 15:23:15 -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
Andrea Campanella5a4c4b12020-07-24 23:25:10 +0200167 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 360s 10s
Suchitra Vemuri919c2e72020-07-15 15:23:15 -0700168 ... Check Remote System Reachability True ${olt_ssh_ip}
Suchitra Vemuri9633feb2020-07-28 13:45:47 -0700169 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE
170 ... ${olt_serial_number}
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
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530193 ${podName} Set Variable adapter-open-olt
194 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
226 FOR ${I} IN RANGE 0 ${num_onus}
227 ${src}= Set Variable ${hosts.src[${I}]}
228 ${dst}= Set Variable ${hosts.dst[${I}]}
229 ${onu_device_id}= Get Device ID From SN ${src['onu']}
230 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
231 ... ${of_id}
232 # Bring up the device and verify it authenticates
Suchitra Vemuriec5da062020-07-16 22:05:29 -0700233 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass9df139e2020-04-24 14:54:54 +0530234 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
235 END
236 # 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 +0530237 Scale K8s Deployment voltha open-olt-voltha-adapter-openolt 0
238 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha open-olt-voltha-adapter-openolt
Hardik Windlass9df139e2020-04-24 14:54:54 +0530239 # 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 +0530240 Scale K8s Deployment voltha open-olt-voltha-adapter-openolt 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530241 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530242 ... Check Expected Available Deployment Replicas voltha open-olt-voltha-adapter-openolt 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530243
244 # Ensure the device is available in ONOS, this represents system connectivity being restored
245 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
246 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
247
248 FOR ${I} IN RANGE 0 ${num_onus}
249 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
250 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
251 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
252 # Verify subscriber access flows are added for the ONU port
253 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
254 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
255 ... ${onu_port} ${nni_port} ${src['s_tag']}
256 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
257 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
258 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
259 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
260 ... ${dst['container_name']}
261 END
262
263Verify restart ofagent container after subscriber is provisioned for DT
264 [Documentation] Restart ofagent container after VOLTHA is operational.
265 ... Prerequisite : ONUs are authenticated and pingable.
266 [Tags] functionalDt ofagentRestart-Dt
267 [Setup] Start Logging ofagentRestart-Dt
268 [Teardown] Run Keywords Collect Logs
269 ... AND Stop Logging ofagentRestart-Dt
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530270 ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530271 # set timeout value
272 ${waitforRestart} Set Variable 120s
273 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
274 Log ${podStatusOutput}
275 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
276 ${podName} Set Variable ofagent
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530277 Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530278 Sleep 60s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530279 Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
280 ... app ${podName} Running
Hardik Windlass9df139e2020-04-24 14:54:54 +0530281 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
282 Run Keyword If ${has_dataplane} Clean Up Linux
283 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
284 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
285 Log ${podStatusOutput}
286 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
287 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
288 # Scale Down the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530289 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530290 Sleep 30s
291 FOR ${I} IN RANGE 0 ${num_onus}
292 ${src}= Set Variable ${hosts.src[${I}]}
293 ${dst}= Set Variable ${hosts.dst[${I}]}
294 Run Keyword and Ignore Error Collect Logs
295 ${onu_device_id}= Get Device ID From SN ${src['onu']}
296 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
297 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
298 # Verify ONU state in voltha
Suchitra Vemuriec5da062020-07-16 22:05:29 -0700299 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hardik Windlass9df139e2020-04-24 14:54:54 +0530300 ... ENABLED ACTIVE REACHABLE
301 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
302 # Check ONU port is Disabled in ONOS
303 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700304 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530305 # Verify subscriber access flows are added for the ONU port
306 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
307 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
308 ... ${onu_port} ${nni_port} ${src['s_tag']}
309 # Verify Ping
310 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
311 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
312 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
313 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
314 Run Keyword and Ignore Error Collect Logs
315 END
316 # Scale Up the Of-Agent Deployment
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530317 Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530318 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
319 ... Running
320 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
321 Run Keyword If ${has_dataplane} Clean Up Linux
322 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
323 Log to console Pod ${podName} restarted and sanity checks passed successfully
324
325Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for DT
326 [Documentation] Deploys an device instance and waits for it to authenticate. After
327 ... authentication is successful the rw-core deployment is scaled to 0 instances to
328 ... simulate a POD crash. The test then scales the rw-core back to a single instance
329 ... and configures ONOS for access. The test succeeds if the device is able to
330 ... complete the DHCP sequence.
331 [Tags] functionalDt rwcore-restart-Dt
332 [Setup] Run Keywords Start Logging RwCoreFailAndRestart-Dt
333 ... AND Clear All Devices Then Create New Device
334 [Teardown] Run Keywords Collect Logs
335 ... AND Stop Logging RwCoreFailAndRestart-Dt
336 #... AND Delete Device and Verify
337 Run Keyword and Ignore Error Collect Logs
338 Run Keyword If ${has_dataplane} Clean Up Linux
339 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
340 Set Global Variable ${of_id}
341 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
342 ... Get NNI Port in ONOS ${of_id}
343 Set Global Variable ${nni_port}
344 FOR ${I} IN RANGE 0 ${num_onus}
345 ${src}= Set Variable ${hosts.src[${I}]}
346 ${dst}= Set Variable ${hosts.dst[${I}]}
347 ${onu_device_id}= Get Device ID From SN ${src['onu']}
348 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
349 ... ${of_id}
350 # Bring up the device and verify it authenticates
Suchitra Vemuriec5da062020-07-16 22:05:29 -0700351 Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass9df139e2020-04-24 14:54:54 +0530352 ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded
353 END
354
355 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530356 Scale K8s Deployment voltha voltha-voltha-rw-core 0
357 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core
Hardik Windlass9df139e2020-04-24 14:54:54 +0530358 # Ensure the ofagent POD goes "not-ready" as expected
359 Wait Until keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530360 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0
Hardik Windlass9df139e2020-04-24 14:54:54 +0530361 # Scale up the core deployment and make sure both it and the ofagent deployment are back
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530362 Scale K8s Deployment voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530363 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530364 ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530365 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass79b40ff2020-06-11 22:55:47 +0530366 ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1
Hardik Windlass9df139e2020-04-24 14:54:54 +0530367 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
368 # so restart the port forwarding for the API service
David Bainbridge07321ff2020-06-12 13:55:42 -0700369 Restart VOLTHA Port Forward voltha-api
Hardik Windlass9df139e2020-04-24 14:54:54 +0530370 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
371 # represents system connectivity being restored
372 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
373 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
374
375 FOR ${I} IN RANGE 0 ${num_onus}
Andy Bavier52094622020-05-12 15:54:24 -0700376 ${src}= Set Variable ${hosts.src[${I}]}
377 ${dst}= Set Variable ${hosts.dst[${I}]}
378 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
379 ... ${of_id}
Hardik Windlass9df139e2020-04-24 14:54:54 +0530380 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
381 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
382 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
383 # Verify subscriber access flows are added for the ONU port
384 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
385 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
386 ... ${onu_port} ${nni_port} ${src['s_tag']}
387 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
388 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
389 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
390 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
391 ... ${dst['container_name']}
392 END
393
Hemadf003682020-04-28 21:22:22 +0530394Verify OLT Soft Reboot for DT
395 [Documentation] Test soft reboot of the OLT using voltctl command
396 [Tags] VOL-2818 OLTSoftRebootDt notready
397 [Setup] Start Logging OLTSoftRebootDt
398 #... AND Setup
399 [Teardown] Run Keywords Collect Logs
400 ... AND Stop Logging OLTSoftRebootDt
401 #... AND Delete Device and Verify
402 ## Performing Sanity Test to make sure subscribers are all DHCP and pingable
403 #Run Keyword If ${has_dataplane} Clean Up Linux
404 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
405 # Reboot the OLT using "voltctl device reboot" command
406 Reboot Device ${olt_device_id}
407 Run Keyword And Ignore Error Collect Logs
408 #Verify that ping fails
409 FOR ${I} IN RANGE 0 ${num_onus}
410 ${src}= Set Variable ${hosts.src[${I}]}
411 ${dst}= Set Variable ${hosts.dst[${I}]}
412 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
413 ... Wait Until Keyword Succeeds 60s 2s
414 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
415 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
416 END
417 # Wait for the OLT to come back up
Andrea Campanella5a4c4b12020-07-24 23:25:10 +0200418 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 360s 10s
Suchitra Vemuri919c2e72020-07-15 15:23:15 -0700419 ... Check Remote System Reachability True ${olt_ssh_ip}
Hemadf003682020-04-28 21:22:22 +0530420 # Waiting extra time for the ONUs to come up
421 Sleep 60s
422 # Check OLT states
Suchitra Vemuriec5da062020-07-16 22:05:29 -0700423 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE
Hemadf003682020-04-28 21:22:22 +0530424 ... ${olt_serial_number}
425 Run Keyword And Ignore Error Collect Logs
426 #Check after reboot that ONUs are active, DHCP and pingable
427 Run Keyword If ${has_dataplane} Clean Up Linux
428 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
429
Hema8c1a0322020-05-26 16:02:32 +0530430Verify ONU Soft Reboot for DT
431 [Documentation] Test soft reboot of the ONU using voltctl command
432 [Tags] VOL-2820 ONUSoftRebootDt notready
433 [Setup] Start Logging ONUSoftRebootDt
434 #... AND Setup
435 [Teardown] Run Keywords Collect Logs
436 ... AND Stop Logging ONUSoftRebootDt
437 #... AND Delete Device and Verify
438 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
439 #Run Keyword If ${has_dataplane} Clean Up Linux
440 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
441 #Reboot the ONU and verify that ping fails
442 FOR ${I} IN RANGE 0 ${num_onus}
443 ${src}= Set Variable ${hosts.src[${I}]}
444 ${dst}= Set Variable ${hosts.dst[${I}]}
445 ${onu_device_id}= Get Device ID From SN ${src['onu']}
446 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
447 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
448 Reboot Device ${onu_device_id}
449 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
450 ... Wait Until Keyword Succeeds 60s 2s
451 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
452 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
453 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
454 # Remove Subscriber Access (To replicate DT workflow)
455 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
456 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
457 # Delete ONU Device (To replicate DT workflow)
458 Delete Device ${onu_device_id}
459 Sleep 40s
460 # Check ONU port is Enabled in ONOS
461 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700462 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hema8c1a0322020-05-26 16:02:32 +0530463 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
464 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
465 ... volt-add-subscriber-access ${of_id} ${onu_port}
466 # Verify ONU state in voltha
Suchitra Vemuriec5da062020-07-16 22:05:29 -0700467 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device
Hema8c1a0322020-05-26 16:02:32 +0530468 ... ENABLED ACTIVE REACHABLE
469 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
470 # Verify subscriber access flows are added for the ONU port
471 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
472 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
473 ... ${onu_port} ${nni_port} ${src['s_tag']}
474 #Run Keyword If ${has_dataplane} Clean Up Linux
475 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
476 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
477 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
478 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
479 ... ${dst['container_name']}
480 Run Keyword And Ignore Error Collect Logs
481 END
482 # Verify ONOS Flows
483 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
484 ${onos_flows_count}= Evaluate 4 * ${num_onus}
485 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
486 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
487 ... ${of_id} ${onos_flows_count}
488 # Verify VOLTHA Flows
489 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
490 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
491 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
492 ${onu_flows}= Set Variable 2
493 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
494 ${List_ONU_Serial} Create List
495 Set Suite Variable ${List_ONU_Serial}
496 Build ONU SN List ${List_ONU_Serial}
497 Log ${List_ONU_Serial}
498 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
499 ... ${List_ONU_Serial} ${onu_flows}
Hemadf003682020-04-28 21:22:22 +0530500
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530501*** Keywords ***
502Setup Suite
503 [Documentation] Set up the test suite
504 Common Test Suite Setup
Andrea Campanella15619c72020-04-30 09:48:04 +0200505 #power_switch.robot needs it to support different vendor's power switch
506 ${switch_type}= Get Variable Value ${web_power_switch.type}
507 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Hardik Windlassb9bdd502020-04-17 14:46:21 +0530508
509Clear All Devices Then Create New Device
510 [Documentation] Remove any devices from VOLTHA and ONOS
511 # Remove all devices from voltha and nos
512 Delete All Devices and Verify
513 # Execute normal test Setup Keyword
514 Setup
515