blob: d317236f2a48bb254e36e20059b0cdc70a18df37 [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
Suchitra Vemuri32dea012020-07-08 16:40:06 -070021Suite Teardown Teardown Suite
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000022Library 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 Vemuricdc32d82020-07-17 12:24:46 -070047${timeout} 360s
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
Hardik Windlasscbcca312020-04-20 21:46:11 +053053${workflow} ATT
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000054
Andy Bavierabeba262020-02-07 16:22:16 -070055# Per-test logging on failure is turned off by default; set this variable to enable
56${container_log_dir} ${None}
57
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000058*** Test Cases ***
59Adding the same OLT before and after enabling the device
60 [Documentation] Create OLT, Create the same OLT again and Check for the Error message
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080061 ... VOL-2405 VOL-2406
62 [Tags] AddSameOLT functional released
Andy Baviere187eda2020-04-20 15:00:02 -070063 [Setup] 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
Suchitra Vemurif7a033c2020-02-26 17:22:41 -080066 # Add OLT device
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -080067 #setup
Andy Bavierc1904dc2020-03-20 11:39:15 -070068 Delete All Devices and Verify
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080069 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuri736d35f2020-08-06 16:28:35 -070070 # Wait for the OLT to be reachable
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080071 FOR ${I} IN RANGE 0 ${olt_count}
72 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
73 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
74 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
75 ${olt_ip}= Get From Dictionary ${list_olts}[${I}] ip
76 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
77 #${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
78 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
79 ... Check Remote System Reachability True ${olt_ssh_ip}
80 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
81 Set Suite Variable ${olt_device_id}
82 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
83 ... ${olt_device_id}
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 Should Contain ${output} device is already pre-provisioned ignore_case=True
88 #Enable the created OLT device
89 Enable Device ${olt_device_id}
90 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
91 ... ${olt_serial_number}
92 ${rc} ${output}= Run and Return Rc and Output
93 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
94 Should Not Be Equal As Integers ${rc} 0
95 Log ${output}
96 Should Contain ${output} device is already pre-provisioned ignore_case=True
97 Log "This OLT is added already and enabled"
98 END
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000099
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000100Test Disable or Enable different device id which is not in the device list
101 [Documentation] Disable or Enable a device id which is not listed in the voltctl device list
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000102 ... command and ensure that error message is shown.
Suchitra Vemuria7dae322020-02-19 22:38:18 -0800103 ... VOL-2412-2413
104 [Tags] functional DisableEnableInvalidDevice released
Andy Baviere187eda2020-04-20 15:00:02 -0700105 [Setup] Start Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700106 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700107 ... AND Stop Logging DisableInvalidDevice
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800108 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000109 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
110 Should Be Equal As Integers ${rc} 0
111 ${jsondata}= To Json ${output}
112 Log ${jsondata}
113 ${length}= Get Length ${jsondata}
114 @{ids}= Create List
115 FOR ${INDEX} IN RANGE 0 ${length}
116 ${value}= Get From List ${jsondata} ${INDEX}
117 ${device_id}= Get From Dictionary ${value} id
118 Append To List ${ids} ${device_id}
119 END
120 #Create a new fake device id
121 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
122 Log ${fakeDeviceId}
123 #Ensure that the new id created is not in the device id list
124 List Should Not Contain Value ${ids} ${fakeDeviceId}
125 #Disable fake device id
126 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuria7e8ad22020-02-11 18:02:40 -0800127 Should Contain ${output} Error while disabling '${fakeDeviceId}'
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000128 #Disable device for VOL-2413
129 Disable Device ${device_id}
130 #Enable fake device id
131 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
132 Should Contain ${output} Error while enabling '${fakeDeviceId}'
suraj gourbaee2c62020-02-03 10:21:32 +0000133
134Check deletion of OLT/ONU before disabling
135 [Documentation] Try deleting OL/ONU before disabling and check error message
136 ... Assuming devices are already created, up and running fine; test1 or sanity was
137 ... executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800138 ... VOL-2411
Hardik Windlasscbcca312020-04-20 21:46:11 +0530139 #TODO: If this TC gets updated in future, To add support for DT workflow as well (refer JIRA: VOL-2945)
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800140 [Tags] functional DeleteBeforeDisableCheck notready
Andy Baviere187eda2020-04-20 15:00:02 -0700141 [Setup] Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700142 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700143 ... AND Stop Logging DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000144 #validate olt states
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800145 Run Keyword If ${has_dataplane} Clean Up Linux
146 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800147 FOR ${I} IN RANGE 0 ${olt_count}
148 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
149 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
150 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
151 ${olt_ip}= Get From Dictionary ${list_olts}[${I}] ip
152 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
153 #${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
154 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
155 ... REACHABLE ${olt_serial_number}
156 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
157 Log ${output}
158 Should Contain ${output} expected-admin-state:DISABLED
159 Wait Until Keyword Succeeds ${timeout} 5s
160 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
161 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
162 ... ${olt_serial_number}
163 Set Global Variable ${of_id}
164 END
165 FOR ${I} IN RANGE 0 ${num_all_onus}
suraj gourbaee2c62020-02-03 10:21:32 +0000166 ${src}= Set Variable ${hosts.src[${I}]}
167 ${dst}= Set Variable ${hosts.dst[${I}]}
168 ${onu_device_id}= Get Device ID From SN ${src['onu']}
169 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
170 ... ENABLED ACTIVE REACHABLE
171 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
172 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
173 Log ${output}
174 Should Contain ${output} expected-admin-state:DISABLED
175 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
176 ... ENABLED ACTIVE REACHABLE
177 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
178 END
suraj gourb3160412020-02-04 06:11:31 +0000179
180Check disabling of pre-provisioned OLT before enabling
181 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800182 ... VOL-2414
183 [Tags] functional DisablePreprovisionedOLTCheck
Andy Baviere187eda2020-04-20 15:00:02 -0700184 [Setup] Run Keywords Start Logging DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700185 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700186 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700187 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700188 Sleep 180s
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800189 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800190 FOR ${I} IN RANGE 0 ${olt_count}
191 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
192 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
193 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
194 ${olt_ip}= Get From Dictionary ${list_olts}[${I}] ip
195 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
196 #${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
197 #create/preprovision device
198 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
199 Set Suite Variable ${olt_device_id}
200 #validate olt states
201 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN
202 ... UNKNOWN ${olt_device_id}
203 #Try disabling pre-provisioned OLT
204 ${rc} ${output}= Run and Return Rc and Output
205 ... ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
206 Should Not Be Equal As Integers ${rc} 0
207 Log ${output}
208 Should Contain ${output} invalid-admin-state:PREPROVISIONED
209 #Enable OLT
210 Enable Device ${olt_device_id}
211 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
212 ... ${olt_serial_number}
213 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
214 Set Suite Variable ${logical_id}
215 END
Hardik Windlasscbcca312020-04-20 21:46:11 +0530216 ${onu_reason}= Set Variable If '${workflow}' == 'DT' initial-mib-downloaded omci-flows-pushed
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800217 FOR ${I} IN RANGE 0 ${num_all_onus}
suraj gourb3160412020-02-04 06:11:31 +0000218 ${src}= Set Variable ${hosts.src[${I}]}
219 ${dst}= Set Variable ${hosts.dst[${I}]}
220 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
221 ... ENABLED ACTIVE REACHABLE
Hardik Windlasscbcca312020-04-20 21:46:11 +0530222 ... ${src['onu']} onu=True onu_reason=${onu_reason}
suraj gourb3160412020-02-04 06:11:31 +0000223 END
Hema526eceb2020-02-04 13:11:40 +0530224
225Disable and Delete the logical device directly
226 [Documentation] Disable and delete the logical device directly is not possible
227 ... since it is allowed only through OLT device deletion.
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800228 ... VOL-2418
229 [Tags] functional DisableDelete_LogicalDevice
Andy Baviere187eda2020-04-20 15:00:02 -0700230 [Setup] Run Keywords Start Logging DisableDelete_LogicalDevice
Andy Bavierde53a1f2020-03-25 14:53:56 -0700231 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700232 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700233 ... AND Stop Logging DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530234 Run Keyword If ${has_dataplane} Sleep 180s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800235 FOR ${I} IN RANGE 0 ${olt_count}
236 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
237 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
238 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
239 ${olt_ip}= Get From Dictionary ${list_olts}[${I}] ip
240 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
241 #${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
242 #create/preprovision OLT device
243 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
244 Set Suite Variable ${olt_device_id}
245 #validate olt states
246 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN
Suchitra Vemurif8462be2020-11-05 13:38:42 -0800247 ... UNKNOWN ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800248 #Enable the created OLT device
249 Enable Device ${olt_device_id}
250 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE
251 ... REACHABLE ${olt_serial_number}
252 #Check whether logical devices are also created
253 ${rc} ${output}= Run and Return Rc and Output
254 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
255 Should Be Equal As Integers ${rc} 0
256 Log ${output}
257 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
258 Should Not Be Empty ${logical_id}
259 ${rc} ${output}= Run and Return Rc and Output
260 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
261 Should Not Be Equal As Integers ${rc} 0
262 Log ${output}
263 Should Contain '${output}' Unknown command
264 ${rc} ${output1}= Run and Return Rc and Output
265 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
266 Should Not Be Equal As Integers ${rc} 0
267 Log ${output1}
268 Should Contain '${output1}' Unknown command
269 END
suraj goura4166222020-02-03 12:09:11 +0000270
271Check logical device creation and deletion
272 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
273 ... logical device, flows, ports
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800274 ... VOL-2416 VOL-2417
275 [Tags] functional LogicalDeviceCheck
Andy Baviere187eda2020-04-20 15:00:02 -0700276 [Setup] Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700277 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700278 ... AND Stop Logging LogicalDeviceCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700279 Delete All Devices and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800280 FOR ${I} IN RANGE 0 ${olt_count}
281 ${olt_user}= Get From Dictionary ${list_olts}[${I}] user
282 ${olt_pass}= Get From Dictionary ${list_olts}[${I}] pass
283 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
284 ${olt_ip}= Get From Dictionary ${list_olts}[${I}] ip
285 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
286 #${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
287 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
288 Should Be Empty ${logical_id}
289 Run Keyword If ${has_dataplane} Sleep 180s
290 ... ELSE Sleep 10s
291 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
292 Set Suite Variable ${olt_device_id}
293 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN
294 ... UNKNOWN ${olt_device_id}
295 Enable Device ${olt_device_id}
296 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
297 ... ${olt_serial_number}
298 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
299 Should Not Be Empty ${logical_id}
300 ${rc} ${output}= Run and Return Rc and Output
301 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
302 Should Be Equal As Integers ${rc} 0
303 Log ${output}
304 Should Contain ${output} ${olt_device_id}
305 Set Suite Variable ${logical_id}
306 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
307 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
308 Run Keyword and Ignore Error Collect Logs
309 END
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -0800310
311*** Keywords ***
312Setup Suite
313 [Documentation] Set up the test suite
314 Common Test Suite Setup
315
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700316Teardown Suite
317 [Documentation] Teardown suite
318 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700319 #Restore all ONUs
320# Run Keyword If ${has_dataplane} RestoreONUs ${num_onus}