blob: f9f5118b348e08a7ee314499b9b63e2b836ea8dc [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
107Verify restart openolt-adapter container after VOLTHA is operational
108 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
109 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800110 [Tags] functional VOL-1958 Restart-OpenOlt released
111 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
112 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800113 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800114 ... AND Stop Logging Restart-OpenOlt
115 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800116 # Add OLT device
117 setup
118 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
119 Run Keyword If ${has_dataplane} Clean Up Linux
120 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
121 ${waitforRestart} Set Variable 120s
122 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
123 Log ${podStatusOutput}
124 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
125 ${podName} Set Variable adapter-open-olt
126 Restart Pod ${NAMESPACE} ${podName}
127 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
128 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700129 # Wait for 1min after openolt adapter is restarted
130 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800131 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800132 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800133 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
134 Log ${podStatusOutput}
135 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
136 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
137 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800138
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800139Check OLT/ONU Authentication After Radius Pod Restart
140 [Documentation] After radius restart, triggers reassociation, checks status and
141 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
142 ... wpa supplicant is running in background hence it is recommended to remove
143 ... teardown from previous test or uncomment 'Teardown None'.
144 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
145 [Tags] functional RadiusRestart released
146 [Setup] Run Keywords Announce Message START TEST RadiusRestart
147 ... AND Start Logging RadiusRestart
148 [Teardown] Run Keywords Collect Logs
149 ... AND Stop Logging RadiusRestart
150 ... AND Announce Message END TEST RadiusRestart
151 ${waitforRestart} Set Variable 120s
152 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
153 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME} ${NAMESPACE}
154 ... Running
155 FOR ${I} IN RANGE 0 ${num_onus}
156 ${src}= Set Variable ${hosts.src[${I}]}
157 ${dst}= Set Variable ${hosts.dst[${I}]}
158 ${onu_device_id}= Get Device ID From SN ${src['onu']}
159 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
160 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
161 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800162 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800163 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
164 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
165 ... ${src['ip']} ${src['user']} ${src['pass']}
166 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800167 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800168 ... ${ONOS_SSH_PORT} ${onu_port}
169 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
170 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
171 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
172 ... ${src['ip']} ${src['user']} ${src['pass']}
173 ... ${src['container_type']} ${src['container_name']}
174 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
175 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
176 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800177 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800178 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
179 Run Keyword and Ignore Error Collect Logs
180 END
181
182Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
183 [Documentation] Deploys an device instance and waits for it to authenticate. After
184 ... authentication is successful the rw-core deployment is scaled to 0 instances to
185 ... simulate a POD crash. The test then scales the rw-core back to a single instance
186 ... and configures ONOS for access. The test succeeds if the device is able to
187 ... complete the DHCP sequence.
ubuntu6b6e7d42020-03-02 12:35:42 -0800188 [Tags] bbsim rwcore-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800189 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
190 ... AND Start Logging RwCoreFailAndRestart
191 ... AND Clear All Devices Then Create New Device
192 [Teardown] Run Keywords Collect Logs
193 ... AND Stop Logging RwCoreFailAndRestart
194 ... AND Announce Message END TEST RwCoreFailAndRestart
195 ... AND Delete Device and Verify
196 Run Keyword and Ignore Error Collect Logs
197 Run Keyword If ${has_dataplane} Clean Up Linux
198 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
199 Set Global Variable ${of_id}
200 FOR ${I} IN RANGE 0 ${num_onus}
201 ${src}= Set Variable ${hosts.src[${I}]}
202 ${dst}= Set Variable ${hosts.dst[${I}]}
203 ${onu_device_id}= Get Device ID From SN ${src['onu']}
204 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
205 ... ${of_id}
206 # Bring up the device and verify it authenticates
207 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
208 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800209 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800210 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700211 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
212 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800213 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
214 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700215 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800216 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800217 ... ${ONOS_SSH_PORT} ${onu_port}
218 END
219
220 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
221 Scale K8s Deployment voltha voltha-rw-core 0
222 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
223 # Ensure the ofagent POD goes "not-ready" as expected
224 Wait Until keyword Succeeds ${timeout} 2s
225 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
226 # Scale up the core deployment and make sure both it and the ofagent deployment are back
227 Scale K8s Deployment voltha voltha-rw-core 1
228 Wait Until Keyword Succeeds ${timeout} 2s
229 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
230 Wait Until Keyword Succeeds ${timeout} 2s
231 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
232 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
233 # so restart the port forwarding for the API service
234 Restart VOLTHA Port Foward voltha-api-minimal
235 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
236 # represents system connectivity being restored
237 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800238 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800239
240 FOR ${I} IN RANGE 0 ${num_onus}
241 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800242 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800243 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
244 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
245 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
246 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
247 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
248 ... ${dst['container_name']}
249 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800250 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800251 END
252
253Sanity E2E Test for OLT/ONU on POD With OLT Adapters Fail and Restart
254 [Documentation] Deploys an device instance and waits for it to authenticate. After
255 ... authentication is successful the rw-core deployment is scaled to 0 instances to
256 ... simulate a POD crash. The test then scales the rw-core back to a single instance
257 ... and configures ONOS for access. The test succeeds if the device is able to
258 ... complete the DHCP sequence.
259 [Tags] bbsim olt-adapter-restart
260 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
261 ... AND Start Logging OltAdapterRestart
262 ... AND Clear All Devices Then Create New Device
263 [Teardown] Run Keywords Collect Logs
264 ... AND Stop Logging OltAdapterRestart
265 ... AND Announce Message END TEST OltAdapterRestart
266 Run Keyword If ${has_dataplane} Clean Up Linux
267 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
268 Set Global Variable ${of_id}
269
270 FOR ${I} IN RANGE 0 ${num_onus}
271 ${src}= Set Variable ${hosts.src[${I}]}
272 ${dst}= Set Variable ${hosts.dst[${I}]}
273 ${onu_device_id}= Get Device ID From SN ${src['onu']}
274 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
275 ... ${of_id}
276
277 # Bring up the device and verify it authenticates
278 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
279 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800280 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800281 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700282 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
283 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800284 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
285 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700286 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800287 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800288 ... ${ONOS_SSH_PORT} ${onu_port}
289 END
290 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
291 Scale K8s Deployment voltha adapter-open-olt 0
292 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
293 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
294 Scale K8s Deployment voltha adapter-open-olt 1
295 Wait Until Keyword Succeeds ${timeout} 2s
296 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
297
298 # Ensure the device is available in ONOS, this represents system connectivity being restored
299 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800300 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800301
302 FOR ${I} IN RANGE 0 ${num_onus}
303 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800304 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800305 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
306 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
307 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
308 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
309 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
310 ... ${dst['container_name']}
311 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800312 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800313 END
314
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000315Verify restart ofagent container after VOLTHA is operational
316 [Documentation] Restart ofagent container after VOLTHA is operational.
317 ... Please note this test case should be run before the restart of other containers.
318 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuriddba81e2020-02-23 22:15:53 -0800319 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavierabeba262020-02-07 16:22:16 -0700320 [Setup] Run Keywords Announce Message START TEST ofagentRestart
321 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700322 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700323 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700324 ... AND Announce Message END TEST ofagentRestart
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000325 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700326 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000327 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700328 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000329 Restart Pod ${NAMESPACE} ofagent
330 Sleep 60s
331 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
332 ... Running
333 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700334 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000335 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700336 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000337 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000338
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000339Check ONU adapter crash not forcing authentication again
340 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
341 ... message count to make sure auth not started again and validates EAP status and ping.
342 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
343 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700344 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
345 ... AND Start Logging ONUAdaptCrash
346 [Teardown] Run Keywords Collect Logs
347 ... AND Stop Logging ONUAdaptCrash
348 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000349 @{before_list}= Create List
350 @{after_list}= Create List
351 FOR ${I} IN RANGE 0 ${num_onus}
352 ${src}= Set Variable ${hosts.src[${I}]}
353 ${dst}= Set Variable ${hosts.dst[${I}]}
354 ${onu_device_id}= Get Device ID From SN ${src['onu']}
355 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
356 ... ${of_id}
357 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
358 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
359 ... ${src['container_type']} ${src['container_name']}
360 Append To List ${before_list} ${before}
361 END
362 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
363 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
364 ... Running
365 FOR ${I} IN RANGE 0 ${num_onus}
366 ${src}= Set Variable ${hosts.src[${I}]}
367 ${dst}= Set Variable ${hosts.dst[${I}]}
368 ${onu_device_id}= Get Device ID From SN ${src['onu']}
369 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
370 ... ${of_id}
371 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
372 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
373 ... ${src['container_type']} ${src['container_name']}
374 Append To List ${after_list} ${after}
375 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
376 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
377 ... ${src['container_type']} ${src['container_name']}
378 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
379 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
380 ... Wait Until Keyword Succeeds 60s 2s Check Ping
381 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
382 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
383 END
384 Lists Should Be Equal ${after_list} ${before_list}
385 Log ${after_list}
386 Log ${before_list}
387 Run Keyword and Ignore Error Collect Logs
388
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000389ONU Reboot
390 [Documentation] Reboot ONU and verify that ONU comes up properly
391 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700392 [Setup] Run Keywords Announce Message START TEST RebootONU
393 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700394 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700395 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700396 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000397 FOR ${I} IN RANGE 0 ${num_onus}
398 ${src}= Set Variable ${hosts.src[${I}]}
399 ${dst}= Set Variable ${hosts.dst[${I}]}
400 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800401 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
402 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000403 Reboot ONU ${onu_device_id} ${src} ${dst}
404 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800405 # Check ONU port is Enabled in ONOS
406 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800407 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800408 # Verify EAPOL flows are added for the ONU port
409 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800410 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800411 # Verify ONU state in voltha
412 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
413 ... ENABLED ACTIVE REACHABLE
414 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
415 # Verify pings are successful after reboot on the current ONU
416 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
417 ... Wait Until Keyword Succeeds 60s 2s
418 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
419 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000420 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800421 #Run Keyword If ${has_dataplane} Clean Up Linux
422 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
423 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800424
425*** Keywords ***
426Setup Suite
427 [Documentation] Set up the test suite
428 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500429 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700430 ${switch_type}= Get Variable Value ${web_power_switch.type}
431 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800432
433Clear All Devices Then Create New Device
434 [Documentation] Remove any devices from VOLTHA and ONOS
435 # Remove all devices from voltha and nos
436 Delete All Devices and Verify
437 # Execute normal test Setup Keyword
438 Setup