blob: 683b58193dc200f73fd0e7d292adacc5c9bf6244 [file] [log] [blame]
TorstenThiemed2cd91d2020-07-28 07:13:44 +00001# Copyright 2020 - 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 ***
17Documentation Test various end-to-end scenarios
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite 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
34Resource ../../libraries/power_switch.robot
35
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} 120s
49${of_id} 0
50${logical_id} 0
51${has_dataplane} True
52${teardown_device} False
53${scripts} ../../scripts
54${with_onos} True
55${values_dir} ../data
56${kind_voltha_dir} ~/kind-voltha
57# Per-test logging on failure is turned off by default; set this variable to enable
58${container_log_dir} ${None}
59${pausebeforesanity} False
60${onos_version} ${EMPTY}
61
62*** Test Cases ***
63
64Sanity E2E Test for OLT/ONU on POD
65 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
66 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
67 [Tags] sanity test1
68 [Setup] Run Keywords Start Logging SanityTest
69 ... AND Setup
70 [Teardown] Run Keywords Collect Logs
71 ... AND Stop Logging SanityTest
72 Run Keyword If ${has_dataplane} Clean Up Linux
73 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
74
75Start voltha containers in a specific order and run sanity test
76 [Documentation] Starts voltha containers in a specific order and run sanity test
77 ... Assuming that test1 was executed where all the ONUs are authenticated/DHCP/pingable
78 ... Two starts of voltha container in specific orders are supported:
79 ... First order: voltha, voltha-adapters-simulated, voltha-adapters-open-olt, voltha-adapters-open-onu, onos
80 ... Second order: voltha-adapters-simulated, voltha-adapters-open-olt, voltha-adapters-open-onu, voltha, onos
81 ... For both orders following scenarios will be run
82 ... - Remove helm charts
83 ... - Restart Helm Charts in a specific order
84 ... - Restart Port Forwarding
85 ... - Repeat the sanity check
86 [Tags] functional VOL-2008 StartVolthaContainers notready
87 [Setup] Start Logging StartVolthaContainers
88 [Teardown] Run Keywords Collect Logs
89 ... AND Stop Logging StartVolthaContainers
90 ${list_order} Create List First Second
91 # Get simulated adpters are running
92 ${contains_sim}= Set Variable False
93 ${container} Get Container Dictionary voltha
94 FOR ${key} IN @{container.keys()}
95 ${contains_sim}= Evaluate "sim-voltha-adapter" in """${key}"""
96 Exit For Loop IF ${contains_sim}
97 END
98 # Prepare Helm Chart list
99 ${list_voltha_apps} Create List ofagent rw-core
100 ${list_voltha_names} Create List voltha-voltha-ofagent voltha-voltha-rw-core
101 ${voltha} CreateDictionary helmchart=voltha namespace=voltha
102 ... apps=${list_voltha_apps} names=${list_voltha_names}
103 ${list_sim_apps} Create List adapter-simulated-olt adapter-simulated-onu
104 ${list_sim_names} Create List sim-voltha-adapter-simulated-olt sim-voltha-adapter-simulated-onu
105 ${sim} CreateDictionary helmchart=sim namespace=voltha
106 ... apps=${list_sim_apps} names=${list_sim_names}
107 ${list_openolt_apps} Create List adapter-open-olt
108 ${list_openolt_names} Create List open-olt-voltha-adapter-openolt
109 ${open-olt} CreateDictionary helmchart=open-olt namespace=voltha
110 ... apps=${list_openolt_apps} names=${list_openolt_names}
111 ${list_openonu_apps} Create List adapter-open-onu
112 ${list_openonu_names} Create List open-onu-voltha-adapter-openonu
113 ${open-onu} CreateDictionary helmchart=open-onu namespace=voltha
114 ... apps=${list_openonu_apps} names=${list_openonu_names}
115 ${list_onos_apps} Create List onos-onos-classic
116 ${list_onos_names} Create List onos-onos-classic
117 ${onos} CreateDictionary helmchart=onos namespace=default
118 ... apps=${list_onos_apps} names=${list_onos_names}
119 ${List_Helm_Charts} Create List
120 Run Keyword If ${contains_sim}
121 ... Append To List ${List_Helm_Charts} ${voltha} ${sim} ${open-olt} ${open-onu} ${onos}
122 ... ELSE
123 ... Append To List ${List_Helm_Charts} ${voltha} ${open-olt} ${open-onu} ${onos}
124 # Start Loop over both orders
125 FOR ${order} IN @{list_order}
126 Perfom Start voltha containers in a specific order ${List_Helm_Charts} ${order} ${contains_sim}
127 ... ${with_onos}
128 END
129
130*** Keywords ***
131Setup Suite
132 [Documentation] Set up the test suite
133 Common Test Suite Setup
134 #Restore all ONUs
135 #Run Keyword If ${has_dataplane} RestoreONUs ${num_onus}
136 #power_switch.robot needs it to support different vendor's power switch
137 ${switch_type}= Get Variable Value ${web_power_switch.type}
138 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
139
140Perfom Start voltha containers in a specific order
141 [Arguments] ${List_Helm_Charts} ${order} ${contains_sim} ${with_onos}
142 [Documentation] Performes start ofvoltha containers in a specific order and run sanity test
143 # Repeat Teardown Suite
144 Run Keyword If ${with_onos}
145 ... Log \r\nRepeat Teardown Suite (${order} order)... console=yes
146 Run Keyword If ${with_onos} Teardown Suite
147 # Remove Helm Charts
148 Log \r\nRemove Helm Charts (${order} order)... console=yes
149 Remove Helm Charts ${List_Helm_Charts}
150 # Restart Helm Charts
151 Log \r\nRestart Helm Charts (${order} order)... console=yes
152 Restart Helm Charts ${List_Helm_Charts} ${order} ${contains_sim}
153 # Restart Port Forwarding
154 Log \r\nRestart Port Forwarding (${order} order)... console=yes
155 Restart Port Forwarding
156 # Push ONOS Kafka Configuration
157 Run Keyword If ${with_onos}
158 ... Log \r\nPush ONOS Kafka Configuration (${order} order)... console=yes
159 Run Keyword If ${with_onos} Sleep 5s
160 Run Keyword If ${with_onos}
161 ... Wait Until Keyword Succeeds 30s 3s Push ONOS Kafka Configuration
162 # Push ONOS DHCP L2 Relay Configuration
163 Run Keyword If ${with_onos}
164 ... Log \r\nPush ONOS DHCP L2 Relay Configuration (${order} order)... console=yes
165 Run Keyword If ${with_onos} Sleep 5s
166 Run Keyword If ${with_onos}
167 ... Wait Until Keyword Succeeds 30s 3s Push ONOS DHCP L2 Relay Configuration
168 #Enable VOLTHA ONOS EAPOL provisioning
169 Run Keyword If ${with_onos}
170 ... Log \r\nEnable VOLTHA ONOS EAPOL provisioning (${order} order)... console=yes
171 Run Keyword If ${with_onos} Sleep 5s
172 Run Keyword If ${with_onos}
173 ... Wait Until Keyword Succeeds 30s 3s Enable VOLTHA ONOS EAPOL provisioning
174 #Enable VOLTHA ONOS DHCP Provisioning
175 Run Keyword If ${with_onos}
176 ... Log \r\nEnable VOLTHA ONOS DHCP Provisioning (${order} order)... console=yes
177 Run Keyword If ${with_onos} Sleep 5s
178 Run Keyword If ${with_onos}
179 ... Wait Until Keyword Succeeds 30s 3s Enable VOLTHA ONOS DHCP Provisioning
180 #Disable VOLTHA ONOS IGMP Provisioning
181 Run Keyword If ${with_onos}
182 ... Log \r\nDisable VOLTHA ONOS IGMP Provisioning (${order} order)... console=yes
183 Run Keyword If ${with_onos} Sleep 5s
184 Run Keyword If ${with_onos}
185 ... Wait Until Keyword Succeeds 30s 3s Disable VOLTHA ONOS IGMP Provisioning
186 #Push ONOS SADIS Configuration
187 Run Keyword If ${with_onos}
188 ... Log \r\nPush ONOS SADIS Configuration (${order} order)... console=yes
189 Run Keyword If ${with_onos} Sleep 5s
190 Run Keyword If ${with_onos}
191 ... Wait Until Keyword Succeeds 30s 3s Push ONOS SADIS Configuration
192 # Configure ONOS RADIUS Connection
193 Run Keyword If ${with_onos}
194 ... Log \r\nPush ONOS RADIUS Connection (${order} order)... console=yes
195 Run Keyword If ${with_onos} Sleep 5s
196 Run Keyword If ${with_onos}
197 ... Wait Until Keyword Succeeds 30s 3s Configure ONOS RADIUS Connection
198 Log \r\nSleep 10s (${order} order)... console=yes
199 Sleep 10s
200 # Repeat Suite Setup
201 Run Keyword If ${with_onos}
202 ... Log \r\nRepeat Suite Setup (${order} order)... console=yes
203 Run Keyword If ${with_onos} Common Test Suite Setup
204 # Repeat Setup
205 Run Keyword If ${with_onos}
206 ... Log \r\nRepeat Setup (${order} order)... console=yes
207 Run Keyword If ${with_onos} Setup
208 Run Keyword If ${pausebeforesanity} Import Library Dialogs
209 Run Keyword If ${pausebeforesanity} Pause Execution Press OK to continue with Sanity Check!
210 # Repeat Sanity Test E2E Test for OLT/ONU on POD
211 Log \r\nRepeat Sanity Test E2E Test for OLT/ONU on POD (${order} order)... console=yes
212 Run Keyword If ${has_dataplane} Clean Up Linux
213 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
214
215Remove Helm Charts
216 [Arguments] ${List_Helm_Charts}
217 [Documentation] Removes the helm charts
218 FOR ${helm_chart} IN @{List_Helm_Charts}
219 ${helmchartname} Get From Dictionary ${helm_chart} helmchart
220 ${namespace} Get From Dictionary ${helm_chart} namespace
221 Run Keyword If ${with_onos} or ('${helmchartname}'!='onos') Remove VOLTHA Helm Charts ${helmchartname}
222 ... ${namespace}
223 ${list_names} Get From Dictionary ${helm_chart} names
224 Run Keyword If ${with_onos} or ('${helmchartname}'!='onos')
225 ... Wait For Pods Not Exist ${namespace} ${list_names}
226 END
227
228Remove VOLTHA Helm Charts
229 [Arguments] ${name} ${namespace}
230 [Documentation] Remove VOLTHA helm charts
231 ${cmd} Catenate helm uninstall --no-hooks --namespace '${namespace}' '${name}'
232 #${cmd} Catenate helm delete --no-hooks --purge '${name}'
233 ${rc} Run And Return Rc ${cmd}
234 Should Be Equal as Integers ${rc} 0
235
236Restart Helm Charts
237 [Arguments] ${List_Helm_Charts} ${order} ${contains_sim}
238 [Documentation] Restarts the helm charts
239 Run Keyword If '${order}'=='First' Restart Voltha
240 Run Keyword If ${contains_sim} Restart Voltha Adapters Simulated
241 Restart Voltha Adapters Open OLT
242 Restart Voltha Adapters Open ONU
243 Run Keyword If '${order}'=='Second' Restart Voltha
244 Run Keyword If ${with_onos} Restart ONOS
245 FOR ${helm_chart} IN @{List_Helm_Charts}
246 ${helmchartname} Get From Dictionary ${helm_chart} helmchart
247 ${namespace} Get From Dictionary ${helm_chart} namespace
248 ${list_apps} Get From Dictionary ${helm_chart} apps
249 Run Keyword If ${with_onos} or ('${helmchartname}'!='onos')
250 ... Wait For Pods Ready ${namespace} ${list_apps}
251 END
252
253Restart Voltha Adapters Simulated
254 [Documentation] Restart Voltha Adapters Simulated helm chart
255 ${cmd} Catenate
256 ... helm install -f ${values_dir}/sim-adapter-values.yaml --create-namespace
257 ... --set services.etcd.service=etcd.default.svc --set services.etcd.port=2379
258 ... --set services.etcd.address=etcd.default.svc:2379 --set kafka_broker=kafka.default.svc:9092
259 ... --set services.kafka.adapter.service=kafka.default.svc --set services.kafka.adapter.port=9092
260 ... --set services.kafka.cluster.service=kafka.default.svc --set services.kafka.cluster.port=9092
261 ... --set services.kafka.adapter.address=kafka.default.svc:9092
262 ... --set services.kafka.cluster.address=kafka.default.svc:9092 --set defaults.log_level=WARN
263 ... --namespace voltha sim onf/voltha-adapter-simulated
264 ${rc} Run And Return Rc ${cmd}
265 Should Be Equal as Integers ${rc} 0
266
267Restart Voltha Adapters Open OLT
268 [Documentation] Restart Voltha Adapters Open OLT helm chart
269 ${cmd} Catenate
270 ... helm install -f ${values_dir}/open-olt-values.yaml --create-namespace
271 ... --set services.etcd.service=etcd.default.svc --set services.etcd.port=2379
272 ... --set services.etcd.address=etcd.default.svc:2379 --set kafka_broker=kafka.default.svc:9092
273 ... --set services.kafka.adapter.service=kafka.default.svc --set services.kafka.adapter.port=9092
274 ... --set services.kafka.adapter.address=kafka.default.svc:9092
275 ... --set services.kafka.cluster.service=kafka.default.svc --set services.kafka.cluster.port=9092
276 ... --set services.kafka.cluster.address=kafka.default.svc:9092 --set defaults.log_level=WARN
277 ... --namespace voltha open-olt onf/voltha-adapter-openolt
278 ${rc} Run And Return Rc ${cmd}
279 Should Be Equal as Integers ${rc} 0
280
281Restart Voltha Adapters Open ONU
282 [Documentation] Restart Voltha Adapters Open ONU helm chart
283 ${cmd} Catenate
284 ... helm install -f ${values_dir}/open-onu-values.yaml --set services.etcd.service=etcd.default.svc
285 ... --set services.etcd.port=2379 --set services.etcd.address=etcd.default.svc:2379
286 ... --set kafka_broker=kafka.default.svc:9092 --set services.kafka.adapter.service=kafka.default.svc
287 ... --set services.kafka.adapter.port=9092 --set services.kafka.adapter.address=kafka.default.svc:9092
288 ... --set services.kafka.cluster.service=kafka.default.svc --set services.kafka.cluster.port=9092
289 ... --set services.kafka.cluster.address=kafka.default.svc:9092 --set replicas.adapter_open_onu=1
290 ... --set defaults.log_level=WARN --namespace voltha open-onu onf/voltha-adapter-openonu
291 ${rc} Run And Return Rc ${cmd}
292 Should Be Equal as Integers ${rc} 0
293
294Restart Voltha
295 [Documentation] Restart Voltha helm chart
296 ${cmd} Catenate
297 ... helm install -f ${values_dir}/voltha-values.yaml --create-namespace --set therecanbeonlyone=true
298 ... --set therecanbeonlyone=true --set services.etcd.address=etcd.default.svc:2379
299 ... --set kafka_broker=kafka.default.svc:9092 --set services.kafka.adapter.address=kafka.default.svc:9092
300 ... --set services.kafka.cluster.address=kafka.default.svc:9092
301 ... --set 'services.controller[0].address=onos-onos-classic-0.onos-onos-classic-hs.default.svc:6653'
302 ... --set defaults.log_level=WARN --namespace voltha voltha onf/voltha
303 ${rc} Run And Return Rc ${cmd}
304 Should Be Equal as Integers ${rc} 0
305
306
307Restart ONOS
308 [Documentation] Restart ONOS helm chart
309 ${cmd}= Run Keyword If '${onos_version}'=='${EMPTY}' Catenate
310 ... helm install -f ${values_dir}/onos-values.yaml
311 ... --create-namespace --set image.repository=voltha/voltha-onos,image.tag=master,replicas=1,atomix.replicas=0
312 ... --set defaults.log_level=WARN --namespace default onos onos/onos-classic
313 ... ELSE Catenate
314 ... helm install -f ${values_dir}/minimal-values.yaml
315 ... --create-namespace --set image.repository=voltha/voltha-onos,image.tag=master,replicas=1,atomix.replicas=0
316 ... --set defaults.log_level=WARN --namespace default --version ${onos_version} onos onos/onos-classic
317 ${rc} Run And Return Rc ${cmd}
318 Should Be Equal as Integers ${rc} 0
319
320Restart Port Forwarding
321 [Documentation] Restarts the VOLTHA port forwarding rules
322 ${List_Tags} Create List etcd-minimal voltha-voltha-api-minimal kafka-minimal
323 ... onos-onos-classic-hs-minimal
324 FOR ${tag} IN @{List_Tags}
325 Run Keyword If ${with_onos} or ('${tag}'!='onos-onos-classic-hs-minimal')
326 ... Restart VOLTHA Port Forward ${tag}
327 END
328
329Push ONOS Kafka Configuration
330 [Documentation] Pushes the ONOS kafka Configuration
331 ${cmd} Catenate
332 ... cd ~/kind-voltha;
333 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
334 ... http://127.0.0.1:8181/onos/v1/network/configuration/apps/org.opencord.kafka
335 ... --data '{"kafka":{"bootstrapServers":"kafka.default.svc:9092"}}'; cd -
336 ${rc} Run And Return Rc ${cmd}
337 Should Be Equal as Integers ${rc} 0
338
339Push ONOS DHCP L2 Relay Configuration
340 [Documentation] Pushes the ONOS DHCP L2 Relay Configuration
341 ${cmd} Catenate
342 ... cd ~/kind-voltha;
343 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
344 ... http://127.0.0.1:8181/onos/v1/network/configuration/apps/org.opencord.dhcpl2relay
345 ... --data @onos-files/onos-dhcpl2relay.json; cd -
346 ${rc} Run And Return Rc ${cmd}
347 Should Be Equal as Integers ${rc} 0
348
349Enable VOLTHA ONOS EAPOL provisioning
350 [Documentation] Pushes the ONOS EAPOL Configuration
351 ${cmd} Catenate
352 ... cd ~/kind-voltha;
353 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
354 ... http://127.0.0.1:8181/onos/v1/configuration/org.opencord.olt.impl.OltFlowService
355 ... --data '{"enableEapol":true}'; cd -
356 ${rc} Run And Return Rc ${cmd}
357 Should Be Equal as Integers ${rc} 0
358
359Enable VOLTHA ONOS DHCP Provisioning
360 [Documentation] Pushes the ONOS OLT DHCP Configuration
361 ${cmd} Catenate
362 ... cd ~/kind-voltha;
363 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
364 ... http://127.0.0.1:8181/onos/v1/configuration/org.opencord.olt.impl.OltFlowService
365 ... --data '{"enableDhcpOnProvisioning":true,"enableDhcpV4":true}'; cd -
366 ${rc} Run And Return Rc ${cmd}
367 Should Be Equal as Integers ${rc} 0
368
369Disable VOLTHA ONOS IGMP Provisioning
370 [Documentation] Pushes the ONOS IGMP Configuration
371 ${cmd} Catenate
372 ... cd ~/kind-voltha;
373 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
374 ... http://127.0.0.1:8181/onos/v1/configuration/org.opencord.olt.impl.OltFlowService
375 ... --data '{"enableIgmpOnProvisioning":false}'; cd -
376 ${rc} Run And Return Rc ${cmd}
377 Should Be Equal as Integers ${rc} 0
378
379Push ONOS SADIS Configuration
380 [Documentation] Pushes the ONOS SADIS Configuration
381 ${cmd} Catenate
382 ... cd ~/kind-voltha;
383 ... curl -sSL --user karaf:karaf -w %\{http_code\} -X POST --fail -H Content-Type:application/json
384 ... http://127.0.0.1:8181/onos/v1/network/configuration/apps/org.opencord.sadis
385 ... --data @onos-files/onos-sadis-sample.json; cd -
386 ${rc} Run And Return Rc ${cmd}
387 Should Be Equal as Integers ${rc} 0
388
389Configure ONOS RADIUS Connection
390 [Documentation] Configures the ONOS RADIUS Connection
391 ${cmd} Catenate
392 ... sed -e s/:RADIUS_SVC:/radius-freeradius.default.svc/g -e s/:RADIUS_PORT:/1812/
393 ... ${kind_voltha_dir}/onos-files/onos-aaa.json | curl --fail -sSL --user karaf:karaf -X POST
394 ... http://127.0.0.1:8181/onos/v1/network/configuration/apps/org.opencord.aaa
395 ... -H Content-type:application/json -d@-
396 ${rc} Run And Return Rc ${cmd}
397 Should Be Equal as Integers ${rc} 0