blob: 6f773bd11f434bc422d7baef1bb9c343069d7203 [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 Vemuri0656bc22020-03-21 19:07:49 -070070 ... AND Delete Device and Verify
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080071 # Add OLT device
72 setup
73 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
74 Run Keyword If ${has_dataplane} Clean Up Linux
75 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
76 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
77 FOR ${I} IN RANGE 0 ${num_onus}
78 ${src}= Set Variable ${hosts.src[${I}]}
79 ${dst}= Set Variable ${hosts.dst[${I}]}
80 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
81 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
82 Disable Switch Outlet ${src['power_switch_port']}
83 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
84 ... Wait Until Keyword Succeeds 60s 2s
85 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
86 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
87
88 Enable Switch Outlet ${src['power_switch_port']}
89 # Check ONU port is Enabled in ONOS
90 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080091 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080092 # Verify EAPOL flows are added for the ONU port
93 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080094 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080095 # Verify ONU state in voltha
96 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
97 ... ENABLED ACTIVE REACHABLE
98 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080099 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
100 ... Wait Until Keyword Succeeds 60s 2s
101 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
102 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
103 Run Keyword And Ignore Error Collect Logs
104 END
Suchitra Vemurid7096132020-02-21 14:50:47 -0800105 # Deleting OLT after tests completes independently (as this test doesn't not run on each POD)
Suchitra Vemuri0656bc22020-03-21 19:07:49 -0700106 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800107
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700108Verify OLT after rebooting physically
109 [Documentation] Test the physical reboot of the OLT
110 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
111 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
112 ... VOL-1956
113 [Tags] functional PhysicalOLTReboot
114 [Setup] Run Keywords Announce Message START TEST PhysicalOLTReboot
115 ... AND Start Logging PhysicalOLTReboot
116 [Teardown] Run Keywords Collect Logs
117 ... AND Stop Logging PhysicalOLTReboot
118 ... AND Announce Message END TEST PhysicalOLTReboot
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700119 ... AND Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700120 # Add OLT device
121 setup
122 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
123 Run Keyword If ${has_dataplane} Clean Up Linux
124 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
125 # Reboot the OLT from the OLT CLI
126 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
127 ... sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
128 Run Keyword And Ignore Error Collect Logs
129 FOR ${I} IN RANGE 0 ${num_onus}
130 ${src}= Set Variable ${hosts.src[${I}]}
131 ${dst}= Set Variable ${hosts.dst[${I}]}
132 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
133 ... Wait Until Keyword Succeeds 60s 2s
134 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
135 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
136 END
137 # Wait for the OLT to come back up
138 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
139 Run Keyword And Ignore Error Collect Logs
140 Run Keyword If ${has_dataplane} Clean Up Linux
141 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
142 # Deleting OLT after test completes
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700143 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700144
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800145Verify restart openolt-adapter container after VOLTHA is operational
146 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
147 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800148 [Tags] functional VOL-1958 Restart-OpenOlt released
149 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
150 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800151 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800152 ... AND Stop Logging Restart-OpenOlt
153 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800154 # Add OLT device
155 setup
156 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
157 Run Keyword If ${has_dataplane} Clean Up Linux
158 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
159 ${waitforRestart} Set Variable 120s
160 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
161 Log ${podStatusOutput}
162 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
163 ${podName} Set Variable adapter-open-olt
164 Restart Pod ${NAMESPACE} ${podName}
165 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
166 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700167 # Wait for 1min after openolt adapter is restarted
168 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800169 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800170 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800171 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
172 Log ${podStatusOutput}
173 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
174 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
175 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800176
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800177Check OLT/ONU Authentication After Radius Pod Restart
178 [Documentation] After radius restart, triggers reassociation, checks status and
179 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
180 ... wpa supplicant is running in background hence it is recommended to remove
181 ... teardown from previous test or uncomment 'Teardown None'.
182 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
183 [Tags] functional RadiusRestart released
184 [Setup] Run Keywords Announce Message START TEST RadiusRestart
185 ... AND Start Logging RadiusRestart
186 [Teardown] Run Keywords Collect Logs
187 ... AND Stop Logging RadiusRestart
188 ... AND Announce Message END TEST RadiusRestart
189 ${waitforRestart} Set Variable 120s
190 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
191 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME} ${NAMESPACE}
192 ... Running
193 FOR ${I} IN RANGE 0 ${num_onus}
194 ${src}= Set Variable ${hosts.src[${I}]}
195 ${dst}= Set Variable ${hosts.dst[${I}]}
196 ${onu_device_id}= Get Device ID From SN ${src['onu']}
197 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
198 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
199 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800200 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800201 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
202 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
203 ... ${src['ip']} ${src['user']} ${src['pass']}
204 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800205 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800206 ... ${ONOS_SSH_PORT} ${onu_port}
207 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
208 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
209 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
210 ... ${src['ip']} ${src['user']} ${src['pass']}
211 ... ${src['container_type']} ${src['container_name']}
212 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
213 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
214 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800215 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800216 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
217 Run Keyword and Ignore Error Collect Logs
218 END
219
220Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
221 [Documentation] Deploys an device instance and waits for it to authenticate. After
222 ... authentication is successful the rw-core deployment is scaled to 0 instances to
223 ... simulate a POD crash. The test then scales the rw-core back to a single instance
224 ... and configures ONOS for access. The test succeeds if the device is able to
225 ... complete the DHCP sequence.
ubuntu6b6e7d42020-03-02 12:35:42 -0800226 [Tags] bbsim rwcore-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800227 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
228 ... AND Start Logging RwCoreFailAndRestart
229 ... AND Clear All Devices Then Create New Device
230 [Teardown] Run Keywords Collect Logs
231 ... AND Stop Logging RwCoreFailAndRestart
232 ... AND Announce Message END TEST RwCoreFailAndRestart
233 ... AND Delete Device and Verify
234 Run Keyword and Ignore Error Collect Logs
235 Run Keyword If ${has_dataplane} Clean Up Linux
236 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
237 Set Global Variable ${of_id}
238 FOR ${I} IN RANGE 0 ${num_onus}
239 ${src}= Set Variable ${hosts.src[${I}]}
240 ${dst}= Set Variable ${hosts.dst[${I}]}
241 ${onu_device_id}= Get Device ID From SN ${src['onu']}
242 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
243 ... ${of_id}
244 # Bring up the device and verify it authenticates
245 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
246 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800247 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800248 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700249 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
250 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800251 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
252 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700253 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800254 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800255 ... ${ONOS_SSH_PORT} ${onu_port}
256 END
257
258 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
259 Scale K8s Deployment voltha voltha-rw-core 0
260 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
261 # Ensure the ofagent POD goes "not-ready" as expected
262 Wait Until keyword Succeeds ${timeout} 2s
263 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
264 # Scale up the core deployment and make sure both it and the ofagent deployment are back
265 Scale K8s Deployment voltha voltha-rw-core 1
266 Wait Until Keyword Succeeds ${timeout} 2s
267 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
268 Wait Until Keyword Succeeds ${timeout} 2s
269 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
270 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
271 # so restart the port forwarding for the API service
272 Restart VOLTHA Port Foward voltha-api-minimal
273 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
274 # represents system connectivity being restored
275 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800276 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800277
278 FOR ${I} IN RANGE 0 ${num_onus}
279 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800280 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800281 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
282 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
283 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
284 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
285 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
286 ... ${dst['container_name']}
287 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800288 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800289 END
290
291Sanity E2E Test for OLT/ONU on POD With OLT Adapters Fail and Restart
292 [Documentation] Deploys an device instance and waits for it to authenticate. After
293 ... authentication is successful the rw-core deployment is scaled to 0 instances to
294 ... simulate a POD crash. The test then scales the rw-core back to a single instance
295 ... and configures ONOS for access. The test succeeds if the device is able to
296 ... complete the DHCP sequence.
297 [Tags] bbsim olt-adapter-restart
298 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
299 ... AND Start Logging OltAdapterRestart
300 ... AND Clear All Devices Then Create New Device
301 [Teardown] Run Keywords Collect Logs
302 ... AND Stop Logging OltAdapterRestart
303 ... AND Announce Message END TEST OltAdapterRestart
304 Run Keyword If ${has_dataplane} Clean Up Linux
305 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
306 Set Global Variable ${of_id}
307
308 FOR ${I} IN RANGE 0 ${num_onus}
309 ${src}= Set Variable ${hosts.src[${I}]}
310 ${dst}= Set Variable ${hosts.dst[${I}]}
311 ${onu_device_id}= Get Device ID From SN ${src['onu']}
312 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
313 ... ${of_id}
314
315 # Bring up the device and verify it authenticates
316 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
317 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800318 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800319 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700320 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
321 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800322 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
323 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700324 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800325 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800326 ... ${ONOS_SSH_PORT} ${onu_port}
327 END
328 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
329 Scale K8s Deployment voltha adapter-open-olt 0
330 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
331 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
332 Scale K8s Deployment voltha adapter-open-olt 1
333 Wait Until Keyword Succeeds ${timeout} 2s
334 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
335
336 # Ensure the device is available in ONOS, this represents system connectivity being restored
337 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800338 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800339
340 FOR ${I} IN RANGE 0 ${num_onus}
341 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800342 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800343 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
344 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
345 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
346 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
347 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
348 ... ${dst['container_name']}
349 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800350 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800351 END
352
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000353Verify restart ofagent container after VOLTHA is operational
354 [Documentation] Restart ofagent container after VOLTHA is operational.
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000355 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530356 #TODO: remove "notready" tag once olt reboot and ofagent restart work items are done
357 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavierabeba262020-02-07 16:22:16 -0700358 [Setup] Run Keywords Announce Message START TEST ofagentRestart
359 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700360 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700361 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700362 ... AND Announce Message END TEST ofagentRestart
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530363 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000364 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700365 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000366 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700367 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530368 ${podName} Set Variable ofagent
369 Restart Pod ${NAMESPACE} ${podName}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000370 Sleep 60s
371 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
372 ... Running
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530373 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
374 Run Keyword If ${has_dataplane} Clean Up Linux
375 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700376 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000377 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700378 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000379 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530380 # Scale Down the Of-Agent Deployment
381 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 0
382 Sleep 30s
383 FOR ${I} IN RANGE 0 ${num_onus}
384 ${src}= Set Variable ${hosts.src[${I}]}
385 ${dst}= Set Variable ${hosts.dst[${I}]}
386 Run Keyword and Ignore Error Collect Logs
387 ${onu_device_id}= Get Device ID From SN ${src['onu']}
388 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
389 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
390 # Verify ONU state in voltha
391 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
392 ... ENABLED ACTIVE REACHABLE
393 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
394 # Check ONU port is Disabled in ONOS
395 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
396 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
397 # Verify EAPOL flows are present for the ONU port
398 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
399 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
400 # Verify ONU in AAA-Users
401 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
402 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
403 # Verify DHCP-Allocations
404 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
405 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
406 # Verify Ping
407 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
408 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
409 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
410 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
411 Run Keyword and Ignore Error Collect Logs
412 END
413 # Scale Up the Of-Agent Deployment
414 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
415 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
416 ... Running
417 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
418 Run Keyword If ${has_dataplane} Clean Up Linux
419 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
420 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000421
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000422Check ONU adapter crash not forcing authentication again
423 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
424 ... message count to make sure auth not started again and validates EAP status and ping.
425 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
426 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700427 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
428 ... AND Start Logging ONUAdaptCrash
429 [Teardown] Run Keywords Collect Logs
430 ... AND Stop Logging ONUAdaptCrash
431 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000432 @{before_list}= Create List
433 @{after_list}= Create List
434 FOR ${I} IN RANGE 0 ${num_onus}
435 ${src}= Set Variable ${hosts.src[${I}]}
436 ${dst}= Set Variable ${hosts.dst[${I}]}
437 ${onu_device_id}= Get Device ID From SN ${src['onu']}
438 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
439 ... ${of_id}
440 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
441 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
442 ... ${src['container_type']} ${src['container_name']}
443 Append To List ${before_list} ${before}
444 END
445 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
446 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
447 ... Running
448 FOR ${I} IN RANGE 0 ${num_onus}
449 ${src}= Set Variable ${hosts.src[${I}]}
450 ${dst}= Set Variable ${hosts.dst[${I}]}
451 ${onu_device_id}= Get Device ID From SN ${src['onu']}
452 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
453 ... ${of_id}
454 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
455 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
456 ... ${src['container_type']} ${src['container_name']}
457 Append To List ${after_list} ${after}
458 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
459 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
460 ... ${src['container_type']} ${src['container_name']}
461 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
462 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
463 ... Wait Until Keyword Succeeds 60s 2s Check Ping
464 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
465 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
466 END
467 Lists Should Be Equal ${after_list} ${before_list}
468 Log ${after_list}
469 Log ${before_list}
470 Run Keyword and Ignore Error Collect Logs
471
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000472ONU Reboot
473 [Documentation] Reboot ONU and verify that ONU comes up properly
474 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700475 [Setup] Run Keywords Announce Message START TEST RebootONU
476 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700477 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700478 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700479 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000480 FOR ${I} IN RANGE 0 ${num_onus}
481 ${src}= Set Variable ${hosts.src[${I}]}
482 ${dst}= Set Variable ${hosts.dst[${I}]}
483 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800484 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
485 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000486 Reboot ONU ${onu_device_id} ${src} ${dst}
487 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800488 # Check ONU port is Enabled in ONOS
489 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800490 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800491 # Verify EAPOL flows are added for the ONU port
492 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800493 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800494 # Verify ONU state in voltha
495 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
496 ... ENABLED ACTIVE REACHABLE
497 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
498 # Verify pings are successful after reboot on the current ONU
499 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
500 ... Wait Until Keyword Succeeds 60s 2s
501 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
502 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000503 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800504 #Run Keyword If ${has_dataplane} Clean Up Linux
505 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
506 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800507
508*** Keywords ***
509Setup Suite
510 [Documentation] Set up the test suite
511 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500512 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700513 ${switch_type}= Get Variable Value ${web_power_switch.type}
514 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800515
516Clear All Devices Then Create New Device
517 [Documentation] Remove any devices from VOLTHA and ONOS
518 # Remove all devices from voltha and nos
519 Delete All Devices and Verify
520 # Execute normal test Setup Keyword
521 Setup