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