blob: 70ba225bc2005e017e1e1f2c798f90423d107e8d [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
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800100 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
101 ... Wait Until Keyword Succeeds 60s 2s
102 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
103 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
104 Run Keyword And Ignore Error Collect Logs
105 END
Suchitra Vemurid7096132020-02-21 14:50:47 -0800106 # Deleting OLT after tests completes independently (as this test doesn't not run on each POD)
Suchitra Vemuri0656bc22020-03-21 19:07:49 -0700107 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800108
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700109Verify OLT after rebooting physically
110 [Documentation] Test the physical reboot of the OLT
111 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
112 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
113 ... VOL-1956
114 [Tags] functional PhysicalOLTReboot
115 [Setup] Run Keywords Announce Message START TEST PhysicalOLTReboot
116 ... AND Start Logging PhysicalOLTReboot
117 [Teardown] Run Keywords Collect Logs
118 ... AND Stop Logging PhysicalOLTReboot
119 ... AND Announce Message END TEST PhysicalOLTReboot
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700120 ... AND Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700121 # Add OLT device
122 setup
123 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
124 Run Keyword If ${has_dataplane} Clean Up Linux
125 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
126 # Reboot the OLT from the OLT CLI
127 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
128 ... sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
129 Run Keyword And Ignore Error Collect Logs
130 FOR ${I} IN RANGE 0 ${num_onus}
131 ${src}= Set Variable ${hosts.src[${I}]}
132 ${dst}= Set Variable ${hosts.dst[${I}]}
133 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
134 ... Wait Until Keyword Succeeds 60s 2s
135 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
136 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
137 END
138 # Wait for the OLT to come back up
139 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
Suchitra Vemuri64db9652020-03-22 21:11:13 -0700140 # Waiting extra time for the ONUs to come up
141 Sleep 60s
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700142 Run Keyword And Ignore Error Collect Logs
143 Run Keyword If ${has_dataplane} Clean Up Linux
144 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
145 # Deleting OLT after test completes
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700146 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700147
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700148Verify restart openolt-adapter container after subscriber provisioning
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800149 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
150 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800151 [Tags] functional VOL-1958 Restart-OpenOlt released
152 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
153 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800154 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800155 ... AND Stop Logging Restart-OpenOlt
156 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800157 # Add OLT device
158 setup
159 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
160 Run Keyword If ${has_dataplane} Clean Up Linux
161 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
162 ${waitforRestart} Set Variable 120s
163 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
164 Log ${podStatusOutput}
165 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
166 ${podName} Set Variable adapter-open-olt
167 Restart Pod ${NAMESPACE} ${podName}
168 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
169 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700170 # Wait for 1min after openolt adapter is restarted
171 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800172 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800173 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800174 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
175 Log ${podStatusOutput}
176 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
177 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
178 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800179
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800180Check OLT/ONU Authentication After Radius Pod Restart
181 [Documentation] After radius restart, triggers reassociation, checks status and
182 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
183 ... wpa supplicant is running in background hence it is recommended to remove
184 ... teardown from previous test or uncomment 'Teardown None'.
185 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
186 [Tags] functional RadiusRestart released
187 [Setup] Run Keywords Announce Message START TEST RadiusRestart
188 ... AND Start Logging RadiusRestart
189 [Teardown] Run Keywords Collect Logs
190 ... AND Stop Logging RadiusRestart
191 ... AND Announce Message END TEST RadiusRestart
192 ${waitforRestart} Set Variable 120s
Suchitra Vemurica1c5d32020-04-09 18:45:29 -0700193 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${DEFAULTSPACE} ${RESTART_POD_NAME}
194 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME}
195 ... ${DEFAULTSPACE} Running
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800196 FOR ${I} IN RANGE 0 ${num_onus}
197 ${src}= Set Variable ${hosts.src[${I}]}
198 ${dst}= Set Variable ${hosts.dst[${I}]}
199 ${onu_device_id}= Get Device ID From SN ${src['onu']}
200 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
201 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
202 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800203 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800204 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
205 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
206 ... ${src['ip']} ${src['user']} ${src['pass']}
207 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800208 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800209 ... ${ONOS_SSH_PORT} ${onu_port}
210 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
211 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
212 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
213 ... ${src['ip']} ${src['user']} ${src['pass']}
214 ... ${src['container_type']} ${src['container_name']}
215 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
216 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
217 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800218 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800219 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
220 Run Keyword and Ignore Error Collect Logs
221 END
222
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700223Verify openolt adapter restart before subscriber provisioning
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800224 [Documentation] Deploys an device instance and waits for it to authenticate. After
225 ... authentication is successful the rw-core deployment is scaled to 0 instances to
226 ... simulate a POD crash. The test then scales the rw-core back to a single instance
227 ... and configures ONOS for access. The test succeeds if the device is able to
228 ... complete the DHCP sequence.
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700229 [Tags] functional olt-adapter-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800230 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
231 ... AND Start Logging OltAdapterRestart
Suchitra Vemuria0c086f2020-03-29 19:14:13 -0700232 #... AND Clear All Devices Then Create New Device
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800233 [Teardown] Run Keywords Collect Logs
234 ... AND Stop Logging OltAdapterRestart
235 ... AND Announce Message END TEST OltAdapterRestart
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700236 # Add OLT and perform sanity test
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700237 #setup
Suchitra Vemuri91537c82020-03-29 15:03:26 -0700238 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700239 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800240 Set Global Variable ${of_id}
241
242 FOR ${I} IN RANGE 0 ${num_onus}
243 ${src}= Set Variable ${hosts.src[${I}]}
244 ${dst}= Set Variable ${hosts.dst[${I}]}
245 ${onu_device_id}= Get Device ID From SN ${src['onu']}
246 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
247 ... ${of_id}
248
249 # Bring up the device and verify it authenticates
250 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
251 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800252 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800253 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700254 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
255 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800256 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
257 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700258 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800259 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800260 ... ${ONOS_SSH_PORT} ${onu_port}
261 END
262 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
263 Scale K8s Deployment voltha adapter-open-olt 0
264 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
265 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
266 Scale K8s Deployment voltha adapter-open-olt 1
267 Wait Until Keyword Succeeds ${timeout} 2s
268 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
269
270 # Ensure the device is available in ONOS, this represents system connectivity being restored
271 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800272 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800273
274 FOR ${I} IN RANGE 0 ${num_onus}
275 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800276 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800277 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
278 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
279 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
280 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
281 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
282 ... ${dst['container_name']}
283 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800284 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800285 END
286
hwchiu14c05102020-03-27 00:44:30 +0000287Verify restart ofagent container after subscriber is provisioned
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000288 [Documentation] Restart ofagent container after VOLTHA is operational.
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000289 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530290 #TODO: remove "notready" tag once olt reboot and ofagent restart work items are done
Hardik Windlass7a846662020-03-19 20:42:59 +0530291 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -0700292 [Setup] Run Keywords Announce Message START TEST ofagentRestart
293 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700294 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700295 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700296 ... AND Announce Message END TEST ofagentRestart
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530297 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
Suchitra Vemuriceb002a2020-03-25 13:36:21 -0700298 # set timeout value
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000299 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700300 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000301 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700302 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530303 ${podName} Set Variable ofagent
304 Restart Pod ${NAMESPACE} ${podName}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000305 Sleep 60s
306 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
307 ... Running
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530308 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
309 Run Keyword If ${has_dataplane} Clean Up Linux
310 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700311 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000312 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700313 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000314 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530315 # Scale Down the Of-Agent Deployment
316 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 0
317 Sleep 30s
318 FOR ${I} IN RANGE 0 ${num_onus}
319 ${src}= Set Variable ${hosts.src[${I}]}
320 ${dst}= Set Variable ${hosts.dst[${I}]}
321 Run Keyword and Ignore Error Collect Logs
322 ${onu_device_id}= Get Device ID From SN ${src['onu']}
323 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
324 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
325 # Verify ONU state in voltha
326 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
327 ... ENABLED ACTIVE REACHABLE
328 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
329 # Check ONU port is Disabled in ONOS
330 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
331 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
332 # Verify EAPOL flows are present for the ONU port
333 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
334 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
335 # Verify ONU in AAA-Users
336 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
337 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
338 # Verify DHCP-Allocations
339 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
340 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
341 # Verify Ping
342 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
343 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
344 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
345 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
346 Run Keyword and Ignore Error Collect Logs
347 END
348 # Scale Up the Of-Agent Deployment
349 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
350 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
351 ... Running
352 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
353 Run Keyword If ${has_dataplane} Clean Up Linux
354 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
355 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000356
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000357Check ONU adapter crash not forcing authentication again
358 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
359 ... message count to make sure auth not started again and validates EAP status and ping.
360 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
hwchiu14c05102020-03-27 00:44:30 +0000361 [Tags] functional ONUAdaptCrash
Andy Bavierabeba262020-02-07 16:22:16 -0700362 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
363 ... AND Start Logging ONUAdaptCrash
364 [Teardown] Run Keywords Collect Logs
365 ... AND Stop Logging ONUAdaptCrash
366 ... AND Announce Message END TEST ONUAdaptCrash
hwchiu14c05102020-03-27 00:44:30 +0000367 # Wait for adapter to resync
368 Sleep 60s
369 # Restart the onu
370 ${podName} Set Variable adapter-open-onu
371 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${podName}
372 # Validate ONU Ports
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000373 FOR ${I} IN RANGE 0 ${num_onus}
374 ${src}= Set Variable ${hosts.src[${I}]}
375 ${dst}= Set Variable ${hosts.dst[${I}]}
376 ${onu_device_id}= Get Device ID From SN ${src['onu']}
377 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
378 ... ${of_id}
hwchiu14c05102020-03-27 00:44:30 +0000379 Run Keyword And Continue On Failure Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
380 ... ${onu_port}
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000381 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
382 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
383 ... ${src['container_type']} ${src['container_name']}
384 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000385 END
hwchiu14c05102020-03-27 00:44:30 +0000386 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
387 ... Running
388 # Wait for adapter to resync
389 Sleep 60s
390 Clean Up Linux
391 # Perform all steps in Sanity Test except the subscriber addition
392 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
393 Set Global Variable ${of_id}
394 FOR ${I} IN RANGE 0 ${num_onus}
395 ${src}= Set Variable ${hosts.src[${I}]}
396 ${dst}= Set Variable ${hosts.dst[${I}]}
397 Run Keyword and Ignore Error Collect Logs
398 ${onu_device_id}= Get Device ID From SN ${src['onu']}
399 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
400 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
401 # Check ONU port is Enabled in ONOS
402 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
403 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
404 # Verify EAPOL flows are added for the ONU port
405 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
406 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
407 # Verify ONU state in voltha
408 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
409 ... ENABLED ACTIVE REACHABLE
410 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
411 # Perform Authentication
412 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
413 ... /tmp/wpa ${src['dp_iface_name']} log
414 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
415 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
416 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
417 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
418 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
419 # Verify that no pending flows exist for the ONU port
420 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
421 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
422 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
423 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
424 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
425 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
426 ... ${dst['container_name']}
427 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
428 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
429 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
430 Run Keyword and Ignore Error Collect Logs
431 END
432
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000433 Run Keyword and Ignore Error Collect Logs
434
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700435Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
436 [Documentation] Deploys an device instance and waits for it to authenticate. After
437 ... authentication is successful the rw-core deployment is scaled to 0 instances to
438 ... simulate a POD crash. The test then scales the rw-core back to a single instance
439 ... and configures ONOS for access. The test succeeds if the device is able to
440 ... complete the DHCP sequence.
441 [Tags] functional rwcore-restart
442 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
443 ... AND Start Logging RwCoreFailAndRestart
444 ... AND Clear All Devices Then Create New Device
445 [Teardown] Run Keywords Collect Logs
446 ... AND Stop Logging RwCoreFailAndRestart
447 ... AND Announce Message END TEST RwCoreFailAndRestart
Suchitra Vemuri5d3383f2020-04-03 11:02:26 -0700448 #... AND Delete Device and Verify
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700449 Run Keyword and Ignore Error Collect Logs
450 Run Keyword If ${has_dataplane} Clean Up Linux
451 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
452 Set Global Variable ${of_id}
453 FOR ${I} IN RANGE 0 ${num_onus}
454 ${src}= Set Variable ${hosts.src[${I}]}
455 ${dst}= Set Variable ${hosts.dst[${I}]}
456 ${onu_device_id}= Get Device ID From SN ${src['onu']}
457 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
458 ... ${of_id}
459 # Bring up the device and verify it authenticates
460 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
461 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
462 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
463 ... ${ONOS_SSH_PORT} ${onu_port}
464 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
465 ... /tmp/wpa ${src['dp_iface_name']} log
466 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
467 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
468 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
469 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
470 ... ${ONOS_SSH_PORT} ${onu_port}
471 END
472
473 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
474 Scale K8s Deployment voltha voltha-rw-core 0
475 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
476 # Ensure the ofagent POD goes "not-ready" as expected
477 Wait Until keyword Succeeds ${timeout} 2s
478 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
479 # Scale up the core deployment and make sure both it and the ofagent deployment are back
480 Scale K8s Deployment voltha voltha-rw-core 1
481 Wait Until Keyword Succeeds ${timeout} 2s
482 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
483 Wait Until Keyword Succeeds ${timeout} 2s
484 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
485 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
486 # so restart the port forwarding for the API service
487 Restart VOLTHA Port Foward voltha-api-minimal
488 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
489 # represents system connectivity being restored
490 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
491 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
492
493 FOR ${I} IN RANGE 0 ${num_onus}
494 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
495 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
496 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
497 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
498 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
499 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
500 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
501 ... ${dst['container_name']}
502 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
503 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
504 END
505
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000506ONU Reboot
507 [Documentation] Reboot ONU and verify that ONU comes up properly
508 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700509 [Setup] Run Keywords Announce Message START TEST RebootONU
510 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700511 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700512 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700513 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000514 FOR ${I} IN RANGE 0 ${num_onus}
515 ${src}= Set Variable ${hosts.src[${I}]}
516 ${dst}= Set Variable ${hosts.dst[${I}]}
517 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800518 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
519 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000520 Reboot ONU ${onu_device_id} ${src} ${dst}
521 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800522 # Check ONU port is Enabled in ONOS
523 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800524 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800525 # Verify EAPOL flows are added for the ONU port
526 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800527 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800528 # Verify ONU state in voltha
529 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
530 ... ENABLED ACTIVE REACHABLE
531 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
532 # Verify pings are successful after reboot on the current ONU
533 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
534 ... Wait Until Keyword Succeeds 60s 2s
535 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
536 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000537 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800538 #Run Keyword If ${has_dataplane} Clean Up Linux
539 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
540 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800541
542*** Keywords ***
543Setup Suite
544 [Documentation] Set up the test suite
545 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500546 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700547 ${switch_type}= Get Variable Value ${web_power_switch.type}
548 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800549
550Clear All Devices Then Create New Device
551 [Documentation] Remove any devices from VOLTHA and ONOS
552 # Remove all devices from voltha and nos
553 Delete All Devices and Verify
554 # Execute normal test Setup Keyword
555 Setup