blob: 925083531b750baf98de1582b7fa2776c047542d [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.
14# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
HungWei Chiu87edb1f2020-01-28 00:10:58 +000017Documentation Test various failure scenarios
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000018Suite Setup Common Test Suite Setup
19Test Setup Setup
20Test Teardown Teardown
21#Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
HungWei Chiu87edb1f2020-01-28 00:10:58 +000034Resource ../../libraries/power_switch.robot
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000035
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
41${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
42${HELM_CHARTS_DIR} ~/helm-charts
43${VOLTHA_POD_NUM} 8
44${NAMESPACE} voltha
45# For below variable value, using deployment name as using grep for
46# parsing radius pod name, we can also use full radius pod name
47${RESTART_POD_NAME} radius
48${timeout} 60s
49${of_id} 0
50${logical_id} 0
Suchitra Vemuri109feb12020-01-23 16:25:02 -080051${has_dataplane} True
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000052${external_libs} True
53${teardown_device} False
54${scripts} ../../scripts
55
Andy Bavierabeba262020-02-07 16:22:16 -070056# Per-test logging on failure is turned off by default; set this variable to enable
57${container_log_dir} ${None}
58
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000059*** Test Cases ***
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000060Verify restart ofagent container after VOLTHA is operational
61 [Documentation] Restart ofagent container after VOLTHA is operational.
62 ... Please note this test case should be run before the restart of other containers.
63 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurid151c332020-01-28 17:48:45 -080064 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavierabeba262020-02-07 16:22:16 -070065 [Setup] Run Keywords Announce Message START TEST ofagentRestart
66 ... AND Start Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -070067 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070068 ... AND Stop Logging ofagentRestart
Andy Bavier4a8450e2020-02-04 08:58:37 -070069 ... AND Announce Message END TEST ofagentRestart
Suchitra Vemurib661bf32020-01-30 22:46:14 -080070 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
71 Run Keyword If ${has_dataplane} Clean Up Linux
72 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000073 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -070074 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000075 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070076 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000077 Restart Pod ${NAMESPACE} ofagent
78 Sleep 60s
79 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
80 ... Running
81 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -070082 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000083 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070084 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000085 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000086
Suchitra Vemuric4203692020-01-30 20:29:46 -080087Verify restart openolt-adapter container after VOLTHA is operational
88 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000089 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuri109feb12020-01-23 16:25:02 -080090 [Tags] functional VOL-1958 RestartPods
Andy Bavierabeba262020-02-07 16:22:16 -070091 [Setup] Run Keywords Announce Message START TEST RestartPods
92 ... AND Start Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -070093 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070094 ... AND Stop Logging RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -070095 ... AND Announce Message END TEST RestartPods
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000096 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -070097 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000098 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070099 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000100 ${podName} Set Variable adapter-open-olt
101 Restart Pod ${NAMESPACE} ${podName}
102 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
103 ... Running
104 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -0700105 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000106 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700107 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000108 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
109 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000110
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000111Check ONU adapter crash not forcing authentication again
112 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
113 ... message count to make sure auth not started again and validates EAP status and ping.
114 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
115 [Tags] functional ONUAdaptCrash notready
Andy Bavierabeba262020-02-07 16:22:16 -0700116 [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash
117 ... AND Start Logging ONUAdaptCrash
118 [Teardown] Run Keywords Collect Logs
119 ... AND Stop Logging ONUAdaptCrash
120 ... AND Announce Message END TEST ONUAdaptCrash
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000121 @{before_list}= Create List
122 @{after_list}= Create List
123 FOR ${I} IN RANGE 0 ${num_onus}
124 ${src}= Set Variable ${hosts.src[${I}]}
125 ${dst}= Set Variable ${hosts.dst[${I}]}
126 ${onu_device_id}= Get Device ID From SN ${src['onu']}
127 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
128 ... ${of_id}
129 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
130 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
131 ... ${src['container_type']} ${src['container_name']}
132 Append To List ${before_list} ${before}
133 END
134 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
135 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
136 ... Running
137 FOR ${I} IN RANGE 0 ${num_onus}
138 ${src}= Set Variable ${hosts.src[${I}]}
139 ${dst}= Set Variable ${hosts.dst[${I}]}
140 ${onu_device_id}= Get Device ID From SN ${src['onu']}
141 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
142 ... ${of_id}
143 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
144 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
145 ... ${src['container_type']} ${src['container_name']}
146 Append To List ${after_list} ${after}
147 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
148 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
149 ... ${src['container_type']} ${src['container_name']}
150 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
151 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
152 ... Wait Until Keyword Succeeds 60s 2s Check Ping
153 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
154 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
155 END
156 Lists Should Be Equal ${after_list} ${before_list}
157 Log ${after_list}
158 Log ${before_list}
159 Run Keyword and Ignore Error Collect Logs
160
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000161Verify ONU after rebooting physically
162 [Documentation] Test the ONU funcaionality by physically turning on/off ONU.
163 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
164 [Tags] functional VOL-2488 PowerSwitch notready
Andy Bavierabeba262020-02-07 16:22:16 -0700165 [Setup] Run Keywords Announce Message START TEST PowerSwitch
166 ... AND Start Logging PowerSwitch
Andy Bavier4a8450e2020-02-04 08:58:37 -0700167 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700168 ... AND Stop Logging PowerSwitch
Andy Bavier4a8450e2020-02-04 08:58:37 -0700169 ... AND Announce Message END TEST PowerSwitch
170 Start Log Capture PowerSwitch ${container_log_dir}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000171 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
172 FOR ${I} IN RANGE 0 ${num_onus}
173 ${src}= Set Variable ${hosts.src[${I}]}
174 ${dst}= Set Variable ${hosts.dst[${I}]}
175 Disable Switch Outlet ${src['power_switch_port']}
176 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
177 ... Wait Until Keyword Succeeds 60s 2s
178 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
179 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
180
hwchiub7139c12020-01-28 21:51:28 +0000181 Enable Switch Outlet ${src['power_switch_port']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000182 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
183 ... ENABLED ACTIVE REACHABLE ${src['onu']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000184 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
185 ... Wait Until Keyword Succeeds 60s 2s
186 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
187 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
188 END
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000189
190ONU Reboot
191 [Documentation] Reboot ONU and verify that ONU comes up properly
192 [Tags] VOL-1957 RebootONU notready
Andy Bavierabeba262020-02-07 16:22:16 -0700193 [Setup] Run Keywords Announce Message START TEST RebootONU
194 ... AND Start Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700195 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700196 ... AND Stop Logging RebootONU
Andy Bavier4a8450e2020-02-04 08:58:37 -0700197 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000198 FOR ${I} IN RANGE 0 ${num_onus}
199 ${src}= Set Variable ${hosts.src[${I}]}
200 ${dst}= Set Variable ${hosts.dst[${I}]}
201 ${onu_device_id}= Get Device ID From SN ${src['onu']}
202 Reboot ONU ${onu_device_id} ${src} ${dst}
203 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
204 Run Keyword If ${has_dataplane} Clean Up Linux
205 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
206 Perform Sanity Test
207 END