blob: df2867cfe35202d575f063dc65fd5f9d76c28604 [file] [log] [blame]
Gayathri.Selvan283a63c2020-01-23 04:09:18 +00001# 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.
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000014
15*** Settings ***
HungWei Chiu87edb1f2020-01-28 00:10:58 +000016Documentation Test various failure scenarios
HungWei Chiu1408fb92020-03-03 19:43:30 -050017Suite Setup Setup Suite
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000018Test Setup Setup
19Test Teardown Teardown
20#Suite Teardown Teardown Suite
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
26Library ../../libraries/DependencyLibrary.py
27Resource ../../libraries/onos.robot
28Resource ../../libraries/voltctl.robot
29Resource ../../libraries/voltha.robot
30Resource ../../libraries/utils.robot
31Resource ../../libraries/k8s.robot
32Resource ../../variables/variables.robot
HungWei Chiu87edb1f2020-01-28 00:10:58 +000033Resource ../../libraries/power_switch.robot
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000034
35*** Variables ***
36${POD_NAME} flex-ocp-cord
37${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
38${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
39#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
40${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
41${HELM_CHARTS_DIR} ~/helm-charts
42${VOLTHA_POD_NUM} 8
43${NAMESPACE} voltha
44# For below variable value, using deployment name as using grep for
45# parsing radius pod name, we can also use full radius pod name
46${RESTART_POD_NAME} radius
47${timeout} 60s
48${of_id} 0
49${logical_id} 0
Suchitra Vemuri109feb12020-01-23 16:25:02 -080050${has_dataplane} True
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000051${teardown_device} False
52${scripts} ../../scripts
53
Andy Bavierabeba262020-02-07 16:22:16 -070054# Per-test logging on failure is turned off by default; set this variable to enable
55${container_log_dir} ${None}
56
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000057*** Test Cases ***
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080058Verify ONU after rebooting physically
59 [Documentation] Test the ONU functionality by physically turning on/off ONU.
60 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
61 ... Test case runs only on the PODs that are configured with PowerSwitch that
62 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
63 ... VOL-2634
64 [Tags] functional PowerSwitch
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080065 [Setup] Run Keywords Announce Message START TEST ONUreboot_PowerSwitch
66 ... AND Start Logging ONUreboot_PowerSwitch
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080067 [Teardown] Run Keywords Collect Logs
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080068 ... AND Stop Logging ONUreboot_PowerSwitch
69 ... AND Announce Message END TEST ONUreboot_PowerSwitch
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080070 # Add OLT device
71 setup
72 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
73 Run Keyword If ${has_dataplane} Clean Up Linux
74 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
75 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
76 FOR ${I} IN RANGE 0 ${num_onus}
77 ${src}= Set Variable ${hosts.src[${I}]}
78 ${dst}= Set Variable ${hosts.dst[${I}]}
79 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
80 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
81 Disable Switch Outlet ${src['power_switch_port']}
82 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
83 ... Wait Until Keyword Succeeds 60s 2s
84 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
85 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
86
87 Enable Switch Outlet ${src['power_switch_port']}
88 # Check ONU port is Enabled in ONOS
89 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080090 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080091 # Verify EAPOL flows are added for the ONU port
92 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080093 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080094 # Verify ONU state in voltha
95 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
96 ... ENABLED ACTIVE REACHABLE
97 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080098 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
99 ... Wait Until Keyword Succeeds 60s 2s
100 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
101 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
102 Run Keyword And Ignore Error Collect Logs
103 END
Suchitra Vemurid7096132020-02-21 14:50:47 -0800104 # Deleting OLT after tests completes independently (as this test doesn't not run on each POD)
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800105 Run Keyword If ${has_dataplane} Delete Device and Verify
106
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700107Verify OLT after rebooting physically
108 [Documentation] Test the physical reboot of the OLT
109 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
110 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
111 ... VOL-1956
112 [Tags] functional PhysicalOLTReboot
113 [Setup] Run Keywords Announce Message START TEST PhysicalOLTReboot
114 ... AND Start Logging PhysicalOLTReboot
115 [Teardown] Run Keywords Collect Logs
116 ... AND Stop Logging PhysicalOLTReboot
117 ... AND Announce Message END TEST PhysicalOLTReboot
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700118 ... AND Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700119 # Add OLT device
120 setup
121 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
122 Run Keyword If ${has_dataplane} Clean Up Linux
123 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
124 # Reboot the OLT from the OLT CLI
125 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
126 ... sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
127 Run Keyword And Ignore Error Collect Logs
128 FOR ${I} IN RANGE 0 ${num_onus}
129 ${src}= Set Variable ${hosts.src[${I}]}
130 ${dst}= Set Variable ${hosts.dst[${I}]}
131 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
132 ... Wait Until Keyword Succeeds 60s 2s
133 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
134 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
135 END
136 # Wait for the OLT to come back up
137 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
138 Run Keyword And Ignore Error Collect Logs
139 Run Keyword If ${has_dataplane} Clean Up Linux
140 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
141 # Deleting OLT after test completes
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700142 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700143
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800144Verify restart openolt-adapter container after VOLTHA is operational
145 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
146 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800147 [Tags] functional VOL-1958 Restart-OpenOlt released
148 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
149 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800150 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800151 ... AND Stop Logging Restart-OpenOlt
152 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800153 # Add OLT device
154 setup
155 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
156 Run Keyword If ${has_dataplane} Clean Up Linux
157 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
158 ${waitforRestart} Set Variable 120s
159 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
160 Log ${podStatusOutput}
161 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
162 ${podName} Set Variable adapter-open-olt
163 Restart Pod ${NAMESPACE} ${podName}
164 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
165 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700166 # Wait for 1min after openolt adapter is restarted
167 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800168 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800169 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800170 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
171 Log ${podStatusOutput}
172 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
173 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
174 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800175
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800176Check OLT/ONU Authentication After Radius Pod Restart
177 [Documentation] After radius restart, triggers reassociation, checks status and
178 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
179 ... wpa supplicant is running in background hence it is recommended to remove
180 ... teardown from previous test or uncomment 'Teardown None'.
181 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
182 [Tags] functional RadiusRestart released
183 [Setup] Run Keywords Announce Message START TEST RadiusRestart
184 ... AND Start Logging RadiusRestart
185 [Teardown] Run Keywords Collect Logs
186 ... AND Stop Logging RadiusRestart
187 ... AND Announce Message END TEST RadiusRestart
188 ${waitforRestart} Set Variable 120s
189 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
190 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME} ${NAMESPACE}
191 ... Running
192 FOR ${I} IN RANGE 0 ${num_onus}
193 ${src}= Set Variable ${hosts.src[${I}]}
194 ${dst}= Set Variable ${hosts.dst[${I}]}
195 ${onu_device_id}= Get Device ID From SN ${src['onu']}
196 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
197 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
198 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800199 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800200 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
201 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
202 ... ${src['ip']} ${src['user']} ${src['pass']}
203 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800204 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800205 ... ${ONOS_SSH_PORT} ${onu_port}
206 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
207 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
208 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
209 ... ${src['ip']} ${src['user']} ${src['pass']}
210 ... ${src['container_type']} ${src['container_name']}
211 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
212 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
213 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800214 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800215 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
216 Run Keyword and Ignore Error Collect Logs
217 END
218
219Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
220 [Documentation] Deploys an device instance and waits for it to authenticate. After
221 ... authentication is successful the rw-core deployment is scaled to 0 instances to
222 ... simulate a POD crash. The test then scales the rw-core back to a single instance
223 ... and configures ONOS for access. The test succeeds if the device is able to
224 ... complete the DHCP sequence.
ubuntu6b6e7d42020-03-02 12:35:42 -0800225 [Tags] bbsim rwcore-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800226 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
227 ... AND Start Logging RwCoreFailAndRestart
228 ... AND Clear All Devices Then Create New Device
229 [Teardown] Run Keywords Collect Logs
230 ... AND Stop Logging RwCoreFailAndRestart
231 ... AND Announce Message END TEST RwCoreFailAndRestart
232 ... AND Delete Device and Verify
233 Run Keyword and Ignore Error Collect Logs
234 Run Keyword If ${has_dataplane} Clean Up Linux
235 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
236 Set Global Variable ${of_id}
237 FOR ${I} IN RANGE 0 ${num_onus}
238 ${src}= Set Variable ${hosts.src[${I}]}
239 ${dst}= Set Variable ${hosts.dst[${I}]}
240 ${onu_device_id}= Get Device ID From SN ${src['onu']}
241 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
242 ... ${of_id}
243 # Bring up the device and verify it authenticates
244 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
245 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800246 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800247 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700248 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
249 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800250 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
251 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700252 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800253 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800254 ... ${ONOS_SSH_PORT} ${onu_port}
255 END
256
257 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
258 Scale K8s Deployment voltha voltha-rw-core 0
259 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
260 # Ensure the ofagent POD goes "not-ready" as expected
261 Wait Until keyword Succeeds ${timeout} 2s
262 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
263 # Scale up the core deployment and make sure both it and the ofagent deployment are back
264 Scale K8s Deployment voltha voltha-rw-core 1
265 Wait Until Keyword Succeeds ${timeout} 2s
266 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
267 Wait Until Keyword Succeeds ${timeout} 2s
268 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
269 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
270 # so restart the port forwarding for the API service
271 Restart VOLTHA Port Foward voltha-api-minimal
272 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
273 # represents system connectivity being restored
274 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800275 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800276
277 FOR ${I} IN RANGE 0 ${num_onus}
278 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800279 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800280 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
281 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
282 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
283 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
284 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
285 ... ${dst['container_name']}
286 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800287 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800288 END
289
290Sanity E2E Test for OLT/ONU on POD With OLT Adapters Fail and Restart
291 [Documentation] Deploys an device instance and waits for it to authenticate. After
292 ... authentication is successful the rw-core deployment is scaled to 0 instances to
293 ... simulate a POD crash. The test then scales the rw-core back to a single instance
294 ... and configures ONOS for access. The test succeeds if the device is able to
295 ... complete the DHCP sequence.
296 [Tags] bbsim olt-adapter-restart
297 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
298 ... AND Start Logging OltAdapterRestart
299 ... AND Clear All Devices Then Create New Device
300 [Teardown] Run Keywords Collect Logs
301 ... AND Stop Logging OltAdapterRestart
302 ... AND Announce Message END TEST OltAdapterRestart
303 Run Keyword If ${has_dataplane} Clean Up Linux
304 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
305 Set Global Variable ${of_id}
306
307 FOR ${I} IN RANGE 0 ${num_onus}
308 ${src}= Set Variable ${hosts.src[${I}]}
309 ${dst}= Set Variable ${hosts.dst[${I}]}
310 ${onu_device_id}= Get Device ID From SN ${src['onu']}
311 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
312 ... ${of_id}
313
314 # Bring up the device and verify it authenticates
315 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
316 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800317 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800318 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700319 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
320 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800321 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
322 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700323 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800324 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800325 ... ${ONOS_SSH_PORT} ${onu_port}
326 END
327 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
328 Scale K8s Deployment voltha adapter-open-olt 0
329 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
330 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
331 Scale K8s Deployment voltha adapter-open-olt 1
332 Wait Until Keyword Succeeds ${timeout} 2s
333 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
334
335 # Ensure the device is available in ONOS, this represents system connectivity being restored
336 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800337 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800338
339 FOR ${I} IN RANGE 0 ${num_onus}
340 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800341 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800342 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
343 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
344 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
345 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
346 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
347 ... ${dst['container_name']}
348 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800349 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800350 END
351
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000352Verify restart ofagent container after VOLTHA is operational
353 [Documentation] Restart ofagent container after VOLTHA is operational.
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000354 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530355 #TODO: remove "notready" tag once olt reboot and ofagent restart work items are done
356 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavierabeba262020-02-07 16:22:16 -0700357 [Setup] Run Keywords Announce Message START TEST ofagentRestart
358 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700359 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700360 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700361 ... AND Announce Message END TEST ofagentRestart
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530362 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000363 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700364 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000365 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700366 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530367 ${podName} Set Variable ofagent
368 Restart Pod ${NAMESPACE} ${podName}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000369 Sleep 60s
370 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
371 ... Running
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530372 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
373 Run Keyword If ${has_dataplane} Clean Up Linux
374 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700375 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000376 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700377 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000378 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530379 # Scale Down the Of-Agent Deployment
380 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 0
381 Sleep 30s
382 FOR ${I} IN RANGE 0 ${num_onus}
383 ${src}= Set Variable ${hosts.src[${I}]}
384 ${dst}= Set Variable ${hosts.dst[${I}]}
385 Run Keyword and Ignore Error Collect Logs
386 ${onu_device_id}= Get Device ID From SN ${src['onu']}
387 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
388 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
389 # Verify ONU state in voltha
390 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
391 ... ENABLED ACTIVE REACHABLE
392 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
393 # Check ONU port is Disabled in ONOS
394 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
395 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
396 # Verify EAPOL flows are present for the ONU port
397 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
398 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
399 # Verify ONU in AAA-Users
400 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
401 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
402 # Verify DHCP-Allocations
403 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
404 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
405 # Verify Ping
406 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
407 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
408 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
409 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
410 Run Keyword and Ignore Error Collect Logs
411 END
412 # Scale Up the Of-Agent Deployment
413 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
414 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
415 ... Running
416 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
417 Run Keyword If ${has_dataplane} Clean Up Linux
418 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
419 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000420
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000421Check ONU adapter crash not forcing authentication again
422 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
423 ... message count to make sure auth not started again and validates EAP status and ping.
424 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
425 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700426 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
427 ... AND Start Logging ONUAdaptCrash
428 [Teardown] Run Keywords Collect Logs
429 ... AND Stop Logging ONUAdaptCrash
430 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000431 @{before_list}= Create List
432 @{after_list}= Create List
433 FOR ${I} IN RANGE 0 ${num_onus}
434 ${src}= Set Variable ${hosts.src[${I}]}
435 ${dst}= Set Variable ${hosts.dst[${I}]}
436 ${onu_device_id}= Get Device ID From SN ${src['onu']}
437 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
438 ... ${of_id}
439 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
440 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
441 ... ${src['container_type']} ${src['container_name']}
442 Append To List ${before_list} ${before}
443 END
444 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
445 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
446 ... Running
447 FOR ${I} IN RANGE 0 ${num_onus}
448 ${src}= Set Variable ${hosts.src[${I}]}
449 ${dst}= Set Variable ${hosts.dst[${I}]}
450 ${onu_device_id}= Get Device ID From SN ${src['onu']}
451 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
452 ... ${of_id}
453 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
454 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
455 ... ${src['container_type']} ${src['container_name']}
456 Append To List ${after_list} ${after}
457 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
458 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
459 ... ${src['container_type']} ${src['container_name']}
460 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
461 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
462 ... Wait Until Keyword Succeeds 60s 2s Check Ping
463 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
464 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
465 END
466 Lists Should Be Equal ${after_list} ${before_list}
467 Log ${after_list}
468 Log ${before_list}
469 Run Keyword and Ignore Error Collect Logs
470
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000471ONU Reboot
472 [Documentation] Reboot ONU and verify that ONU comes up properly
473 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700474 [Setup] Run Keywords Announce Message START TEST RebootONU
475 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700476 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700477 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700478 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000479 FOR ${I} IN RANGE 0 ${num_onus}
480 ${src}= Set Variable ${hosts.src[${I}]}
481 ${dst}= Set Variable ${hosts.dst[${I}]}
482 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800483 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
484 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000485 Reboot ONU ${onu_device_id} ${src} ${dst}
486 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800487 # Check ONU port is Enabled in ONOS
488 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800489 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800490 # Verify EAPOL flows are added for the ONU port
491 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800492 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800493 # Verify ONU state in voltha
494 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
495 ... ENABLED ACTIVE REACHABLE
496 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
497 # Verify pings are successful after reboot on the current ONU
498 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
499 ... Wait Until Keyword Succeeds 60s 2s
500 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
501 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000502 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800503 #Run Keyword If ${has_dataplane} Clean Up Linux
504 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
505 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800506
507*** Keywords ***
508Setup Suite
509 [Documentation] Set up the test suite
510 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500511 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700512 ${switch_type}= Get Variable Value ${web_power_switch.type}
513 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800514
515Clear All Devices Then Create New Device
516 [Documentation] Remove any devices from VOLTHA and ONOS
517 # Remove all devices from voltha and nos
518 Delete All Devices and Verify
519 # Execute normal test Setup Keyword
520 Setup