blob: fcb435ec061c5770bc7021255dd6ab3a548442ea [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 Vemuria7dae322020-02-19 22:38:18 -080060 [Tags] VOL-2405 VOL-2406 AddSameOLT functional released
Andy Bavierabeba262020-02-07 16:22:16 -070061 [Setup] Run Keywords Announce Message START TEST AddSameOLT
62 ... AND Start Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070063 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070064 ... AND Stop Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070065 ... AND Announce Message END TEST AddSameOLT
Suchitra Vemurif7a033c2020-02-26 17:22:41 -080066 # Add OLT device
67 setup
68 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
Suchitra Vemuribd7fcd22020-01-22 19:08:32 -080069 Run Keyword If ${has_dataplane} Delete Device and Verify
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000070 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
71 Set Suite Variable ${olt_device_id}
Suchitra Vemuri1d0d0222020-02-12 17:17:19 -080072 ${timeout} Set Variable 180s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000073 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
74 ... ${EMPTY} ${olt_device_id}
75 ${rc} ${output}= Run and Return Rc and Output
76 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
77 Should Not Be Equal As Integers ${rc} 0
78 Should Contain ${output} Device is already pre-provisioned
79 #Enable the created OLT device
80 Enable Device ${olt_device_id}
81 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
82 ... ${olt_serial_number}
83 ${rc} ${output}= Run and Return Rc and Output
84 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
85 Should Not Be Equal As Integers ${rc} 0
86 Log ${output}
87 Should Contain ${output} Device is already pre-provisioned
88 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000089
Gayathri.Selvan967f5a52020-02-12 06:58:38 +000090Test Disable or Enable different device id which is not in the device list
91 [Documentation] Disable or Enable a device id which is not listed in the voltctl device list
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000092 ... command and ensure that error message is shown.
Suchitra Vemuria7dae322020-02-19 22:38:18 -080093 ... VOL-2412-2413
94 [Tags] functional DisableEnableInvalidDevice released
Andy Bavierabeba262020-02-07 16:22:16 -070095 [Setup] Run Keywords Announce Message START TEST DisableInvalidDevice
96 ... AND Start Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070097 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070098 ... AND Stop Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070099 ... AND Announce Message END TEST DisableInvalidDevice
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000100 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
101 Should Be Equal As Integers ${rc} 0
102 ${jsondata}= To Json ${output}
103 Log ${jsondata}
104 ${length}= Get Length ${jsondata}
105 @{ids}= Create List
106 FOR ${INDEX} IN RANGE 0 ${length}
107 ${value}= Get From List ${jsondata} ${INDEX}
108 ${device_id}= Get From Dictionary ${value} id
109 Append To List ${ids} ${device_id}
110 END
111 #Create a new fake device id
112 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
113 Log ${fakeDeviceId}
114 #Ensure that the new id created is not in the device id list
115 List Should Not Contain Value ${ids} ${fakeDeviceId}
116 #Disable fake device id
117 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuria7e8ad22020-02-11 18:02:40 -0800118 Should Contain ${output} Error while disabling '${fakeDeviceId}'
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000119 #Disable device for VOL-2413
120 Disable Device ${device_id}
121 #Enable fake device id
122 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
123 Should Contain ${output} Error while enabling '${fakeDeviceId}'
suraj gourbaee2c62020-02-03 10:21:32 +0000124
125Check deletion of OLT/ONU before disabling
126 [Documentation] Try deleting OL/ONU before disabling and check error message
127 ... Assuming devices are already created, up and running fine; test1 or sanity was
128 ... executed where all the ONUs are authenticated/DHCP/pingable
129 [Tags] VOL-2411 DeleteBeforeDisableCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700130 [Setup] Run Keywords Announce Message START TEST DeleteBeforeDisableCheck
131 ... AND Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700132 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700133 ... AND Stop Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700134 ... AND Announce Message END TEST DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000135 #validate olt states
136 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
137 ... ${olt_serial_number}
138 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
139 Log ${output}
140 Should Contain ${output} expected-admin-state:DISABLED
141 Wait Until Keyword Succeeds ${timeout} 5s
142 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
143 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
144 Set Global Variable ${of_id}
145 FOR ${I} IN RANGE 0 ${num_onus}
146 ${src}= Set Variable ${hosts.src[${I}]}
147 ${dst}= Set Variable ${hosts.dst[${I}]}
148 ${onu_device_id}= Get Device ID From SN ${src['onu']}
149 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
150 ... ENABLED ACTIVE REACHABLE
151 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
152 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
153 Log ${output}
154 Should Contain ${output} expected-admin-state:DISABLED
155 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
156 ... ENABLED ACTIVE REACHABLE
157 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
158 END
159 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000160
161Check disabling of pre-provisioned OLT before enabling
162 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
163 [Tags] VOL-2414 DisablePreprovisionedOLTCheck notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700164 [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700165 ... AND Start Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700166 ... AND Delete Device and Verify
167 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700168 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700169 ... AND Announce Message END TEST DisablePreprovisionedOLTCheck
suraj gourb3160412020-02-04 06:11:31 +0000170 Run Keyword If ${has_dataplane} Sleep 180s
171 #create/preprovision device
172 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
173 Set Suite Variable ${olt_device_id}
174 #validate olt states
175 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
176 ... ${EMPTY} ${olt_device_id}
177 #Try disabling pre-provisioned OLT
178 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
179 Should Be Equal As Integers ${rc} 0
180 Log ${output}
181 Should Contain ${output} invalid-admin-state:PREPROVISIONED
182 #Enable OLT
183 Enable Device ${olt_device_id}
184 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
185 ... ${olt_serial_number}
186 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
187 Set Suite Variable ${logical_id}
188 FOR ${I} IN RANGE 0 ${num_onus}
189 ${src}= Set Variable ${hosts.src[${I}]}
190 ${dst}= Set Variable ${hosts.dst[${I}]}
191 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
192 ... ENABLED ACTIVE REACHABLE
193 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
194 END
195 Run Keyword and Ignore Error Collect Logs
Hema526eceb2020-02-04 13:11:40 +0530196
197Disable and Delete the logical device directly
198 [Documentation] Disable and delete the logical device directly is not possible
199 ... since it is allowed only through OLT device deletion.
200 [Tags] VOL-2418 DisableDelete_LogicalDevice notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700201 [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice
Andy Bavierabeba262020-02-07 16:22:16 -0700202 ... AND Start Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700203 ... AND Delete Device and Verify
204 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700205 ... AND Stop Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700206 ... AND Announce Message END TEST DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530207 Run Keyword If ${has_dataplane} Sleep 180s
208 #create/preprovision OLT device
209 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
210 Set Suite Variable ${olt_device_id}
211 #validate olt states
212 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
213 ... ${EMPTY} ${olt_device_id}
214 #Enable the created OLT device
215 Enable Device ${olt_device_id}
216 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
217 ... ${olt_serial_number}
218 #Check whether logical devices are also created
219 ${rc} ${output}= Run and Return Rc and Output
220 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
221 Should Be Equal As Integers ${rc} 0
222 Log ${output}
223 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
224 Should Not Be Empty ${logical_id}
225 ${rc} ${output}= Run and Return Rc and Output
226 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
227 Should Be Equal As Integers ${rc} 0
228 Log ${output}
229 Should Contain '${output}' Unknown command
230 ${rc} ${output1}= Run and Return Rc and Output
231 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
232 Should Be Equal As Integers ${rc} 0
233 Log ${output1}
234 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000235
236Check logical device creation and deletion
237 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
238 ... logical device, flows, ports
239 [Tags] VOL-2416 VOL-2417 LogicalDeviceCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700240 [Setup] Run Keywords Announce Message START TEST LogicalDeviceCheck
241 ... AND Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700242 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700243 ... AND Stop Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700244 ... AND Announce Message END TEST LogicalDeviceCheck
suraj goura4166222020-02-03 12:09:11 +0000245 Delete Device and Verify
246 ${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
249 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
250 Set Suite Variable ${olt_device_id}
251 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
252 ... ${EMPTY} ${olt_device_id}
253 Enable Device ${olt_device_id}
254 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
255 ... ${olt_serial_number}
256 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
257 Should Not Be Empty ${logical_id}
258 ${rc} ${output}= Run and Return Rc and Output
259 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
260 Should Be Equal As Integers ${rc} 0
261 Log ${output}
262 Should Contain ${output} ${olt_device_id}
263 Set Suite Variable ${logical_id}
264 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
265 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
266 Run Keyword and Ignore Error Collect Logs