blob: 3eaa53de437a09f0ef7cf9e67692f0cd519c496d [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 ***
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000059Verify restart ofagent container after VOLTHA is operational
60 [Documentation] Restart ofagent container after VOLTHA is operational.
61 ... Please note this test case should be run before the restart of other containers.
62 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -080063 [Tags] functional VOL-2409 ofagentRestart
Andy Bavierabeba262020-02-07 16:22:16 -070064 [Setup] Run Keywords Announce Message START TEST ofagentRestart
65 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -070066 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070067 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -070068 ... AND Announce Message END TEST ofagentRestart
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -080069 # Add OLT device
70 setup
Suchitra Vemurib661bf32020-01-30 22:46:14 -080071 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
72 Run Keyword If ${has_dataplane} Clean Up Linux
73 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000074 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -070075 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000076 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070077 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000078 Restart Pod ${NAMESPACE} ofagent
79 Sleep 60s
80 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
81 ... Running
82 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -070083 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000084 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070085 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000086 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000087
Suchitra Vemuric4203692020-01-30 20:29:46 -080088Verify restart openolt-adapter container after VOLTHA is operational
89 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000090 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuri109feb12020-01-23 16:25:02 -080091 [Tags] functional VOL-1958 RestartPods
Andy Bavierabeba262020-02-07 16:22:16 -070092 [Setup] Run Keywords Announce Message START TEST RestartPods
93 ... AND Start Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -070094 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070095 ... AND Stop Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -070096 ... AND Announce Message END TEST RestartPods
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000097 ${waitforRestart} Set Variable 120s
Suchitra Vemuri75596062020-02-08 21:47:36 -080098 # Remove the Sanity Check after enabling first failure test (OLT Adapter Test)
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -080099 #Run Keyword If ${has_dataplane} Clean Up Linux
100 #Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700101 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000102 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700103 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000104 ${podName} Set Variable adapter-open-olt
105 Restart Pod ${NAMESPACE} ${podName}
106 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
107 ... Running
108 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700109 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000110 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700111 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000112 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
113 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000114
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000115Check ONU adapter crash not forcing authentication again
116 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
117 ... message count to make sure auth not started again and validates EAP status and ping.
118 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
119 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700120 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
121 ... AND Start Logging ONUAdaptCrash
122 [Teardown] Run Keywords Collect Logs
123 ... AND Stop Logging ONUAdaptCrash
124 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000125 @{before_list}= Create List
126 @{after_list}= Create List
127 FOR ${I} IN RANGE 0 ${num_onus}
128 ${src}= Set Variable ${hosts.src[${I}]}
129 ${dst}= Set Variable ${hosts.dst[${I}]}
130 ${onu_device_id}= Get Device ID From SN ${src['onu']}
131 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
132 ... ${of_id}
133 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
134 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
135 ... ${src['container_type']} ${src['container_name']}
136 Append To List ${before_list} ${before}
137 END
138 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
139 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
140 ... Running
141 FOR ${I} IN RANGE 0 ${num_onus}
142 ${src}= Set Variable ${hosts.src[${I}]}
143 ${dst}= Set Variable ${hosts.dst[${I}]}
144 ${onu_device_id}= Get Device ID From SN ${src['onu']}
145 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
146 ... ${of_id}
147 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
148 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
149 ... ${src['container_type']} ${src['container_name']}
150 Append To List ${after_list} ${after}
151 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
152 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
153 ... ${src['container_type']} ${src['container_name']}
154 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
155 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
156 ... Wait Until Keyword Succeeds 60s 2s Check Ping
157 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
158 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
159 END
160 Lists Should Be Equal ${after_list} ${before_list}
161 Log ${after_list}
162 Log ${before_list}
163 Run Keyword and Ignore Error Collect Logs
164
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000165Verify ONU after rebooting physically
166 [Documentation] Test the ONU funcaionality by physically turning on/off ONU.
167 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
168 [Tags] functional VOL-2488 PowerSwitch notready
Andy Bavierabeba262020-02-07 16:22:16 -0700169 [Setup] Run Keywords Announce Message START TEST PowerSwitch
170 ... AND Start Logging PowerSwitch
Andy Bavier4a8450e2020-02-04 08:58:37 -0700171 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700172 ... AND Stop Logging PowerSwitch
Andy Bavier4a8450e2020-02-04 08:58:37 -0700173 ... AND Announce Message END TEST PowerSwitch
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000174 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
175 FOR ${I} IN RANGE 0 ${num_onus}
176 ${src}= Set Variable ${hosts.src[${I}]}
177 ${dst}= Set Variable ${hosts.dst[${I}]}
178 Disable Switch Outlet ${src['power_switch_port']}
179 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
180 ... Wait Until Keyword Succeeds 60s 2s
181 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
182 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
183
hwchiub7139c12020-01-28 21:51:28 +0000184 Enable Switch Outlet ${src['power_switch_port']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000185 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
186 ... ENABLED ACTIVE REACHABLE ${src['onu']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000187 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
188 ... Wait Until Keyword Succeeds 60s 2s
189 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
190 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
191 END
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000192
193ONU Reboot
194 [Documentation] Reboot ONU and verify that ONU comes up properly
195 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700196 [Setup] Run Keywords Announce Message START TEST RebootONU
197 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700198 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700199 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700200 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000201 FOR ${I} IN RANGE 0 ${num_onus}
202 ${src}= Set Variable ${hosts.src[${I}]}
203 ${dst}= Set Variable ${hosts.dst[${I}]}
204 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800205 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
206 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000207 Reboot ONU ${onu_device_id} ${src} ${dst}
208 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800209 # Check ONU port is Enabled in ONOS
210 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
211 ... Verify ONU Port Is Enabled ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
212 # Verify EAPOL flows are added for the ONU port
213 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
214 ... Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
215 # Verify ONU state in voltha
216 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
217 ... ENABLED ACTIVE REACHABLE
218 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
219 # Verify pings are successful after reboot on the current ONU
220 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
221 ... Wait Until Keyword Succeeds 60s 2s
222 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
223 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000224 END
Suchitra Vemuricd2f64f2020-02-18 18:30:27 -0800225 #Run Keyword If ${has_dataplane} Clean Up Linux
226 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
227 #Perform Sanity Test