blob: 44a6bd740c846c0b927b376e52ed427751481a9a [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
Andy Bavierba9866b2019-10-11 07:11:53 -070060 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
61 Set Global Variable ${of_id}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070062
63 FOR ${I} IN RANGE 0 ${num_onus}
64 ${src}= Set Variable ${hosts.src[${I}]}
65 ${dst}= Set Variable ${hosts.dst[${I}]}
66
Gilles Depatieb5682f82019-10-31 10:39:45 -040067 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
68 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070069
70 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Gilles Depatie675a2062019-10-22 12:44:42 -040071 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
72 ... ${of_id}
73 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
74 ... ${ONOS_SSH_PORT} ${onu_port}
75 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
76 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070077 ... ${src['container_type']} ${src['container_name']}
Gilles Depatie675a2062019-10-22 12:44:42 -040078 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
79 ... ${ONOS_SSH_PORT} ${onu_port}
80 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
81 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
82 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
83 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
84 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
85 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
86 ... ${dst['container_name']}
Suchitra Vemuri87f1d7f2019-11-12 15:03:48 -080087 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Gilles Depatie675a2062019-10-22 12:44:42 -040088 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri1a970a62019-11-26 12:52:16 -080089 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070090 END
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070091
Suchitra Vemuri6db89412019-11-14 14:52:54 -080092Test Disable and Enable ONU
93 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
94 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
95 ... Perform disable on the ONUs and validate that the pings do not succeed
96 ... Perform enable on the ONUs and validate that the pings are successful
97 [Tags] functional test2
98 [Setup] None
99 #[Teardown] None
100
101 FOR ${I} IN RANGE 0 ${num_onus}
102 ${src}= Set Variable ${hosts.src[${I}]}
103 ${dst}= Set Variable ${hosts.dst[${I}]}
104
105 ${onu_device_id}= Get Device ID From SN ${src['onu']}
106 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
107 ... ${of_id}
108 Disable Device ${onu_device_id}
109 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst['dp_iface_ip_qinq']}
110 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
111 Enable Device ${onu_device_id}
112 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
113 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
114 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s Check Ping True ${dst['dp_iface_ip_qinq']}
115 ... ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
116 END
117
suraj gourd64356b2019-11-07 13:26:20 +0000118Check OLT/ONU Authentication After Radius Pod Restart
119 [Documentation] After radius restart, validates eapol flows and dhcp allocation
120 ... and validates onu in onos
Suchitra Vemuri6db89412019-11-14 14:52:54 -0800121 [Tags] functional test3
122 [Setup] NONE
suraj gourd64356b2019-11-07 13:26:20 +0000123 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${RESTART_POD_NAME}
124
125 FOR ${I} IN RANGE 0 ${num_onus}
126 ${src}= Set Variable ${hosts.src[${I}]}
127 ${dst}= Set Variable ${hosts.dst[${I}]}
128
129
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 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
134 ... ${ONOS_SSH_PORT} ${onu_port}
135 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
136 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
137 ... ${src['container_type']} ${src['container_name']}
138 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
139 ... ${ONOS_SSH_PORT} ${onu_port}
140 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
141 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
142 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
143 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
144 ... ${dst['container_name']}
145 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
146 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
147 END
148
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700149*** Keywords ***
150Setup Suite
Zack Williamsec53a1b2019-09-16 15:50:52 -0700151 [Documentation] Setup the whole test suite
Andy Bavierba9866b2019-10-11 07:11:53 -0700152 # BBSim sanity test doesn't need these imports from other repositories
Gilles Depatie675a2062019-10-22 12:44:42 -0400153 Run Keyword If ${external_libs} Import Library
154 ... ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py
155 Run Keyword If ${external_libs} Import Resource
156 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
157 Run Keyword If ${external_libs} Import Resource
158 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot
159 Run Keyword If ${external_libs} Import Resource
160 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot
161 Run Keyword If ${external_libs} Import Resource
162 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -0700163 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700164 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700165 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
166 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
167 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
168 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
169 Check CLI Tools Configured
170 ${onos_auth}= Create List karaf karaf
171 ${HEADERS} Create Dictionary Content-Type=application/json
Suchitra Vemuri9c24d2b2019-09-30 10:28:25 -0700172 Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700173 ${olt_ip}= Evaluate ${olts}[0].get("ip")
174 ${olt_user}= Evaluate ${olts}[0].get("user")
175 ${olt_pass}= Evaluate ${olts}[0].get("pass")
176 ${olt_serial_number}= Evaluate ${olts}[0].get("serial")
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700177 ${num_onus}= Get Length ${hosts.src}
178 ${num_onus}= Convert to String ${num_onus}
179 Set Suite Variable ${num_onus}
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -0700180 Set Suite Variable ${olt_serial_number}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700181 Set Suite Variable ${olt_ip}
182 Set Suite Variable ${olt_user}
183 Set Suite Variable ${olt_pass}
184 Set Suite Variable ${k8s_node_ip}
185 Set Suite Variable ${k8s_node_user}
186 Set Suite Variable ${k8s_node_pass}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700187 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
188 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700189 Set Suite Variable ${container_list}
Andy Bavierba9866b2019-10-11 07:11:53 -0700190 ${datetime}= Get Current Date
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700191 Set Suite Variable ${datetime}
192
193Setup
Zack Williamsec53a1b2019-09-16 15:50:52 -0700194 [Documentation] Pre-test Setup
Gilles Depatieb5682f82019-10-31 10:39:45 -0400195 #test for empty device list
196 ${length}= Test Empty Device List
197 Should Be Equal As Integers ${length} 0
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700198 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700199 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
200 Set Suite Variable ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400201 #validate olt states
202 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
203 ... ${EMPTY} ${olt_device_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700204 Enable Device ${olt_device_id}
Gilles Depatieb5682f82019-10-31 10:39:45 -0400205 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
206 ... ${olt_serial_number}
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700207 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
208 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700209
210Teardown
211 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri1a970a62019-11-26 12:52:16 -0800212 Run Keyword and Ignore Error Get Device List from Voltha
213 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
214 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700215 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
216 Run Keyword If ${has_dataplane} Clean Up Linux
217 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
218
219Teardown Suite
220 [Documentation] Clean up device if desired
221 Run Keyword If ${teardown_device} Delete Device and Verify
Gilles Depatieb5682f82019-10-31 10:39:45 -0400222 ${length}= Run Keyword If ${teardown_device} Run Keyword And Return Test Empty Device List
223 Run Keyword If ${teardown_device} Should Be Equal As Integers ${length} 0
Andy Bavierba9866b2019-10-11 07:11:53 -0700224 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
225 ... device-remove ${of_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700226
Gilles Depatieb5682f82019-10-31 10:39:45 -0400227
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700228Clean Up Linux
229 [Documentation] Kill processes and clean up interfaces on src+dst servers
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700230 FOR ${I} IN RANGE 0 ${num_onus}
231 ${src}= Set Variable ${hosts.src[${I}]}
232 ${dst}= Set Variable ${hosts.dst[${I}]}
233 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
234 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
235 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
236 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
237 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
238 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
239 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
240 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
241 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
242 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
243 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
244 ... ${dst['container_type']} ${dst['container_name']}
245 END
Andy Bavierba9866b2019-10-11 07:11:53 -0700246
247Delete Device and Verify
248 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Andy Bavierba9866b2019-10-11 07:11:53 -0700249 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
250 Should Be Equal As Integers ${rc} 0
Gilles Depatieb5682f82019-10-31 10:39:45 -0400251 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE
252 ... ${olt_serial_number}
Andy Bavierba9866b2019-10-11 07:11:53 -0700253 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
254 Should Be Equal As Integers ${rc} 0
255 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}