blob: aabeb0d117e0f52892561ea48052d48c397821ef [file] [log] [blame]
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +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 ***
17Documentation Test various end-to-end scenarios
18Suite 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
34
35*** Variables ***
36${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
43${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
Suchitra Vemurif7a033c2020-02-26 17:22:41 -080047${timeout} 120s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000048${of_id} 0
49${logical_id} 0
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -080050${has_dataplane} True
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000051${teardown_device} False
52${scripts} ../../scripts
53
Andy Bavierabeba262020-02-07 16:22:16 -070054# Per-test logging on failure is turned off by default; set this variable to enable
55${container_log_dir} ${None}
56
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000057*** Test Cases ***
58Adding the same OLT before and after enabling the device
59 [Documentation] Create OLT, Create the same OLT again and Check for the Error message
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080060 ... VOL-2405 VOL-2406
61 [Tags] AddSameOLT functional released
Andy Bavierabeba262020-02-07 16:22:16 -070062 [Setup] Run Keywords Announce Message START TEST AddSameOLT
63 ... AND Start Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070064 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070065 ... AND Stop Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070066 ... AND Announce Message END TEST AddSameOLT
Suchitra Vemurif7a033c2020-02-26 17:22:41 -080067 # Add OLT device
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -080068 #setup
Suchitra Vemuribd7fcd22020-01-22 19:08:32 -080069 Run Keyword If ${has_dataplane} Delete Device and Verify
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080070 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000071 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
72 Set Suite Variable ${olt_device_id}
Suchitra Vemuri1d0d0222020-02-12 17:17:19 -080073 ${timeout} Set Variable 180s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000074 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -080075 ... ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000076 ${rc} ${output}= Run and Return Rc and Output
77 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
78 Should Not Be Equal As Integers ${rc} 0
79 Should Contain ${output} Device is already pre-provisioned
80 #Enable the created OLT device
81 Enable Device ${olt_device_id}
82 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
83 ... ${olt_serial_number}
84 ${rc} ${output}= Run and Return Rc and Output
85 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
86 Should Not Be Equal As Integers ${rc} 0
87 Log ${output}
88 Should Contain ${output} Device is already pre-provisioned
89 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000090
Gayathri.Selvan967f5a52020-02-12 06:58:38 +000091Test Disable or Enable different device id which is not in the device list
92 [Documentation] Disable or Enable a device id which is not listed in the voltctl device list
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000093 ... command and ensure that error message is shown.
Suchitra Vemuria7dae322020-02-19 22:38:18 -080094 ... VOL-2412-2413
95 [Tags] functional DisableEnableInvalidDevice released
Andy Bavierabeba262020-02-07 16:22:16 -070096 [Setup] Run Keywords Announce Message START TEST DisableInvalidDevice
97 ... AND Start Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070098 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070099 ... AND Stop Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700100 ... AND Announce Message END TEST DisableInvalidDevice
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800101 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000102 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
103 Should Be Equal As Integers ${rc} 0
104 ${jsondata}= To Json ${output}
105 Log ${jsondata}
106 ${length}= Get Length ${jsondata}
107 @{ids}= Create List
108 FOR ${INDEX} IN RANGE 0 ${length}
109 ${value}= Get From List ${jsondata} ${INDEX}
110 ${device_id}= Get From Dictionary ${value} id
111 Append To List ${ids} ${device_id}
112 END
113 #Create a new fake device id
114 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
115 Log ${fakeDeviceId}
116 #Ensure that the new id created is not in the device id list
117 List Should Not Contain Value ${ids} ${fakeDeviceId}
118 #Disable fake device id
119 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuria7e8ad22020-02-11 18:02:40 -0800120 Should Contain ${output} Error while disabling '${fakeDeviceId}'
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000121 #Disable device for VOL-2413
122 Disable Device ${device_id}
123 #Enable fake device id
124 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
125 Should Contain ${output} Error while enabling '${fakeDeviceId}'
suraj gourbaee2c62020-02-03 10:21:32 +0000126
127Check deletion of OLT/ONU before disabling
128 [Documentation] Try deleting OL/ONU before disabling and check error message
129 ... Assuming devices are already created, up and running fine; test1 or sanity was
130 ... executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800131 ... VOL-2411
132 [Tags] functional DeleteBeforeDisableCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700133 [Setup] Run Keywords Announce Message START TEST DeleteBeforeDisableCheck
134 ... AND Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700135 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700136 ... AND Stop Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700137 ... AND Announce Message END TEST DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000138 #validate olt states
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800139 Run Keyword If ${has_dataplane} Clean Up Linux
140 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
suraj gourbaee2c62020-02-03 10:21:32 +0000141 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
142 ... ${olt_serial_number}
143 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
144 Log ${output}
145 Should Contain ${output} expected-admin-state:DISABLED
146 Wait Until Keyword Succeeds ${timeout} 5s
147 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
148 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
149 Set Global Variable ${of_id}
150 FOR ${I} IN RANGE 0 ${num_onus}
151 ${src}= Set Variable ${hosts.src[${I}]}
152 ${dst}= Set Variable ${hosts.dst[${I}]}
153 ${onu_device_id}= Get Device ID From SN ${src['onu']}
154 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
155 ... ENABLED ACTIVE REACHABLE
156 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
157 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
158 Log ${output}
159 Should Contain ${output} expected-admin-state:DISABLED
160 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
161 ... ENABLED ACTIVE REACHABLE
162 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
163 END
suraj gourb3160412020-02-04 06:11:31 +0000164
165Check disabling of pre-provisioned OLT before enabling
166 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800167 ... VOL-2414
168 [Tags] functional DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700169 [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700170 ... AND Start Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700171 ... AND Delete Device and Verify
172 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700173 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700174 ... AND Announce Message END TEST DisablePreprovisionedOLTCheck
suraj gourb3160412020-02-04 06:11:31 +0000175 Run Keyword If ${has_dataplane} Sleep 180s
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800176 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000177 #create/preprovision device
178 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
179 Set Suite Variable ${olt_device_id}
180 #validate olt states
181 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800182 ... ${olt_device_id}
suraj gourb3160412020-02-04 06:11:31 +0000183 #Try disabling pre-provisioned OLT
184 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
185 Should Be Equal As Integers ${rc} 0
186 Log ${output}
187 Should Contain ${output} invalid-admin-state:PREPROVISIONED
188 #Enable OLT
189 Enable Device ${olt_device_id}
190 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
191 ... ${olt_serial_number}
192 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
193 Set Suite Variable ${logical_id}
194 FOR ${I} IN RANGE 0 ${num_onus}
195 ${src}= Set Variable ${hosts.src[${I}]}
196 ${dst}= Set Variable ${hosts.dst[${I}]}
197 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
198 ... ENABLED ACTIVE REACHABLE
199 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
200 END
Hema526eceb2020-02-04 13:11:40 +0530201
202Disable and Delete the logical device directly
203 [Documentation] Disable and delete the logical device directly is not possible
204 ... since it is allowed only through OLT device deletion.
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800205 ... VOL-2418
206 [Tags] functional DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700207 [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice
Andy Bavierabeba262020-02-07 16:22:16 -0700208 ... AND Start Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700209 ... AND Delete Device and Verify
210 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700211 ... AND Stop Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700212 ... AND Announce Message END TEST DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530213 Run Keyword If ${has_dataplane} Sleep 180s
214 #create/preprovision OLT device
215 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
216 Set Suite Variable ${olt_device_id}
217 #validate olt states
218 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800219 ... ${olt_device_id}
Hema526eceb2020-02-04 13:11:40 +0530220 #Enable the created OLT device
221 Enable Device ${olt_device_id}
222 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
223 ... ${olt_serial_number}
224 #Check whether logical devices are also created
225 ${rc} ${output}= Run and Return Rc and Output
226 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
227 Should Be Equal As Integers ${rc} 0
228 Log ${output}
229 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
230 Should Not Be Empty ${logical_id}
231 ${rc} ${output}= Run and Return Rc and Output
232 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
233 Should Be Equal As Integers ${rc} 0
234 Log ${output}
235 Should Contain '${output}' Unknown command
236 ${rc} ${output1}= Run and Return Rc and Output
237 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
238 Should Be Equal As Integers ${rc} 0
239 Log ${output1}
240 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000241
242Check logical device creation and deletion
243 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
244 ... logical device, flows, ports
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800245 ... VOL-2416 VOL-2417
246 [Tags] functional LogicalDeviceCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700247 [Setup] Run Keywords Announce Message START TEST LogicalDeviceCheck
248 ... AND Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700249 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700250 ... AND Stop Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700251 ... AND Announce Message END TEST LogicalDeviceCheck
suraj goura4166222020-02-03 12:09:11 +0000252 Delete Device and Verify
253 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
254 Should Be Empty ${logical_id}
255 Run Keyword If ${has_dataplane} Sleep 180s
256 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
257 Set Suite Variable ${olt_device_id}
258 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800259 ... ${olt_device_id}
suraj goura4166222020-02-03 12:09:11 +0000260 Enable Device ${olt_device_id}
261 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
262 ... ${olt_serial_number}
263 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
264 Should Not Be Empty ${logical_id}
265 ${rc} ${output}= Run and Return Rc and Output
266 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
267 Should Be Equal As Integers ${rc} 0
268 Log ${output}
269 Should Contain ${output} ${olt_device_id}
270 Set Suite Variable ${logical_id}
271 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
272 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
273 Run Keyword and Ignore Error Collect Logs
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -0800274
275*** Keywords ***
276Setup Suite
277 [Documentation] Set up the test suite
278 Common Test Suite Setup
279