blob: 775285efc6ef5c37e997cc36d87dbe25e8f92e07 [file] [log] [blame]
Suchitra Vemuri3f8b0f62019-09-12 13:25:16 -07001#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
31Resource ../../libraries/utils.robot
Andy Bavierba9866b2019-10-11 07:11:53 -070032Resource ../../libraries/k8s.robot
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070033Resource ../../variables/variables.robot
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070034
35*** Variables ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070036${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
suraj gourd64356b2019-11-07 13:26:20 +000043${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
Andy Bavierba9866b2019-10-11 07:11:53 -070047${timeout} 60s
Zack Williamsec53a1b2019-09-16 15:50:52 -070048${of_id} 0
49${logical_id} 0
Andy Bavierba9866b2019-10-11 07:11:53 -070050${has_dataplane} True
51${external_libs} True
52${teardown_device} False
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070053
54*** Test Cases ***
55Sanity E2E Test for OLT/ONU on POD
56 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
57 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
Andy Bavierba9866b2019-10-11 07:11:53 -070058 [Tags] sanity test1
Suchitra Vemuri6db89412019-11-14 14:52:54 -080059 [Teardown] NONE
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -080060 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemuri582574b2019-12-10 21:11:54 -080061 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070062
Suchitra Vemuri6db89412019-11-14 14:52:54 -080063Test Disable and Enable ONU
64 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
65 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
66 ... Perform disable on the ONUs and validate that the pings do not succeed
67 ... Perform enable on the ONUs and validate that the pings are successful
Suchitra Vemuri582574b2019-12-10 21:11:54 -080068 [Tags] functional DisableEnableONU
Suchitra Vemuri6db89412019-11-14 14:52:54 -080069 [Setup] None
suraj gour7f6d5fe2019-11-29 10:56:35 +000070 [Teardown] None
Suchitra Vemuri6db89412019-11-14 14:52:54 -080071
72 FOR ${I} IN RANGE 0 ${num_onus}
73 ${src}= Set Variable ${hosts.src[${I}]}
74 ${dst}= Set Variable ${hosts.dst[${I}]}
75
76 ${onu_device_id}= Get Device ID From SN ${src['onu']}
77 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
78 ... ${of_id}
79 Disable Device ${onu_device_id}
80 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst['dp_iface_ip_qinq']}
81 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
82 Enable Device ${onu_device_id}
83 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
84 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
85 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping True ${dst['dp_iface_ip_qinq']}
86 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Suchitra Vemuri582574b2019-12-10 21:11:54 -080087 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
88 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri6db89412019-11-14 14:52:54 -080089 END
Suchitra Vemuri582574b2019-12-10 21:11:54 -080090 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri6db89412019-11-14 14:52:54 -080091
suraj gourd64356b2019-11-07 13:26:20 +000092Check OLT/ONU Authentication After Radius Pod Restart
suraj gour7f6d5fe2019-11-29 10:56:35 +000093 [Documentation] After radius restart, triggers reassociation, checks status and
94 ... authentication, validates dhcp and ping. Note : wpa reassociate works only when
95 ... wpa supplicant is running in background hence it is recommended to remove
96 ... teardown from previous test or uncomment 'Teardown None'.
97 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri582574b2019-12-10 21:11:54 -080098 [Tags] functional RadiusRestart
Suchitra Vemuri6db89412019-11-14 14:52:54 -080099 [Setup] NONE
suraj gourd64356b2019-11-07 13:26:20 +0000100 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
101
102 FOR ${I} IN RANGE 0 ${num_onus}
103 ${src}= Set Variable ${hosts.src[${I}]}
104 ${dst}= Set Variable ${hosts.dst[${I}]}
105
106
107 ${onu_device_id}= Get Device ID From SN ${src['onu']}
108 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
109 ... ${of_id}
110 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
111 ... ${ONOS_SSH_PORT} ${onu_port}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000112 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication After Reassociate
113 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
suraj gourd64356b2019-11-07 13:26:20 +0000114 ... ${src['container_type']} ${src['container_name']}
115 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
116 ... ${ONOS_SSH_PORT} ${onu_port}
117 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
118 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
119 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
120 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
121 ... ${dst['container_name']}
122 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
123 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800124 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
125 Run Keyword and Ignore Error Collect Logs
suraj gourd64356b2019-11-07 13:26:20 +0000126 END
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800127 Run Keyword and Ignore Error Collect Logs
suraj gourd64356b2019-11-07 13:26:20 +0000128
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700129*** Keywords ***
130Setup Suite
Andy Bavier88cd9f62019-11-26 16:22:33 -0700131 [Documentation] Set up the test suite
132 Common Test Suite Setup
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700133
134Setup
Zack Williamsec53a1b2019-09-16 15:50:52 -0700135 [Documentation] Pre-test Setup
Gilles Depatieb5682f82019-10-31 10:39:45 -0400136 #test for empty device list
137 ${length}= Test Empty Device List
138 Should Be Equal As Integers ${length} 0
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700139 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700140 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
141 Set Suite Variable ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400142 #validate olt states
143 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
144 ... ${EMPTY} ${olt_device_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700145 Enable Device ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400146 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
147 ... ${olt_serial_number}
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700148 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
149 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700150
151Teardown
152 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri582574b2019-12-10 21:11:54 -0800153 Run Keyword If ${has_dataplane} Clean Up Linux
154 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
155
156Collect Logs
157 [Documentation] Collect Logs from voltha and onos cli for various commands
Suchitra Vemuri1a970a62019-11-26 12:52:16 -0800158 Run Keyword and Ignore Error Get Device List from Voltha
159 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
160 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700161 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
Andy Bavierba9866b2019-10-11 07:11:53 -0700162
163Teardown Suite
164 [Documentation] Clean up device if desired
165 Run Keyword If ${teardown_device} Delete Device and Verify
Andy Bavier44e84fe2019-12-10 10:23:15 -0700166 ${length}= Run Keyword If ${teardown_device} Test Empty Device List
Gilles Depatieb5682f82019-10-31 10:39:45 -0400167 Run Keyword If ${teardown_device} Should Be Equal As Integers ${length} 0
Andy Bavierba9866b2019-10-11 07:11:53 -0700168 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
169 ... device-remove ${of_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700170
Gilles Depatieb5682f82019-10-31 10:39:45 -0400171
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700172Clean Up Linux
173 [Documentation] Kill processes and clean up interfaces on src+dst servers
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700174 FOR ${I} IN RANGE 0 ${num_onus}
175 ${src}= Set Variable ${hosts.src[${I}]}
176 ${dst}= Set Variable ${hosts.dst[${I}]}
177 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
178 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
179 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
180 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
181 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
182 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
183 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
184 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
185 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
186 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
187 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
188 ... ${dst['container_type']} ${dst['container_name']}
189 END
Andy Bavierba9866b2019-10-11 07:11:53 -0700190
191Delete Device and Verify
192 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Andy Bavierba9866b2019-10-11 07:11:53 -0700193 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
194 Should Be Equal As Integers ${rc} 0
Gilles Depatieb5682f82019-10-31 10:39:45 -0400195 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
196 ... ${olt_serial_number}
Andy Bavierba9866b2019-10-11 07:11:53 -0700197 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
198 Should Be Equal As Integers ${rc} 0
199 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
Suchitra Vemurib89b9ac2019-12-11 21:53:11 -0800200
201Perform Sanity Test
202 [Documentation] This keyword performs Sanity Test Procedure
203 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
204 ... This keyword can be used to call in any other tests where sanity check is required
205 ... and avoids duplication of code.
206
207 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
208 Set Global Variable ${of_id}
209
210 FOR ${I} IN RANGE 0 ${num_onus}
211 ${src}= Set Variable ${hosts.src[${I}]}
212 ${dst}= Set Variable ${hosts.dst[${I}]}
213
214 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
215 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
216
217 ${onu_device_id}= Get Device ID From SN ${src['onu']}
218 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
219 ... ${of_id}
220 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
221 ... ${ONOS_SSH_PORT} ${onu_port}
222 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
223 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
224 ... ${src['container_type']} ${src['container_name']}
225 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
226 ... ${ONOS_SSH_PORT} ${onu_port}
227 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
228 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
229 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
230 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
231 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
232 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
233 ... ${dst['container_name']}
234 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
235 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
236 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
237 Run Keyword and Ignore Error Collect Logs
238 END