blob: 50d294d9be9c3c2534339c35c9ee6eeaf038e167 [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
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800107 # Deleting OLT run tests independently (as this test doesn't not run on each POD)
108 Run Keyword If ${has_dataplane} Delete Device and Verify
109
110Verify restart openolt-adapter container after VOLTHA is operational
111 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
112 ... Prerequisite : ONUs are authenticated and pingable.
113 [Tags] functional VOL-1958 RestartPods released
114 [Setup] Run Keywords Announce Message START TEST RestartPods
115 ... AND Start Logging RestartPods
116 [Teardown] Run Keywords Collect Logs
117 ... AND Stop Logging RestartPods
118 ... AND Announce Message END TEST RestartPods
119 # Add OLT device
120 setup
121 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
122 Run Keyword If ${has_dataplane} Clean Up Linux
123 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
124 ${waitforRestart} Set Variable 120s
125 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
126 Log ${podStatusOutput}
127 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
128 ${podName} Set Variable adapter-open-olt
129 Restart Pod ${NAMESPACE} ${podName}
130 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
131 ... Running
132 Repeat Sanity Test
133 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
134 Log ${podStatusOutput}
135 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
136 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
137 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800138
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000139Verify restart ofagent container after VOLTHA is operational
140 [Documentation] Restart ofagent container after VOLTHA is operational.
141 ... Please note this test case should be run before the restart of other containers.
142 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800143 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -0700144 [Setup] Run Keywords Announce Message START TEST ofagentRestart
145 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700146 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700147 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700148 ... AND Announce Message END TEST ofagentRestart
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000149 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700150 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000151 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700152 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000153 Restart Pod ${NAMESPACE} ofagent
154 Sleep 60s
155 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
156 ... Running
157 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700158 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000159 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700160 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000161 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000162
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000163Check ONU adapter crash not forcing authentication again
164 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
165 ... message count to make sure auth not started again and validates EAP status and ping.
166 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
167 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700168 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
169 ... AND Start Logging ONUAdaptCrash
170 [Teardown] Run Keywords Collect Logs
171 ... AND Stop Logging ONUAdaptCrash
172 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000173 @{before_list}= Create List
174 @{after_list}= Create List
175 FOR ${I} IN RANGE 0 ${num_onus}
176 ${src}= Set Variable ${hosts.src[${I}]}
177 ${dst}= Set Variable ${hosts.dst[${I}]}
178 ${onu_device_id}= Get Device ID From SN ${src['onu']}
179 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
180 ... ${of_id}
181 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
182 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
183 ... ${src['container_type']} ${src['container_name']}
184 Append To List ${before_list} ${before}
185 END
186 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
187 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
188 ... Running
189 FOR ${I} IN RANGE 0 ${num_onus}
190 ${src}= Set Variable ${hosts.src[${I}]}
191 ${dst}= Set Variable ${hosts.dst[${I}]}
192 ${onu_device_id}= Get Device ID From SN ${src['onu']}
193 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
194 ... ${of_id}
195 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
196 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
197 ... ${src['container_type']} ${src['container_name']}
198 Append To List ${after_list} ${after}
199 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
200 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
201 ... ${src['container_type']} ${src['container_name']}
202 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
203 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
204 ... Wait Until Keyword Succeeds 60s 2s Check Ping
205 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
206 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
207 END
208 Lists Should Be Equal ${after_list} ${before_list}
209 Log ${after_list}
210 Log ${before_list}
211 Run Keyword and Ignore Error Collect Logs
212
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000213ONU Reboot
214 [Documentation] Reboot ONU and verify that ONU comes up properly
215 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700216 [Setup] Run Keywords Announce Message START TEST RebootONU
217 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700218 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700219 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700220 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000221 FOR ${I} IN RANGE 0 ${num_onus}
222 ${src}= Set Variable ${hosts.src[${I}]}
223 ${dst}= Set Variable ${hosts.dst[${I}]}
224 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800225 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
226 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000227 Reboot ONU ${onu_device_id} ${src} ${dst}
228 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800229 # Check ONU port is Enabled in ONOS
230 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
231 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
232 # Verify EAPOL flows are added for the ONU port
233 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
234 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
235 # Verify ONU state in voltha
236 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
237 ... ENABLED ACTIVE REACHABLE
238 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
239 # Verify pings are successful after reboot on the current ONU
240 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
241 ... Wait Until Keyword Succeeds 60s 2s
242 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
243 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000244 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800245 #Run Keyword If ${has_dataplane} Clean Up Linux
246 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
247 #Perform Sanity Test