blob: 7d5348c77f283e2323c63b2813d42adc9963639a [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
Suchitra Vemurica1c5d32020-04-09 18:45:29 -070044${DEFAULTSPACE} default
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000045# For below variable value, using deployment name as using grep for
46# parsing radius pod name, we can also use full radius pod name
47${RESTART_POD_NAME} radius
48${timeout} 60s
49${of_id} 0
50${logical_id} 0
Suchitra Vemuri109feb12020-01-23 16:25:02 -080051${has_dataplane} True
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000052${teardown_device} False
53${scripts} ../../scripts
54
Andy Bavierabeba262020-02-07 16:22:16 -070055# Per-test logging on failure is turned off by default; set this variable to enable
56${container_log_dir} ${None}
57
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000058*** Test Cases ***
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080059Verify ONU after rebooting physically
60 [Documentation] Test the ONU functionality by physically turning on/off ONU.
61 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
62 ... Test case runs only on the PODs that are configured with PowerSwitch that
63 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
64 ... VOL-2634
65 [Tags] functional PowerSwitch
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080066 [Setup] Run Keywords Announce Message START TEST ONUreboot_PowerSwitch
67 ... AND Start Logging ONUreboot_PowerSwitch
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080068 [Teardown] Run Keywords Collect Logs
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080069 ... AND Stop Logging ONUreboot_PowerSwitch
70 ... AND Announce Message END TEST ONUreboot_PowerSwitch
Suchitra Vemuri0656bc22020-03-21 19:07:49 -070071 ... AND Delete Device and Verify
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080072 # Add OLT device
73 setup
74 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
75 Run Keyword If ${has_dataplane} Clean Up Linux
76 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
77 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
78 FOR ${I} IN RANGE 0 ${num_onus}
79 ${src}= Set Variable ${hosts.src[${I}]}
80 ${dst}= Set Variable ${hosts.dst[${I}]}
81 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
82 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
83 Disable Switch Outlet ${src['power_switch_port']}
84 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
85 ... Wait Until Keyword Succeeds 60s 2s
86 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
87 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
88
89 Enable Switch Outlet ${src['power_switch_port']}
90 # Check ONU port is Enabled in ONOS
91 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080092 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080093 # Verify EAPOL flows are added for the ONU port
94 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -080095 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080096 # Verify ONU state in voltha
97 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
98 ... ENABLED ACTIVE REACHABLE
99 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass21807632020-04-14 16:24:55 +0530100 # Verify subscriber access flows are added for the ONU port
101 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
102 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
103 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800104 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
105 ... Wait Until Keyword Succeeds 60s 2s
106 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
107 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
108 Run Keyword And Ignore Error Collect Logs
109 END
Suchitra Vemurid7096132020-02-21 14:50:47 -0800110 # Deleting OLT after tests completes independently (as this test doesn't not run on each POD)
Suchitra Vemuri0656bc22020-03-21 19:07:49 -0700111 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800112
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700113Verify OLT after rebooting physically
114 [Documentation] Test the physical reboot of the OLT
115 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
116 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
117 ... VOL-1956
118 [Tags] functional PhysicalOLTReboot
119 [Setup] Run Keywords Announce Message START TEST PhysicalOLTReboot
120 ... AND Start Logging PhysicalOLTReboot
121 [Teardown] Run Keywords Collect Logs
122 ... AND Stop Logging PhysicalOLTReboot
123 ... AND Announce Message END TEST PhysicalOLTReboot
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700124 ... AND Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700125 # Add OLT device
126 setup
127 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
128 Run Keyword If ${has_dataplane} Clean Up Linux
129 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
130 # Reboot the OLT from the OLT CLI
131 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
132 ... sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
133 Run Keyword And Ignore Error Collect Logs
134 FOR ${I} IN RANGE 0 ${num_onus}
135 ${src}= Set Variable ${hosts.src[${I}]}
136 ${dst}= Set Variable ${hosts.dst[${I}]}
137 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
138 ... Wait Until Keyword Succeeds 60s 2s
139 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
140 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
141 END
142 # Wait for the OLT to come back up
Andy Bavier8da0e132020-04-13 10:25:16 -0700143 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
144 ... Check Remote System Reachability True ${olt_ip}
Suchitra Vemuri64db9652020-03-22 21:11:13 -0700145 # Waiting extra time for the ONUs to come up
146 Sleep 60s
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700147 Run Keyword And Ignore Error Collect Logs
148 Run Keyword If ${has_dataplane} Clean Up Linux
149 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
150 # Deleting OLT after test completes
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700151 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700152
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700153Verify restart openolt-adapter container after subscriber provisioning
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800154 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
155 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800156 [Tags] functional VOL-1958 Restart-OpenOlt released
157 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
158 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800159 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800160 ... AND Stop Logging Restart-OpenOlt
161 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800162 # Add OLT device
163 setup
164 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
165 Run Keyword If ${has_dataplane} Clean Up Linux
166 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
167 ${waitforRestart} Set Variable 120s
168 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
169 Log ${podStatusOutput}
170 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
171 ${podName} Set Variable adapter-open-olt
172 Restart Pod ${NAMESPACE} ${podName}
173 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
174 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700175 # Wait for 1min after openolt adapter is restarted
176 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800177 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800178 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800179 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
180 Log ${podStatusOutput}
181 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
182 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
183 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800184
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800185Check OLT/ONU Authentication After Radius Pod Restart
186 [Documentation] After radius restart, triggers reassociation, checks status and
187 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
188 ... wpa supplicant is running in background hence it is recommended to remove
189 ... teardown from previous test or uncomment 'Teardown None'.
190 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
191 [Tags] functional RadiusRestart released
192 [Setup] Run Keywords Announce Message START TEST RadiusRestart
193 ... AND Start Logging RadiusRestart
194 [Teardown] Run Keywords Collect Logs
195 ... AND Stop Logging RadiusRestart
196 ... AND Announce Message END TEST RadiusRestart
197 ${waitforRestart} Set Variable 120s
Suchitra Vemurica1c5d32020-04-09 18:45:29 -0700198 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${DEFAULTSPACE} ${RESTART_POD_NAME}
199 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME}
200 ... ${DEFAULTSPACE} Running
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800201 FOR ${I} IN RANGE 0 ${num_onus}
202 ${src}= Set Variable ${hosts.src[${I}]}
203 ${dst}= Set Variable ${hosts.dst[${I}]}
204 ${onu_device_id}= Get Device ID From SN ${src['onu']}
205 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
206 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
207 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800208 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800209 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
210 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
211 ... ${src['ip']} ${src['user']} ${src['pass']}
212 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800213 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800214 ... ${ONOS_SSH_PORT} ${onu_port}
215 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
216 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
217 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
218 ... ${src['ip']} ${src['user']} ${src['pass']}
219 ... ${src['container_type']} ${src['container_name']}
220 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
221 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
222 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800223 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800224 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
225 Run Keyword and Ignore Error Collect Logs
226 END
227
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700228Verify openolt adapter restart before subscriber provisioning
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800229 [Documentation] Deploys an device instance and waits for it to authenticate. After
230 ... authentication is successful the rw-core deployment is scaled to 0 instances to
231 ... simulate a POD crash. The test then scales the rw-core back to a single instance
232 ... and configures ONOS for access. The test succeeds if the device is able to
233 ... complete the DHCP sequence.
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700234 [Tags] functional olt-adapter-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800235 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
236 ... AND Start Logging OltAdapterRestart
Suchitra Vemuria0c086f2020-03-29 19:14:13 -0700237 #... AND Clear All Devices Then Create New Device
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800238 [Teardown] Run Keywords Collect Logs
239 ... AND Stop Logging OltAdapterRestart
240 ... AND Announce Message END TEST OltAdapterRestart
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700241 # Add OLT and perform sanity test
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700242 #setup
Suchitra Vemuri91537c82020-03-29 15:03:26 -0700243 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700244 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800245 Set Global Variable ${of_id}
246
247 FOR ${I} IN RANGE 0 ${num_onus}
248 ${src}= Set Variable ${hosts.src[${I}]}
249 ${dst}= Set Variable ${hosts.dst[${I}]}
250 ${onu_device_id}= Get Device ID From SN ${src['onu']}
251 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
252 ... ${of_id}
253
254 # Bring up the device and verify it authenticates
255 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
256 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800257 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800258 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700259 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
260 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800261 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
262 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700263 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800264 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800265 ... ${ONOS_SSH_PORT} ${onu_port}
266 END
267 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
268 Scale K8s Deployment voltha adapter-open-olt 0
269 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
270 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
271 Scale K8s Deployment voltha adapter-open-olt 1
272 Wait Until Keyword Succeeds ${timeout} 2s
273 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
274
275 # Ensure the device is available in ONOS, this represents system connectivity being restored
276 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800277 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800278
279 FOR ${I} IN RANGE 0 ${num_onus}
280 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800281 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800282 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530283 # Verify subscriber access flows are added for the ONU port
284 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
285 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
286 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800287 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
288 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
289 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
290 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
291 ... ${dst['container_name']}
292 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800293 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800294 END
295
hwchiu14c05102020-03-27 00:44:30 +0000296Verify restart ofagent container after subscriber is provisioned
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000297 [Documentation] Restart ofagent container after VOLTHA is operational.
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000298 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass7a846662020-03-19 20:42:59 +0530299 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -0700300 [Setup] Run Keywords Announce Message START TEST ofagentRestart
301 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700302 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700303 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700304 ... AND Announce Message END TEST ofagentRestart
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530305 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
Suchitra Vemuriceb002a2020-03-25 13:36:21 -0700306 # set timeout value
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000307 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700308 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000309 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700310 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530311 ${podName} Set Variable ofagent
312 Restart Pod ${NAMESPACE} ${podName}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000313 Sleep 60s
314 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
315 ... Running
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530316 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
317 Run Keyword If ${has_dataplane} Clean Up Linux
318 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700319 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000320 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700321 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000322 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530323 # Scale Down the Of-Agent Deployment
324 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 0
325 Sleep 30s
326 FOR ${I} IN RANGE 0 ${num_onus}
327 ${src}= Set Variable ${hosts.src[${I}]}
328 ${dst}= Set Variable ${hosts.dst[${I}]}
329 Run Keyword and Ignore Error Collect Logs
330 ${onu_device_id}= Get Device ID From SN ${src['onu']}
331 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
332 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
333 # Verify ONU state in voltha
334 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
335 ... ENABLED ACTIVE REACHABLE
336 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
337 # Check ONU port is Disabled in ONOS
338 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
339 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
340 # Verify EAPOL flows are present for the ONU port
341 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
342 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
343 # Verify ONU in AAA-Users
344 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
345 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
346 # Verify DHCP-Allocations
347 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
348 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530349 # Verify subscriber access flows are added for the ONU port
350 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
351 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
352 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530353 # Verify Ping
354 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
355 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
356 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
357 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
358 Run Keyword and Ignore Error Collect Logs
359 END
360 # Scale Up the Of-Agent Deployment
361 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
362 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
363 ... Running
364 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
365 Run Keyword If ${has_dataplane} Clean Up Linux
366 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
367 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000368
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000369Check ONU adapter crash not forcing authentication again
370 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
371 ... message count to make sure auth not started again and validates EAP status and ping.
372 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
hwchiu14c05102020-03-27 00:44:30 +0000373 [Tags] functional ONUAdaptCrash
Andy Bavierabeba262020-02-07 16:22:16 -0700374 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
375 ... AND Start Logging ONUAdaptCrash
376 [Teardown] Run Keywords Collect Logs
377 ... AND Stop Logging ONUAdaptCrash
378 ... AND Announce Message END TEST ONUAdaptCrash
hwchiu14c05102020-03-27 00:44:30 +0000379 # Wait for adapter to resync
380 Sleep 60s
381 # Restart the onu
382 ${podName} Set Variable adapter-open-onu
383 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${podName}
384 # Validate ONU Ports
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000385 FOR ${I} IN RANGE 0 ${num_onus}
386 ${src}= Set Variable ${hosts.src[${I}]}
387 ${dst}= Set Variable ${hosts.dst[${I}]}
388 ${onu_device_id}= Get Device ID From SN ${src['onu']}
389 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
390 ... ${of_id}
hwchiu14c05102020-03-27 00:44:30 +0000391 Run Keyword And Continue On Failure Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
392 ... ${onu_port}
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000393 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
394 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
395 ... ${src['container_type']} ${src['container_name']}
396 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000397 END
hwchiu14c05102020-03-27 00:44:30 +0000398 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
399 ... Running
400 # Wait for adapter to resync
401 Sleep 60s
Andy Bavier8da0e132020-04-13 10:25:16 -0700402 Run Keyword If ${has_dataplane} Clean Up Linux
hwchiu14c05102020-03-27 00:44:30 +0000403 # Perform all steps in Sanity Test except the subscriber addition
404 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
405 Set Global Variable ${of_id}
406 FOR ${I} IN RANGE 0 ${num_onus}
407 ${src}= Set Variable ${hosts.src[${I}]}
408 ${dst}= Set Variable ${hosts.dst[${I}]}
409 Run Keyword and Ignore Error Collect Logs
410 ${onu_device_id}= Get Device ID From SN ${src['onu']}
411 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
412 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
413 # Check ONU port is Enabled in ONOS
414 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
415 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
416 # Verify EAPOL flows are added for the ONU port
417 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
418 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
419 # Verify ONU state in voltha
420 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
421 ... ENABLED ACTIVE REACHABLE
422 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
423 # Perform Authentication
424 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
425 ... /tmp/wpa ${src['dp_iface_name']} log
426 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
427 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
428 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
429 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
430 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
431 # Verify that no pending flows exist for the ONU port
432 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
433 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530434 # Verify subscriber access flows are added for the ONU port
435 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
436 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
437 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
hwchiu14c05102020-03-27 00:44:30 +0000438 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
439 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
440 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
441 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
442 ... ${dst['container_name']}
443 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
444 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
445 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
446 Run Keyword and Ignore Error Collect Logs
447 END
448
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000449 Run Keyword and Ignore Error Collect Logs
450
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700451Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
452 [Documentation] Deploys an device instance and waits for it to authenticate. After
453 ... authentication is successful the rw-core deployment is scaled to 0 instances to
454 ... simulate a POD crash. The test then scales the rw-core back to a single instance
455 ... and configures ONOS for access. The test succeeds if the device is able to
456 ... complete the DHCP sequence.
457 [Tags] functional rwcore-restart
458 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
459 ... AND Start Logging RwCoreFailAndRestart
460 ... AND Clear All Devices Then Create New Device
461 [Teardown] Run Keywords Collect Logs
462 ... AND Stop Logging RwCoreFailAndRestart
463 ... AND Announce Message END TEST RwCoreFailAndRestart
Suchitra Vemuri5d3383f2020-04-03 11:02:26 -0700464 #... AND Delete Device and Verify
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700465 Run Keyword and Ignore Error Collect Logs
466 Run Keyword If ${has_dataplane} Clean Up Linux
467 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
468 Set Global Variable ${of_id}
469 FOR ${I} IN RANGE 0 ${num_onus}
470 ${src}= Set Variable ${hosts.src[${I}]}
471 ${dst}= Set Variable ${hosts.dst[${I}]}
472 ${onu_device_id}= Get Device ID From SN ${src['onu']}
473 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
474 ... ${of_id}
475 # Bring up the device and verify it authenticates
476 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
477 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
478 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
479 ... ${ONOS_SSH_PORT} ${onu_port}
480 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
481 ... /tmp/wpa ${src['dp_iface_name']} log
482 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
483 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
484 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
485 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
486 ... ${ONOS_SSH_PORT} ${onu_port}
487 END
488
489 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
490 Scale K8s Deployment voltha voltha-rw-core 0
491 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
492 # Ensure the ofagent POD goes "not-ready" as expected
493 Wait Until keyword Succeeds ${timeout} 2s
494 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
495 # Scale up the core deployment and make sure both it and the ofagent deployment are back
496 Scale K8s Deployment voltha voltha-rw-core 1
497 Wait Until Keyword Succeeds ${timeout} 2s
498 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
499 Wait Until Keyword Succeeds ${timeout} 2s
500 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
501 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
502 # so restart the port forwarding for the API service
503 Restart VOLTHA Port Foward voltha-api-minimal
504 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
505 # represents system connectivity being restored
506 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
507 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
508
509 FOR ${I} IN RANGE 0 ${num_onus}
510 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
511 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
512 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530513 # Verify subscriber access flows are added for the ONU port
514 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
515 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
516 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700517 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
518 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
519 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
520 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
521 ... ${dst['container_name']}
522 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
523 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
524 END
525
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000526ONU Reboot
527 [Documentation] Reboot ONU and verify that ONU comes up properly
528 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700529 [Setup] Run Keywords Announce Message START TEST RebootONU
530 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700531 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700532 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700533 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000534 FOR ${I} IN RANGE 0 ${num_onus}
535 ${src}= Set Variable ${hosts.src[${I}]}
536 ${dst}= Set Variable ${hosts.dst[${I}]}
537 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800538 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
539 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000540 Reboot ONU ${onu_device_id} ${src} ${dst}
541 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800542 # Check ONU port is Enabled in ONOS
543 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800544 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800545 # Verify EAPOL flows are added for the ONU port
546 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800547 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800548 # Verify ONU state in voltha
549 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
550 ... ENABLED ACTIVE REACHABLE
551 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass21807632020-04-14 16:24:55 +0530552 # Verify subscriber access flows are added for the ONU port
553 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
554 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
555 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800556 # Verify pings are successful after reboot on the current ONU
557 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
558 ... Wait Until Keyword Succeeds 60s 2s
559 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
560 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000561 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800562 #Run Keyword If ${has_dataplane} Clean Up Linux
563 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
564 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800565
566*** Keywords ***
567Setup Suite
568 [Documentation] Set up the test suite
569 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500570 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700571 ${switch_type}= Get Variable Value ${web_power_switch.type}
572 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800573
574Clear All Devices Then Create New Device
575 [Documentation] Remove any devices from VOLTHA and ONOS
576 # Remove all devices from voltha and nos
577 Delete All Devices and Verify
578 # Execute normal test Setup Keyword
579 Setup