blob: 737cc39170b9da43b11af991bd619eef9f8e0402 [file] [log] [blame]
David Bainbridgef81cd642019-11-20 00:14:47 +00001# Copyright 2017 - present Open Networking Foundation
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -07002#
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
Matteo Scandolo1294aeb2019-09-24 16:20:32 -070015# FIXME Can we use the same test against BBSim and Hardware?
16
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070017*** Settings ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070018Documentation Test various end-to-end scenarios
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070019Suite Setup Setup Suite
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070020Test Setup Setup
21Test Teardown Teardown
Andy Bavierba9866b2019-10-11 07:11:53 -070022Suite Teardown Teardown Suite
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070023Library Collections
24Library String
25Library OperatingSystem
26Library XML
27Library RequestsLibrary
Andy Bavierba9866b2019-10-11 07:11:53 -070028Library ../../libraries/DependencyLibrary.py
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070029Resource ../../libraries/onos.robot
30Resource ../../libraries/voltctl.robot
David Bainbridgef81cd642019-11-20 00:14:47 +000031Resource ../../libraries/voltha.robot
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070032Resource ../../libraries/utils.robot
Andy Bavierba9866b2019-10-11 07:11:53 -070033Resource ../../libraries/k8s.robot
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070034Resource ../../variables/variables.robot
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070035
36*** Variables ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070037${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
suraj gourd64356b2019-11-07 13:26:20 +000044${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
Andy Bavierba9866b2019-10-11 07:11:53 -070048${timeout} 60s
Zack Williamsec53a1b2019-09-16 15:50:52 -070049${of_id} 0
50${logical_id} 0
Andy Bavierba9866b2019-10-11 07:11:53 -070051${has_dataplane} True
52${external_libs} True
53${teardown_device} False
David Bainbridgef81cd642019-11-20 00:14:47 +000054${scripts} ../../scripts
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070055
56*** Test Cases ***
57Sanity E2E Test for OLT/ONU on POD
58 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
59 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
Andy Bavierba9866b2019-10-11 07:11:53 -070060 [Tags] sanity test1
Suchitra Vemuri6db89412019-11-14 14:52:54 -080061 [Teardown] NONE
Suchitra Vemuric5295a32019-12-15 20:32:04 -080062 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -080063 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemuri582574b2019-12-10 21:11:54 -080064 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070065
Suchitra Vemuri6db89412019-11-14 14:52:54 -080066Test Disable and Enable ONU
67 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
68 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
69 ... Perform disable on the ONUs and validate that the pings do not succeed
70 ... Perform enable on the ONUs and validate that the pings are successful
Suchitra Vemuri04245f72020-01-08 16:43:24 -080071 [Tags] functional DisableEnableONU released
Suchitra Vemuri6db89412019-11-14 14:52:54 -080072 [Setup] None
suraj gour7f6d5fe2019-11-29 10:56:35 +000073 [Teardown] None
Suchitra Vemuri6db89412019-11-14 14:52:54 -080074
75 FOR ${I} IN RANGE 0 ${num_onus}
76 ${src}= Set Variable ${hosts.src[${I}]}
77 ${dst}= Set Variable ${hosts.dst[${I}]}
78
79 ${onu_device_id}= Get Device ID From SN ${src['onu']}
80 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
81 ... ${of_id}
82 Disable Device ${onu_device_id}
83 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst['dp_iface_ip_qinq']}
84 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
85 Enable Device ${onu_device_id}
86 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
87 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
88 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping True ${dst['dp_iface_ip_qinq']}
89 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Suchitra Vemuri582574b2019-12-10 21:11:54 -080090 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
91 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri6db89412019-11-14 14:52:54 -080092 END
Suchitra Vemuri582574b2019-12-10 21:11:54 -080093 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri6db89412019-11-14 14:52:54 -080094
Suchitra Vemuri5994cd12019-12-17 22:20:55 -080095Test Subscriber Delete and Add
96 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
97 ... Assuming that all the ONUs are authenticated/DHCP/pingable
98 ... Delete a subscriber and validate that the pings do not succeed
99 ... Re-add the subscriber and validate that the pings are successful
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800100 [Tags] functional SubAddDelete released
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800101 [Setup] None
102 [Teardown] None
103
104 FOR ${I} IN RANGE 0 ${num_onus}
105 ${src}= Set Variable ${hosts.src[${I}]}
106 ${dst}= Set Variable ${hosts.dst[${I}]}
107
108 ${onu_device_id}= Get Device ID From SN ${src['onu']}
109 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
110 ... ${of_id}
111 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
112 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
113 Sleep 10s
114 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst['dp_iface_ip_qinq']}
115 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
116 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
117 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
118 Sleep 10s
119 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
120 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
121 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping True ${dst['dp_iface_ip_qinq']}
122 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
123 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
124 Run Keyword and Ignore Error Collect Logs
125 END
126 Run Keyword and Ignore Error Collect Logs
127
suraj gourd64356b2019-11-07 13:26:20 +0000128Check OLT/ONU Authentication After Radius Pod Restart
suraj gour7f6d5fe2019-11-29 10:56:35 +0000129 [Documentation] After radius restart, triggers reassociation, checks status and
130 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
131 ... wpa supplicant is running in background hence it is recommended to remove
132 ... teardown from previous test or uncomment 'Teardown None'.
133 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800134 [Tags] functional RadiusRestart released
suraj gourd5cfdbb2019-12-13 12:44:55 +0000135 [Setup] None
Suchitra Vemuribb00d9d2019-12-16 15:38:38 -0800136 [Teardown] None
suraj gourd64356b2019-11-07 13:26:20 +0000137 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
138
139 FOR ${I} IN RANGE 0 ${num_onus}
140 ${src}= Set Variable ${hosts.src[${I}]}
141 ${dst}= Set Variable ${hosts.dst[${I}]}
142
143
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 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
148 ... ${ONOS_SSH_PORT} ${onu_port}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000149 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication After Reassociate
150 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
suraj gourd64356b2019-11-07 13:26:20 +0000151 ... ${src['container_type']} ${src['container_name']}
152 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
153 ... ${ONOS_SSH_PORT} ${onu_port}
154 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
155 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
156 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
157 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
158 ... ${dst['container_name']}
159 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
160 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800161 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
162 Run Keyword and Ignore Error Collect Logs
suraj gourd64356b2019-11-07 13:26:20 +0000163 END
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800164 Run Keyword and Ignore Error Collect Logs
suraj gourd64356b2019-11-07 13:26:20 +0000165
suraj gourd5cfdbb2019-12-13 12:44:55 +0000166Check DHCP attempt fails when subscriber is not added
167 [Documentation] Validates when removed subscriber access, DHCP attempt, ping fails and
168 ... when again added subscriber access, DHCP attempt, ping succeeds
169 ... Assuming that test1 or sanity test was executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800170 [Tags] functional SubsRemoveDHCP released
suraj gourd5cfdbb2019-12-13 12:44:55 +0000171 [Setup] None
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800172 [Teardown] None
suraj gourd5cfdbb2019-12-13 12:44:55 +0000173
174 FOR ${I} IN RANGE 0 ${num_onus}
175 ${src}= Set Variable ${hosts.src[${I}]}
176 ${dst}= Set Variable ${hosts.dst[${I}]}
177
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}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800181 Run Keyword And Ignore Error Login And Run Command On Remote System killall dhclient ${src['ip']}
182 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
183 Run Keyword And Ignore Error Login And Run Command On Remote System ps -ef | grep dhclient ${src['ip']}
184 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000185 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
186 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800187 Sleep 5s
188 Run Keyword And Ignore Error Login And Run Command On Remote System ps -ef | grep dhclient ${src['ip']}
189 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
suraj gour19ee3a82019-12-16 09:43:14 +0000190 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds ${timeout} 2s
191 ... Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
192 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800193 Run Keyword And Ignore Error Login And Run Command On Remote System ifconfig | grep -A 10 ens ${src['ip']}
194 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000195 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping False
196 ... False ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
197 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
198 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
199 ... ${dst['container_name']}
200 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
201 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
202 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
203 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
204 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
205 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
206 ... ${dst['container_name']}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800207 Run Keyword and Ignore Error Collect Logs
208 END
209 Run Keyword and Ignore Error Collect Logs
210
suraj gour1ecfae92019-12-20 15:11:40 +0000211Check ONU adapter crash not forcing authentication again
212 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
213 ... message count to make sure auth not started again and validates EAP status and ping.
214 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800215 [Tags] functional ONUAdaptCrash notready
suraj gour1ecfae92019-12-20 15:11:40 +0000216 [Setup] None
217 [Teardown] None
218 @{before_list}= Create List
219 @{after_list}= Create List
220 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']}
224 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
225 ... ${of_id}
226 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
227 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
228 ... ${src['container_type']} ${src['container_name']}
229 Append To List ${before_list} ${before}
230 END
231 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
232 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
233 ... Running
234 FOR ${I} IN RANGE 0 ${num_onus}
235 ${src}= Set Variable ${hosts.src[${I}]}
236 ${dst}= Set Variable ${hosts.dst[${I}]}
237 ${onu_device_id}= Get Device ID From SN ${src['onu']}
238 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
239 ... ${of_id}
240 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
241 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
242 ... ${src['container_type']} ${src['container_name']}
243 Append To List ${after_list} ${after}
244 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
245 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
246 ... ${src['container_type']} ${src['container_name']}
247 Should Contain ${output} SUCCESS
248 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping
249 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
250 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
251 END
252 Lists Should Be Equal ${after_list} ${before_list}
253 Log ${after_list}
254 Log ${before_list}
255 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800256
257Test Disable and Enable ONU scenario for ATT workflow
258 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
259 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
260 ... Perform disable on the ONUs, call volt-remove-subscriber and validate that the pings do not succeed
261 ... Perform enable on the ONUs, authentication check, volt-add-subscriber-access and validate that the pings are successful
262 ... VOL-2284
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800263 [Tags] functional ATT_DisableEnableONU
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800264 [Setup] None
265 #[Teardown] None
266
267 FOR ${I} IN RANGE 0 ${num_onus}
268 ${src}= Set Variable ${hosts.src[${I}]}
269 ${dst}= Set Variable ${hosts.dst[${I}]}
270
271 ${onu_device_id}= Get Device ID From SN ${src['onu']}
272 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
273 ... ${of_id}
274 Disable Device ${onu_device_id}
Suchitra Vemuri04245f72020-01-08 16:43:24 -0800275 Sleep 5s
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800276 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
277 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800278 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst['dp_iface_ip_qinq']}
279 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
280 ... ELSE sleep 60s
281 Enable Device ${onu_device_id}
282 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
283 ... ${ONOS_SSH_PORT} ${onu_port}
284 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication After Reassociate
285 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
286 ... ${src['container_type']} ${src['container_name']}
287 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
288 ... ${ONOS_SSH_PORT} ${onu_port}
289 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
290 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
291 Sleep 10s
292 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
Andy Bavier08ae5852019-12-19 09:12:42 -0700293 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800294 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
295 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
296 ... ${dst['container_name']}
297 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
298 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri5994cd12019-12-17 22:20:55 -0800299 Run Keyword and Ignore Error Collect Logs
suraj gourd5cfdbb2019-12-13 12:44:55 +0000300 END
301 Run Keyword and Ignore Error Collect Logs
302
Gayathri.Selvan49398962020-01-13 07:19:12 +0000303Verify restart any container after VOLTHA is operational
304 [Documentation] Restart any container after VOLTHA is operational.
305 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurid1e2b712020-01-13 23:06:22 -0800306 [Tags] functional VOL-1958 RestartPods
Gayathri.Selvan49398962020-01-13 07:19:12 +0000307 [Setup] NONE
308 [Teardown] NONE
309 ${waitforRestart} Set Variable 120s
310 ${podStatusOutput}= Run ${KUBECTL_CONFIG};kubectl get pods -n ${NAMESPACE}
311 Log ${podStatusOutput}
312 ${countBforRestart}= Run ${KUBECTL_CONFIG};kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
313 ${podName} Set Variable adapter-open-olt
314 Restart Pod ${NAMESPACE} ${podName}
315 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
316 ... Running
317 Repeat Sanity Test
318 ${podStatusOutput}= Run ${KUBECTL_CONFIG};kubectl get pods -n ${NAMESPACE}
319 Log ${podStatusOutput}
320 ${countAfterRestart}= Run ${KUBECTL_CONFIG};kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
321 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
322 Log to console Pod ${podName} restarted and sanity checks passed successfully
323
Suchitra Vemuri937cd392020-01-12 17:10:42 -0800324Delete OLT, ReAdd OLT and Perform Sanity Test
325 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
326 ... Disable and Delete the OLT
327 ... Create/Enable the same OLT again
328 ... Validate authentication/DHCP/E2E pings succeed for all the ONUs connected to the OLT
329 [Tags] functional DeleteOLT
330 [Setup] None
331 [Teardown] NONE
332 Run Keyword If ${has_dataplane} Clean Up Linux
333 Run Keyword If ${has_dataplane} Delete Device and Verify
334 Run Keyword and Ignore Error Collect Logs
335 # Recreate the OLT
336 Run Keyword If ${has_dataplane} Setup
337 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
338 Run Keyword and Ignore Error Collect Logs
339
Hemae6d223d2019-12-30 19:21:26 +0530340Adding the same OLT after enabling the device
341 [Documentation] Create OLT, enable it, Create the same OLT again and Check for the Error message
342 [Tags] VOL-2406 AddEnableOLT_AddTheSameOLTAgain notready
343 [Setup] Delete Device and Verify
344 [Teardown] None
345 Run Keyword If ${has_dataplane} Sleep 180s
346 #create/preprovision device
347 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
348 Set Suite Variable ${olt_device_id}
349 #validate olt states
350 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
351 ... ${EMPTY} ${olt_device_id}
352 #Enable the created OLT device
353 Enable Device ${olt_device_id}
354 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
355 ... ${olt_serial_number}
356 #Create the same OLT again
357 ${rc} ${output}= Run and Return Rc and Output
358 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
359 Should Not Be Equal As Integers ${rc} 0
360 Log ${output}
361 Should Contain '${output}' 'ERROR: UNKNOWN: Device is already pre-provisioned'
362 Log "This OLT is added already and enabled"
363
David Bainbridgef81cd642019-11-20 00:14:47 +0000364Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
365 [Documentation] Deploys an device instance and waits for it to authenticate. After
366 ... authentication is successful the rw-core deployment is scaled to 0 instances to
367 ... simulate a POD crash. The test then scales the rw-core back to a single instance
368 ... and configures ONOS for access. The test succeeds if the device is able to
369 ... complete the DHCP sequence.
370 [Tags] bbsim rwcore-restart
371 [Setup] Clear All Devices Then Create New Device
372 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
373 Set Global Variable ${of_id}
374
375 FOR ${I} IN RANGE 0 ${num_onus}
376 ${src}= Set Variable ${hosts.src[${I}]}
377 ${dst}= Set Variable ${hosts.dst[${I}]}
378 ${onu_device_id}= Get Device ID From SN ${src['onu']}
379 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
380 ... ${of_id}
381
382 # Bring up the device and verify it authenticates
383 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
384 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed
385 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
386 ... ${ONOS_SSH_PORT} ${onu_port}
387 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
388 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
389 ... ${src['container_type']} ${src['container_name']}
390 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
391 ... ${ONOS_SSH_PORT} ${onu_port}
392
393 # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1
394 Scale K8s Deployment voltha voltha-rw-core 0
395 Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-rw-core
396 # Ensure the ofagent POD goes "not-ready" as expected
397 Wait Until keyword Succeeds ${timeout} 2s Check Expected Available Deployment Replicas voltha voltha-ofagent 0
398 # Scale up the core deployment and make sure both it and the ofagent deployment are back
399 Scale K8s Deployment voltha voltha-rw-core 1
400 Wait Until Keyword Succeeds ${timeout} 2s Check Expected Available Deployment Replicas voltha voltha-rw-core 1
401 Wait Until Keyword Succeeds ${timeout} 2s Check Expected Available Deployment Replicas voltha voltha-ofagent 1
402
403 # For some reason scaling down and up the POD behind a service causes the port forward to stop working,
404 # so restart the port forwarding for the API service
405 Restart VOLTHA Port Foward voltha-api-minimal
406
407 # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this
408 # represents system connectivity being restored
409 Wait Until Keyword Succeeds ${timeout} 2s Device Is Available In ONOS
410 ... http://karaf:karaf@${k8s_node_ip}:${ONOS_REST_PORT} ${of_id}
411
412 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
413 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
414 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
415 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
416 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
417 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
418 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
419 ... ${dst['container_name']}
420 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
421 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
422 END
423
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700424*** Keywords ***
425Setup Suite
Andy Bavier88cd9f62019-11-26 16:22:33 -0700426 [Documentation] Set up the test suite
427 Common Test Suite Setup
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700428
429Setup
Zack Williamsec53a1b2019-09-16 15:50:52 -0700430 [Documentation] Pre-test Setup
Gilles Depatieb5682f82019-10-31 10:39:45 -0400431 #test for empty device list
David Bainbridgef81cd642019-11-20 00:14:47 +0000432 Test Empty Device List
Suchitra Vemuri937cd392020-01-12 17:10:42 -0800433 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
434 ... ${olt_ip} ${olt_user} ${olt_pass}
435 Sleep 60s
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700436 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700437 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
438 Set Suite Variable ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400439 #validate olt states
440 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
441 ... ${EMPTY} ${olt_device_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700442 Enable Device ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400443 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
444 ... ${olt_serial_number}
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700445 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
446 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700447
David Bainbridgef81cd642019-11-20 00:14:47 +0000448Delete All Devices and Verify
449 [Documentation] Remove any devices from VOLTHA and ONOS
450
451 # Clear devices from VOLTHA
452 Disable Devices In Voltha Root=true
453 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
454 Delete Devices In Voltha Root=true
455 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
456
457 # Clear devices from ONOS
458 Remove All Devices From ONOS
459 ... http://karaf:karaf@${k8s_node_ip}:${ONOS_REST_PORT}
460
461Clear All Devices Then Create New Device
462 [Documentation] Remove any devices from VOLTHA and ONOS
463
464 # Remove all devices from voltha and nos
465 Delete All Devices and Verify
466
467 # Execute normal test Setup Keyword
468 Setup
469
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700470Teardown
471 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800472 Run Keyword If ${has_dataplane} Clean Up Linux
473 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
474
475Collect Logs
476 [Documentation] Collect Logs from voltha and onos cli for various commands
Suchitra Vemuri1a970a62019-11-26 12:52:16 -0800477 Run Keyword and Ignore Error Get Device List from Voltha
478 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
479 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700480 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
Andy Bavierba9866b2019-10-11 07:11:53 -0700481
482Teardown Suite
483 [Documentation] Clean up device if desired
David Bainbridgef81cd642019-11-20 00:14:47 +0000484 Run Keyword If ${teardown_device} Delete All Devices and Verify
Gilles Depatieb5682f82019-10-31 10:39:45 -0400485
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700486Clean Up Linux
487 [Documentation] Kill processes and clean up interfaces on src+dst servers
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700488 FOR ${I} IN RANGE 0 ${num_onus}
489 ${src}= Set Variable ${hosts.src[${I}]}
490 ${dst}= Set Variable ${hosts.dst[${I}]}
491 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
492 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
493 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
494 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
495 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
496 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
497 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
498 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
499 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
500 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
501 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
502 ... ${dst['container_type']} ${dst['container_name']}
503 END
Andy Bavierba9866b2019-10-11 07:11:53 -0700504
505Delete Device and Verify
506 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Andy Bavierba9866b2019-10-11 07:11:53 -0700507 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
508 Should Be Equal As Integers ${rc} 0
Suchitra Vemuri937cd392020-01-12 17:10:42 -0800509 Sleep 5s
Gilles Depatieb5682f82019-10-31 10:39:45 -0400510 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
511 ... ${olt_serial_number}
Andy Bavierba9866b2019-10-11 07:11:53 -0700512 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
513 Should Be Equal As Integers ${rc} 0
514 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800515
516Perform Sanity Test
517 [Documentation] This keyword performs Sanity Test Procedure
518 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
519 ... This keyword can be used to call in any other tests where sanity check is required
520 ... and avoids duplication of code.
521
522 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
523 Set Global Variable ${of_id}
524
525 FOR ${I} IN RANGE 0 ${num_onus}
526 ${src}= Set Variable ${hosts.src[${I}]}
527 ${dst}= Set Variable ${hosts.dst[${I}]}
528
Suchitra Vemuri50aa9802019-12-20 14:25:46 -0800529 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
530 ... ENABLED ACTIVE REACHABLE
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800531 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
532
533 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Suchitra Vemuri50aa9802019-12-20 14:25:46 -0800534 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800535 ... ${of_id}
Suchitra Vemuri50aa9802019-12-20 14:25:46 -0800536 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU
537 ... ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
538 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800539 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
540 ... ${src['container_type']} ${src['container_name']}
Suchitra Vemuri50aa9802019-12-20 14:25:46 -0800541 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users
542 ... ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
543 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800544 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
545 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
546 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
547 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
548 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
549 ... ${dst['container_name']}
550 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
551 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
552 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
553 Run Keyword and Ignore Error Collect Logs
554 END
Gayathri.Selvan49398962020-01-13 07:19:12 +0000555
556Repeat Sanity Test
557 [Documentation] This keyword performs Sanity Test Procedure
558 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
559 ... This keyword can be used to call in any other tests where sanity check is required
560 ... with wpa reassociation
561
562 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
563 Set Global Variable ${of_id}
564
565 FOR ${I} IN RANGE 0 ${num_onus}
566 ${src}= Set Variable ${hosts.src[${I}]}
567 ${dst}= Set Variable ${hosts.dst[${I}]}
568
569
570 ${onu_device_id}= Get Device ID From SN ${src['onu']}
571 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
572 ... ${of_id}
573 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
574 ... ${ONOS_SSH_PORT} ${onu_port}
575 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication After Reassociate
576 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
577 ... ${src['container_type']} ${src['container_name']}
578 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
579 ... ${ONOS_SSH_PORT} ${onu_port}
580 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
581 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
582 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
583 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
584 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
585 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
586 ... ${dst['container_name']}
587 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
588 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
589 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
590 Run Keyword and Ignore Error Collect Logs
591 END
592