blob: bc071581e6a731861c82ff69219373d46225f7ad [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
Andy Bavier8da0e132020-04-13 10:25:16 -0700139 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
140 ... Check Remote System Reachability True ${olt_ip}
Suchitra Vemuri64db9652020-03-22 21:11:13 -0700141 # Waiting extra time for the ONUs to come up
142 Sleep 60s
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700143 Run Keyword And Ignore Error Collect Logs
144 Run Keyword If ${has_dataplane} Clean Up Linux
145 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
146 # Deleting OLT after test completes
Suchitra Vemurib3a92e42020-03-21 16:49:57 -0700147 #Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri784e1ae2020-03-16 18:40:25 -0700148
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700149Verify restart openolt-adapter container after subscriber provisioning
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800150 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
151 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800152 [Tags] functional VOL-1958 Restart-OpenOlt released
153 [Setup] Run Keywords Announce Message START TEST Restart-OpenOlt
154 ... AND Start Logging Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800155 [Teardown] Run Keywords Collect Logs
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800156 ... AND Stop Logging Restart-OpenOlt
157 ... AND Announce Message END TEST Restart-OpenOlt
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800158 # Add OLT device
159 setup
160 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
161 Run Keyword If ${has_dataplane} Clean Up Linux
162 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
163 ${waitforRestart} Set Variable 120s
164 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
165 Log ${podStatusOutput}
166 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
167 ${podName} Set Variable adapter-open-olt
168 Restart Pod ${NAMESPACE} ${podName}
169 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
170 ... Running
Suchitra Vemuri312bfe02020-03-16 16:11:34 -0700171 # Wait for 1min after openolt adapter is restarted
172 Sleep 60s
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800173 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800174 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800175 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
176 Log ${podStatusOutput}
177 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
178 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
179 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800180
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800181Check OLT/ONU Authentication After Radius Pod Restart
182 [Documentation] After radius restart, triggers reassociation, checks status and
183 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
184 ... wpa supplicant is running in background hence it is recommended to remove
185 ... teardown from previous test or uncomment 'Teardown None'.
186 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
187 [Tags] functional RadiusRestart released
188 [Setup] Run Keywords Announce Message START TEST RadiusRestart
189 ... AND Start Logging RadiusRestart
190 [Teardown] Run Keywords Collect Logs
191 ... AND Stop Logging RadiusRestart
192 ... AND Announce Message END TEST RadiusRestart
193 ${waitforRestart} Set Variable 120s
Suchitra Vemurica1c5d32020-04-09 18:45:29 -0700194 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${DEFAULTSPACE} ${RESTART_POD_NAME}
195 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${RESTART_POD_NAME}
196 ... ${DEFAULTSPACE} Running
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800197 FOR ${I} IN RANGE 0 ${num_onus}
198 ${src}= Set Variable ${hosts.src[${I}]}
199 ${dst}= Set Variable ${hosts.dst[${I}]}
200 ${onu_device_id}= Get Device ID From SN ${src['onu']}
201 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
202 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
203 Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800204 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800205 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
206 ... Validate Authentication After Reassociate True ${src['dp_iface_name']}
207 ... ${src['ip']} ${src['user']} ${src['pass']}
208 ... ${src['container_type']} ${src['container_name']}
ubuntu6b6e7d42020-03-02 12:35:42 -0800209 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800210 ... ${ONOS_SSH_PORT} ${onu_port}
211 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
212 ... Validate DHCP and Ping True True ${src['dp_iface_name']}
213 ... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
214 ... ${src['ip']} ${src['user']} ${src['pass']}
215 ... ${src['container_type']} ${src['container_name']}
216 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']}
217 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
218 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800219 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800220 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
221 Run Keyword and Ignore Error Collect Logs
222 END
223
Suchitra Vemuri05180cb2020-03-26 13:13:27 -0700224Verify openolt adapter restart before subscriber provisioning
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800225 [Documentation] Deploys an device instance and waits for it to authenticate. After
226 ... authentication is successful the rw-core deployment is scaled to 0 instances to
227 ... simulate a POD crash. The test then scales the rw-core back to a single instance
228 ... and configures ONOS for access. The test succeeds if the device is able to
229 ... complete the DHCP sequence.
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700230 [Tags] functional olt-adapter-restart
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800231 [Setup] Run Keywords Announce Message START TEST OltAdapterRestart
232 ... AND Start Logging OltAdapterRestart
Suchitra Vemuria0c086f2020-03-29 19:14:13 -0700233 #... AND Clear All Devices Then Create New Device
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800234 [Teardown] Run Keywords Collect Logs
235 ... AND Stop Logging OltAdapterRestart
236 ... AND Announce Message END TEST OltAdapterRestart
Hung-Wei Chiud3576762020-03-25 18:06:26 -0700237 # Add OLT and perform sanity test
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700238 #setup
Suchitra Vemuri91537c82020-03-29 15:03:26 -0700239 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri59ad2772020-03-26 22:27:27 -0700240 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800241 Set Global Variable ${of_id}
242
243 FOR ${I} IN RANGE 0 ${num_onus}
244 ${src}= Set Variable ${hosts.src[${I}]}
245 ${dst}= Set Variable ${hosts.dst[${I}]}
246 ${onu_device_id}= Get Device ID From SN ${src['onu']}
247 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
248 ... ${of_id}
249
250 # Bring up the device and verify it authenticates
251 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
252 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
ubuntu6b6e7d42020-03-02 12:35:42 -0800253 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800254 ... ${ONOS_SSH_PORT} ${onu_port}
Andy Bavier84834d42020-02-25 13:49:50 -0700255 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
256 ... /tmp/wpa ${src['dp_iface_name']} log
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800257 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
258 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700259 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
ubuntu6b6e7d42020-03-02 12:35:42 -0800260 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800261 ... ${ONOS_SSH_PORT} ${onu_port}
262 END
263 # Scale down the open OLT adapter deployment to 0 PODs and once confirmed, scale it back to 1
264 Scale K8s Deployment voltha adapter-open-olt 0
265 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha adapter-open-olt
266 # Scale up the open OLT adapter deployment and make sure both it and the ofagent deployment are back
267 Scale K8s Deployment voltha adapter-open-olt 1
268 Wait Until Keyword Succeeds ${timeout} 2s
269 ... Check Expected Available Deployment Replicas voltha adapter-open-olt 1
270
271 # Ensure the device is available in ONOS, this represents system connectivity being restored
272 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800273 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800274
275 FOR ${I} IN RANGE 0 ${num_onus}
276 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
ubuntu6b6e7d42020-03-02 12:35:42 -0800277 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800278 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
279 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
280 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
281 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
282 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
283 ... ${dst['container_name']}
284 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
ubuntu6b6e7d42020-03-02 12:35:42 -0800285 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800286 END
287
hwchiu14c05102020-03-27 00:44:30 +0000288Verify restart ofagent container after subscriber is provisioned
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000289 [Documentation] Restart ofagent container after VOLTHA is operational.
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000290 ... Prerequisite : ONUs are authenticated and pingable.
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530291 #TODO: remove "notready" tag once olt reboot and ofagent restart work items are done
Hardik Windlass7a846662020-03-19 20:42:59 +0530292 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -0700293 [Setup] Run Keywords Announce Message START TEST ofagentRestart
294 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700295 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700296 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700297 ... AND Announce Message END TEST ofagentRestart
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530298 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
Suchitra Vemuriceb002a2020-03-25 13:36:21 -0700299 # set timeout value
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000300 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700301 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000302 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700303 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530304 ${podName} Set Variable ofagent
305 Restart Pod ${NAMESPACE} ${podName}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000306 Sleep 60s
307 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
308 ... Running
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530309 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
310 Run Keyword If ${has_dataplane} Clean Up Linux
311 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700312 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000313 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700314 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000315 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Hardik Windlass8f2aadc2020-03-16 20:16:39 +0530316 # Scale Down the Of-Agent Deployment
317 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 0
318 Sleep 30s
319 FOR ${I} IN RANGE 0 ${num_onus}
320 ${src}= Set Variable ${hosts.src[${I}]}
321 ${dst}= Set Variable ${hosts.dst[${I}]}
322 Run Keyword and Ignore Error Collect Logs
323 ${onu_device_id}= Get Device ID From SN ${src['onu']}
324 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
325 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
326 # Verify ONU state in voltha
327 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
328 ... ENABLED ACTIVE REACHABLE
329 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
330 # Check ONU port is Disabled in ONOS
331 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
332 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
333 # Verify EAPOL flows are present for the ONU port
334 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
335 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
336 # Verify ONU in AAA-Users
337 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
338 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
339 # Verify DHCP-Allocations
340 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
341 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
342 # Verify Ping
343 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
344 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
345 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
346 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
347 Run Keyword and Ignore Error Collect Logs
348 END
349 # Scale Up the Of-Agent Deployment
350 Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
351 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
352 ... Running
353 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
354 Run Keyword If ${has_dataplane} Clean Up Linux
355 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
356 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000357
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000358Check ONU adapter crash not forcing authentication again
359 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
360 ... message count to make sure auth not started again and validates EAP status and ping.
361 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
hwchiu14c05102020-03-27 00:44:30 +0000362 [Tags] functional ONUAdaptCrash
Andy Bavierabeba262020-02-07 16:22:16 -0700363 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
364 ... AND Start Logging ONUAdaptCrash
365 [Teardown] Run Keywords Collect Logs
366 ... AND Stop Logging ONUAdaptCrash
367 ... AND Announce Message END TEST ONUAdaptCrash
hwchiu14c05102020-03-27 00:44:30 +0000368 # Wait for adapter to resync
369 Sleep 60s
370 # Restart the onu
371 ${podName} Set Variable adapter-open-onu
372 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${podName}
373 # Validate ONU Ports
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000374 FOR ${I} IN RANGE 0 ${num_onus}
375 ${src}= Set Variable ${hosts.src[${I}]}
376 ${dst}= Set Variable ${hosts.dst[${I}]}
377 ${onu_device_id}= Get Device ID From SN ${src['onu']}
378 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
379 ... ${of_id}
hwchiu14c05102020-03-27 00:44:30 +0000380 Run Keyword And Continue On Failure Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
381 ... ${onu_port}
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000382 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
383 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
384 ... ${src['container_type']} ${src['container_name']}
385 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000386 END
hwchiu14c05102020-03-27 00:44:30 +0000387 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
388 ... Running
389 # Wait for adapter to resync
390 Sleep 60s
Andy Bavier8da0e132020-04-13 10:25:16 -0700391 Run Keyword If ${has_dataplane} Clean Up Linux
hwchiu14c05102020-03-27 00:44:30 +0000392 # Perform all steps in Sanity Test except the subscriber addition
393 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
394 Set Global Variable ${of_id}
395 FOR ${I} IN RANGE 0 ${num_onus}
396 ${src}= Set Variable ${hosts.src[${I}]}
397 ${dst}= Set Variable ${hosts.dst[${I}]}
398 Run Keyword and Ignore Error Collect Logs
399 ${onu_device_id}= Get Device ID From SN ${src['onu']}
400 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
401 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
402 # Check ONU port is Enabled in ONOS
403 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
404 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
405 # Verify EAPOL flows are added for the ONU port
406 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
407 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
408 # Verify ONU state in voltha
409 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
410 ... ENABLED ACTIVE REACHABLE
411 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
412 # Perform Authentication
413 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
414 ... /tmp/wpa ${src['dp_iface_name']} log
415 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
416 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
417 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
418 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
419 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
420 # Verify that no pending flows exist for the ONU port
421 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
422 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
423 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
424 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
425 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
426 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
427 ... ${dst['container_name']}
428 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
429 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
430 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
431 Run Keyword and Ignore Error Collect Logs
432 END
433
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000434 Run Keyword and Ignore Error Collect Logs
435
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700436Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
437 [Documentation] Deploys an device instance and waits for it to authenticate. After
438 ... authentication is successful the rw-core deployment is scaled to 0 instances to
439 ... simulate a POD crash. The test then scales the rw-core back to a single instance
440 ... and configures ONOS for access. The test succeeds if the device is able to
441 ... complete the DHCP sequence.
442 [Tags] functional rwcore-restart
443 [Setup] Run Keywords Announce Message START TEST RwCoreFailAndRestart
444 ... AND Start Logging RwCoreFailAndRestart
445 ... AND Clear All Devices Then Create New Device
446 [Teardown] Run Keywords Collect Logs
447 ... AND Stop Logging RwCoreFailAndRestart
448 ... AND Announce Message END TEST RwCoreFailAndRestart
Suchitra Vemuri5d3383f2020-04-03 11:02:26 -0700449 #... AND Delete Device and Verify
Suchitra Vemuriebf65322020-04-03 10:09:41 -0700450 Run Keyword and Ignore Error Collect Logs
451 Run Keyword If ${has_dataplane} Clean Up Linux
452 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
453 Set Global Variable ${of_id}
454 FOR ${I} IN RANGE 0 ${num_onus}
455 ${src}= Set Variable ${hosts.src[${I}]}
456 ${dst}= Set Variable ${hosts.dst[${I}]}
457 ${onu_device_id}= Get Device ID From SN ${src['onu']}
458 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
459 ... ${of_id}
460 # Bring up the device and verify it authenticates
461 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
462 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
463 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
464 ... ${ONOS_SSH_PORT} ${onu_port}
465 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
466 ... /tmp/wpa ${src['dp_iface_name']} log
467 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
468 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
469 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
470 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
471 ... ${ONOS_SSH_PORT} ${onu_port}
472 END
473
474 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
475 Scale K8s Deployment voltha voltha-rw-core 0
476 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
477 # Ensure the ofagent POD goes "not-ready" as expected
478 Wait Until keyword Succeeds ${timeout} 2s
479 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 0
480 # Scale up the core deployment and make sure both it and the ofagent deployment are back
481 Scale K8s Deployment voltha voltha-rw-core 1
482 Wait Until Keyword Succeeds ${timeout} 2s
483 ... Check Expected Available Deployment Replicas voltha voltha-rw-core 1
484 Wait Until Keyword Succeeds ${timeout} 2s
485 ... Check Expected Available Deployment Replicas voltha voltha-ofagent 1
486 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
487 # so restart the port forwarding for the API service
488 Restart VOLTHA Port Foward voltha-api-minimal
489 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
490 # represents system connectivity being restored
491 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
492 ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id}
493
494 FOR ${I} IN RANGE 0 ${num_onus}
495 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
496 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
497 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
498 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
499 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
500 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
501 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
502 ... ${dst['container_name']}
503 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
504 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
505 END
506
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000507ONU Reboot
508 [Documentation] Reboot ONU and verify that ONU comes up properly
509 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700510 [Setup] Run Keywords Announce Message START TEST RebootONU
511 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700512 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700513 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700514 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000515 FOR ${I} IN RANGE 0 ${num_onus}
516 ${src}= Set Variable ${hosts.src[${I}]}
517 ${dst}= Set Variable ${hosts.dst[${I}]}
518 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800519 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
520 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000521 Reboot ONU ${onu_device_id} ${src} ${dst}
522 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800523 # Check ONU port is Enabled in ONOS
524 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800525 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800526 # Verify EAPOL flows are added for the ONU port
527 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800528 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800529 # Verify ONU state in voltha
530 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
531 ... ENABLED ACTIVE REACHABLE
532 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
533 # Verify pings are successful after reboot on the current ONU
534 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
535 ... Wait Until Keyword Succeeds 60s 2s
536 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
537 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000538 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800539 #Run Keyword If ${has_dataplane} Clean Up Linux
540 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
541 #Perform Sanity Test
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800542
543*** Keywords ***
544Setup Suite
545 [Documentation] Set up the test suite
546 Common Test Suite Setup
HungWei Chiu1408fb92020-03-03 19:43:30 -0500547 #power_switch.robot needs it to support different vendor's power switch
Hung-Wei Chiufcc6d8e2020-03-10 12:05:11 -0700548 ${switch_type}= Get Variable Value ${web_power_switch.type}
549 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800550
551Clear All Devices Then Create New Device
552 [Documentation] Remove any devices from VOLTHA and ONOS
553 # Remove all devices from voltha and nos
554 Delete All Devices and Verify
555 # Execute normal test Setup Keyword
556 Setup