blob: 85436155e5c394317f8ef8e9914023e29243fab2 [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
71 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
72 ... Check Remote System Reachability True ${olt_ssh_ip}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000073 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
74 Set Suite Variable ${olt_device_id}
75 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -080076 ... ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000077 ${rc} ${output}= Run and Return Rc and Output
78 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
79 Should Not Be Equal As Integers ${rc} 0
Suchitra Vemuri14eec432020-06-19 14:55:47 -070080 Should Contain ${output} device is already pre-provisioned ignore_case=True
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000081 #Enable the created OLT device
82 Enable Device ${olt_device_id}
83 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
84 ... ${olt_serial_number}
85 ${rc} ${output}= Run and Return Rc and Output
86 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
87 Should Not Be Equal As Integers ${rc} 0
88 Log ${output}
Suchitra Vemuri14eec432020-06-19 14:55:47 -070089 Should Contain ${output} device is already pre-provisioned ignore_case=True
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000090 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000091
Gayathri.Selvan967f5a52020-02-12 06:58:38 +000092Test Disable or Enable different device id which is not in the device list
93 [Documentation] Disable or Enable a device id which is not listed in the voltctl device list
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000094 ... command and ensure that error message is shown.
Suchitra Vemuria7dae322020-02-19 22:38:18 -080095 ... VOL-2412-2413
96 [Tags] functional DisableEnableInvalidDevice released
Andy Baviere187eda2020-04-20 15:00:02 -070097 [Setup] 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
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800100 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000101 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
102 Should Be Equal As Integers ${rc} 0
103 ${jsondata}= To Json ${output}
104 Log ${jsondata}
105 ${length}= Get Length ${jsondata}
106 @{ids}= Create List
107 FOR ${INDEX} IN RANGE 0 ${length}
108 ${value}= Get From List ${jsondata} ${INDEX}
109 ${device_id}= Get From Dictionary ${value} id
110 Append To List ${ids} ${device_id}
111 END
112 #Create a new fake device id
113 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
114 Log ${fakeDeviceId}
115 #Ensure that the new id created is not in the device id list
116 List Should Not Contain Value ${ids} ${fakeDeviceId}
117 #Disable fake device id
118 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuria7e8ad22020-02-11 18:02:40 -0800119 Should Contain ${output} Error while disabling '${fakeDeviceId}'
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000120 #Disable device for VOL-2413
121 Disable Device ${device_id}
122 #Enable fake device id
123 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
124 Should Contain ${output} Error while enabling '${fakeDeviceId}'
suraj gourbaee2c62020-02-03 10:21:32 +0000125
126Check deletion of OLT/ONU before disabling
127 [Documentation] Try deleting OL/ONU before disabling and check error message
128 ... Assuming devices are already created, up and running fine; test1 or sanity was
129 ... executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800130 ... VOL-2411
Hardik Windlasscbcca312020-04-20 21:46:11 +0530131 #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 -0800132 [Tags] functional DeleteBeforeDisableCheck notready
Andy Baviere187eda2020-04-20 15:00:02 -0700133 [Setup] Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700134 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700135 ... AND Stop Logging DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000136 #validate olt states
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800137 Run Keyword If ${has_dataplane} Clean Up Linux
138 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
suraj gourbaee2c62020-02-03 10:21:32 +0000139 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
140 ... ${olt_serial_number}
141 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
142 Log ${output}
143 Should Contain ${output} expected-admin-state:DISABLED
144 Wait Until Keyword Succeeds ${timeout} 5s
145 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
146 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
147 Set Global Variable ${of_id}
148 FOR ${I} IN RANGE 0 ${num_onus}
149 ${src}= Set Variable ${hosts.src[${I}]}
150 ${dst}= Set Variable ${hosts.dst[${I}]}
151 ${onu_device_id}= Get Device ID From SN ${src['onu']}
152 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
153 ... ENABLED ACTIVE REACHABLE
154 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
155 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
156 Log ${output}
157 Should Contain ${output} expected-admin-state:DISABLED
158 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
159 ... ENABLED ACTIVE REACHABLE
160 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
161 END
suraj gourb3160412020-02-04 06:11:31 +0000162
163Check disabling of pre-provisioned OLT before enabling
164 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800165 ... VOL-2414
166 [Tags] functional DisablePreprovisionedOLTCheck
Andy Baviere187eda2020-04-20 15:00:02 -0700167 [Setup] Run Keywords Start Logging DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700168 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700169 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700170 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700171 Sleep 180s
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800172 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000173 #create/preprovision device
174 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
175 Set Suite Variable ${olt_device_id}
176 #validate olt states
177 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800178 ... ${olt_device_id}
suraj gourb3160412020-02-04 06:11:31 +0000179 #Try disabling pre-provisioned OLT
180 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700181 Should Not Be Equal As Integers ${rc} 0
suraj gourb3160412020-02-04 06:11:31 +0000182 Log ${output}
183 Should Contain ${output} invalid-admin-state:PREPROVISIONED
184 #Enable OLT
185 Enable Device ${olt_device_id}
186 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
187 ... ${olt_serial_number}
188 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
189 Set Suite Variable ${logical_id}
Hardik Windlasscbcca312020-04-20 21:46:11 +0530190 ${onu_reason}= Set Variable If '${workflow}' == 'DT' initial-mib-downloaded omci-flows-pushed
suraj gourb3160412020-02-04 06:11:31 +0000191 FOR ${I} IN RANGE 0 ${num_onus}
192 ${src}= Set Variable ${hosts.src[${I}]}
193 ${dst}= Set Variable ${hosts.dst[${I}]}
194 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
195 ... ENABLED ACTIVE REACHABLE
Hardik Windlasscbcca312020-04-20 21:46:11 +0530196 ... ${src['onu']} onu=True onu_reason=${onu_reason}
suraj gourb3160412020-02-04 06:11:31 +0000197 END
Hema526eceb2020-02-04 13:11:40 +0530198
199Disable and Delete the logical device directly
200 [Documentation] Disable and delete the logical device directly is not possible
201 ... since it is allowed only through OLT device deletion.
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800202 ... VOL-2418
203 [Tags] functional DisableDelete_LogicalDevice
Andy Baviere187eda2020-04-20 15:00:02 -0700204 [Setup] Run Keywords Start Logging DisableDelete_LogicalDevice
Andy Bavierde53a1f2020-03-25 14:53:56 -0700205 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700206 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700207 ... AND Stop Logging DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530208 Run Keyword If ${has_dataplane} Sleep 180s
209 #create/preprovision OLT device
210 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
211 Set Suite Variable ${olt_device_id}
212 #validate olt states
213 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800214 ... ${olt_device_id}
Hema526eceb2020-02-04 13:11:40 +0530215 #Enable the created OLT device
216 Enable Device ${olt_device_id}
217 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
218 ... ${olt_serial_number}
219 #Check whether logical devices are also created
220 ${rc} ${output}= Run and Return Rc and Output
221 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
222 Should Be Equal As Integers ${rc} 0
223 Log ${output}
224 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
225 Should Not Be Empty ${logical_id}
226 ${rc} ${output}= Run and Return Rc and Output
227 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700228 Should Not Be Equal As Integers ${rc} 0
Hema526eceb2020-02-04 13:11:40 +0530229 Log ${output}
230 Should Contain '${output}' Unknown command
231 ${rc} ${output1}= Run and Return Rc and Output
232 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700233 Should Not Be Equal As Integers ${rc} 0
Hema526eceb2020-02-04 13:11:40 +0530234 Log ${output1}
235 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000236
237Check logical device creation and deletion
238 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
239 ... logical device, flows, ports
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800240 ... VOL-2416 VOL-2417
241 [Tags] functional LogicalDeviceCheck
Andy Baviere187eda2020-04-20 15:00:02 -0700242 [Setup] Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700243 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700244 ... AND Stop Logging LogicalDeviceCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700245 Delete All Devices and Verify
suraj goura4166222020-02-03 12:09:11 +0000246 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
247 Should Be Empty ${logical_id}
248 Run Keyword If ${has_dataplane} Sleep 180s
Suchitra Vemuric1efa6f2020-09-16 11:22:39 -0700249 ... ELSE Sleep 10s
suraj goura4166222020-02-03 12:09:11 +0000250 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
251 Set Suite Variable ${olt_device_id}
252 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800253 ... ${olt_device_id}
suraj goura4166222020-02-03 12:09:11 +0000254 Enable Device ${olt_device_id}
255 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
256 ... ${olt_serial_number}
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 list
261 Should Be Equal As Integers ${rc} 0
262 Log ${output}
263 Should Contain ${output} ${olt_device_id}
264 Set Suite Variable ${logical_id}
265 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
266 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
267 Run Keyword and Ignore Error Collect Logs
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -0800268
269*** Keywords ***
270Setup Suite
271 [Documentation] Set up the test suite
272 Common Test Suite Setup
273
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700274Teardown Suite
275 [Documentation] Teardown suite
276 Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700277 #Restore all ONUs
278# Run Keyword If ${has_dataplane} RestoreONUs ${num_onus}