blob: ada3952ae6495f3a11bfd92e1dd9181b3cc29099 [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
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000017Suite Setup Common Test Suite Setup
18Test Setup Setup
19Test Teardown Teardown
20#Suite Teardown Teardown Suite
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
26Library ../../libraries/DependencyLibrary.py
27Resource ../../libraries/onos.robot
28Resource ../../libraries/voltctl.robot
29Resource ../../libraries/voltha.robot
30Resource ../../libraries/utils.robot
31Resource ../../libraries/k8s.robot
32Resource ../../variables/variables.robot
HungWei Chiu87edb1f2020-01-28 00:10:58 +000033Resource ../../libraries/power_switch.robot
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000034
35*** Variables ***
36${POD_NAME} flex-ocp-cord
37${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
38${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
39#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
40${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
41${HELM_CHARTS_DIR} ~/helm-charts
42${VOLTHA_POD_NUM} 8
43${NAMESPACE} voltha
44# For below variable value, using deployment name as using grep for
45# parsing radius pod name, we can also use full radius pod name
46${RESTART_POD_NAME} radius
47${timeout} 60s
48${of_id} 0
49${logical_id} 0
Suchitra Vemuri109feb12020-01-23 16:25:02 -080050${has_dataplane} True
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000051${external_libs} True
52${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
66 [Setup] Run Keywords Announce Message START TEST PowerSwitch
67 ... AND Start Logging PowerSwitch
68 [Teardown] Run Keywords Collect Logs
69 ... AND Stop Logging PowerSwitch
70 ... AND Announce Message END TEST PowerSwitch
71 # Add OLT device
72 setup
73 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
74 Run Keyword If ${has_dataplane} Clean Up Linux
75 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
76 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
77 FOR ${I} IN RANGE 0 ${num_onus}
78 ${src}= Set Variable ${hosts.src[${I}]}
79 ${dst}= Set Variable ${hosts.dst[${I}]}
80 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
81 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
82 Disable Switch Outlet ${src['power_switch_port']}
83 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
84 ... Wait Until Keyword Succeeds 60s 2s
85 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
86 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
87
88 Enable Switch Outlet ${src['power_switch_port']}
89 # Check ONU port is Enabled in ONOS
90 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
91 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
92 # Verify EAPOL flows are added for the ONU port
93 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
94 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
95 # Verify ONU state in voltha
96 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
97 ... ENABLED ACTIVE REACHABLE
98 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
99 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
100 ... ENABLED ACTIVE REACHABLE ${src['onu']}
101 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
102 ... Wait Until Keyword Succeeds 60s 2s
103 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
104 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
105 Run Keyword And Ignore Error Collect Logs
106 END
107
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000108Verify restart ofagent container after VOLTHA is operational
109 [Documentation] Restart ofagent container after VOLTHA is operational.
110 ... Please note this test case should be run before the restart of other containers.
111 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800112 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -0700113 [Setup] Run Keywords Announce Message START TEST ofagentRestart
114 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700115 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700116 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700117 ... AND Announce Message END TEST ofagentRestart
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000118 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700119 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000120 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700121 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000122 Restart Pod ${NAMESPACE} ofagent
123 Sleep 60s
124 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
125 ... Running
126 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700127 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000128 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700129 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000130 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000131
Suchitra Vemuric4203692020-01-30 20:29:46 -0800132Verify restart openolt-adapter container after VOLTHA is operational
133 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000134 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuri109feb12020-01-23 16:25:02 -0800135 [Tags] functional VOL-1958 RestartPods
Andy Bavierabeba262020-02-07 16:22:16 -0700136 [Setup] Run Keywords Announce Message START TEST RestartPods
137 ... AND Start Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -0700138 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700139 ... AND Stop Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -0700140 ... AND Announce Message END TEST RestartPods
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000141 ${waitforRestart} Set Variable 120s
Suchitra Vemuri75596062020-02-08 21:47:36 -0800142 # Remove the Sanity Check after enabling first failure test (OLT Adapter Test)
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800143 #Run Keyword If ${has_dataplane} Clean Up Linux
144 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700145 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000146 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700147 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000148 ${podName} Set Variable adapter-open-olt
149 Restart Pod ${NAMESPACE} ${podName}
150 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
151 ... Running
152 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700153 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000154 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700155 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000156 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
157 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000158
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000159Check ONU adapter crash not forcing authentication again
160 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
161 ... message count to make sure auth not started again and validates EAP status and ping.
162 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
163 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700164 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
165 ... AND Start Logging ONUAdaptCrash
166 [Teardown] Run Keywords Collect Logs
167 ... AND Stop Logging ONUAdaptCrash
168 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000169 @{before_list}= Create List
170 @{after_list}= Create List
171 FOR ${I} IN RANGE 0 ${num_onus}
172 ${src}= Set Variable ${hosts.src[${I}]}
173 ${dst}= Set Variable ${hosts.dst[${I}]}
174 ${onu_device_id}= Get Device ID From SN ${src['onu']}
175 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
176 ... ${of_id}
177 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
178 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
179 ... ${src['container_type']} ${src['container_name']}
180 Append To List ${before_list} ${before}
181 END
182 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
183 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
184 ... Running
185 FOR ${I} IN RANGE 0 ${num_onus}
186 ${src}= Set Variable ${hosts.src[${I}]}
187 ${dst}= Set Variable ${hosts.dst[${I}]}
188 ${onu_device_id}= Get Device ID From SN ${src['onu']}
189 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
190 ... ${of_id}
191 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
192 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
193 ... ${src['container_type']} ${src['container_name']}
194 Append To List ${after_list} ${after}
195 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
196 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
197 ... ${src['container_type']} ${src['container_name']}
198 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
199 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
200 ... Wait Until Keyword Succeeds 60s 2s Check Ping
201 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
202 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
203 END
204 Lists Should Be Equal ${after_list} ${before_list}
205 Log ${after_list}
206 Log ${before_list}
207 Run Keyword and Ignore Error Collect Logs
208
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000209ONU Reboot
210 [Documentation] Reboot ONU and verify that ONU comes up properly
211 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700212 [Setup] Run Keywords Announce Message START TEST RebootONU
213 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700214 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700215 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700216 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000217 FOR ${I} IN RANGE 0 ${num_onus}
218 ${src}= Set Variable ${hosts.src[${I}]}
219 ${dst}= Set Variable ${hosts.dst[${I}]}
220 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800221 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
222 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000223 Reboot ONU ${onu_device_id} ${src} ${dst}
224 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800225 # Check ONU port is Enabled in ONOS
226 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
227 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
228 # Verify EAPOL flows are added for the ONU port
229 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
230 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
231 # Verify ONU state in voltha
232 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
233 ... ENABLED ACTIVE REACHABLE
234 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
235 # Verify pings are successful after reboot on the current ONU
236 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
237 ... Wait Until Keyword Succeeds 60s 2s
238 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
239 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000240 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800241 #Run Keyword If ${has_dataplane} Clean Up Linux
242 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
243 #Perform Sanity Test