blob: ee9850c85abb9b06b6dc8121fd6aef9e1b4770fc [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${teardown_device} False
52${scripts} ../../scripts
53
Andy Bavierabeba262020-02-07 16:22:16 -070054# Per-test logging on failure is turned off by default; set this variable to enable
55${container_log_dir} ${None}
56
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000057*** Test Cases ***
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080058Verify ONU after rebooting physically
59 [Documentation] Test the ONU functionality by physically turning on/off ONU.
60 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
61 ... Test case runs only on the PODs that are configured with PowerSwitch that
62 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
63 ... VOL-2634
64 [Tags] functional PowerSwitch
65 [Setup] Run Keywords Announce Message START TEST PowerSwitch
66 ... AND Start Logging PowerSwitch
67 [Teardown] Run Keywords Collect Logs
68 ... AND Stop Logging PowerSwitch
69 ... AND Announce Message END TEST PowerSwitch
70 # Add OLT device
71 setup
72 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
73 Run Keyword If ${has_dataplane} Clean Up Linux
74 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
75 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
76 FOR ${I} IN RANGE 0 ${num_onus}
77 ${src}= Set Variable ${hosts.src[${I}]}
78 ${dst}= Set Variable ${hosts.dst[${I}]}
79 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
80 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
81 Disable Switch Outlet ${src['power_switch_port']}
82 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
83 ... Wait Until Keyword Succeeds 60s 2s
84 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
85 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
86
87 Enable Switch Outlet ${src['power_switch_port']}
88 # Check ONU port is Enabled in ONOS
89 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
90 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
91 # Verify EAPOL flows are added for the ONU port
92 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
93 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
94 # Verify ONU state in voltha
95 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
96 ... ENABLED ACTIVE REACHABLE
97 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri60be98b2020-02-19 16:41:21 -080098 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
99 ... Wait Until Keyword Succeeds 60s 2s
100 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
101 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
102 Run Keyword And Ignore Error Collect Logs
103 END
Suchitra Vemurid7096132020-02-21 14:50:47 -0800104 # Deleting OLT after tests completes independently (as this test doesn't not run on each POD)
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800105 Run Keyword If ${has_dataplane} Delete Device and Verify
106
107Verify restart openolt-adapter container after VOLTHA is operational
108 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
109 ... Prerequisite : ONUs are authenticated and pingable.
110 [Tags] functional VOL-1958 RestartPods released
111 [Setup] Run Keywords Announce Message START TEST RestartPods
112 ... AND Start Logging RestartPods
113 [Teardown] Run Keywords Collect Logs
114 ... AND Stop Logging RestartPods
115 ... AND Announce Message END TEST RestartPods
116 # Add OLT device
117 setup
118 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
119 Run Keyword If ${has_dataplane} Clean Up Linux
120 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
121 ${waitforRestart} Set Variable 120s
122 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
123 Log ${podStatusOutput}
124 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
125 ${podName} Set Variable adapter-open-olt
126 Restart Pod ${NAMESPACE} ${podName}
127 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
128 ... Running
129 Repeat Sanity Test
Suchitra Vemurid7096132020-02-21 14:50:47 -0800130 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800131 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
132 Log ${podStatusOutput}
133 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
134 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
135 Log to console Pod ${podName} restarted and sanity checks passed successfully
Suchitra Vemuri60be98b2020-02-19 16:41:21 -0800136
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000137Verify restart ofagent container after VOLTHA is operational
138 [Documentation] Restart ofagent container after VOLTHA is operational.
139 ... Please note this test case should be run before the restart of other containers.
140 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurid7096132020-02-21 14:50:47 -0800141 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavierabeba262020-02-07 16:22:16 -0700142 [Setup] Run Keywords Announce Message START TEST ofagentRestart
143 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700144 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700145 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -0700146 ... AND Announce Message END TEST ofagentRestart
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000147 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -0700148 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000149 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700150 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000151 Restart Pod ${NAMESPACE} ofagent
152 Sleep 60s
153 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
154 ... Running
155 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700156 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000157 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700158 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000159 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000160
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000161Check ONU adapter crash not forcing authentication again
162 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
163 ... message count to make sure auth not started again and validates EAP status and ping.
164 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
165 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700166 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
167 ... AND Start Logging ONUAdaptCrash
168 [Teardown] Run Keywords Collect Logs
169 ... AND Stop Logging ONUAdaptCrash
170 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000171 @{before_list}= Create List
172 @{after_list}= Create List
173 FOR ${I} IN RANGE 0 ${num_onus}
174 ${src}= Set Variable ${hosts.src[${I}]}
175 ${dst}= Set Variable ${hosts.dst[${I}]}
176 ${onu_device_id}= Get Device ID From SN ${src['onu']}
177 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
178 ... ${of_id}
179 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
180 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
181 ... ${src['container_type']} ${src['container_name']}
182 Append To List ${before_list} ${before}
183 END
184 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
185 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
186 ... Running
187 FOR ${I} IN RANGE 0 ${num_onus}
188 ${src}= Set Variable ${hosts.src[${I}]}
189 ${dst}= Set Variable ${hosts.dst[${I}]}
190 ${onu_device_id}= Get Device ID From SN ${src['onu']}
191 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
192 ... ${of_id}
193 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
194 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
195 ... ${src['container_type']} ${src['container_name']}
196 Append To List ${after_list} ${after}
197 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
198 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
199 ... ${src['container_type']} ${src['container_name']}
200 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
201 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
202 ... Wait Until Keyword Succeeds 60s 2s Check Ping
203 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
204 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
205 END
206 Lists Should Be Equal ${after_list} ${before_list}
207 Log ${after_list}
208 Log ${before_list}
209 Run Keyword and Ignore Error Collect Logs
210
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000211ONU Reboot
212 [Documentation] Reboot ONU and verify that ONU comes up properly
213 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700214 [Setup] Run Keywords Announce Message START TEST RebootONU
215 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700216 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700217 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700218 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000219 FOR ${I} IN RANGE 0 ${num_onus}
220 ${src}= Set Variable ${hosts.src[${I}]}
221 ${dst}= Set Variable ${hosts.dst[${I}]}
222 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800223 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
224 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000225 Reboot ONU ${onu_device_id} ${src} ${dst}
226 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800227 # Check ONU port is Enabled in ONOS
228 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
229 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
230 # Verify EAPOL flows are added for the ONU port
231 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
232 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
233 # Verify ONU state in voltha
234 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
235 ... ENABLED ACTIVE REACHABLE
236 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
237 # Verify pings are successful after reboot on the current ONU
238 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
239 ... Wait Until Keyword Succeeds 60s 2s
240 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
241 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000242 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800243 #Run Keyword If ${has_dataplane} Clean Up Linux
244 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
245 #Perform Sanity Test