blob: 5d944322cb66dc4cfb0f2415c27146e007fc0466 [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
Suchitra Vemuri967a5572020-06-19 18:18:17 -070053${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 Bavierabeba262020-02-07 16:22:16 -070063 [Setup] Run Keywords Announce Message START TEST AddSameOLT
64 ... AND Start Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070065 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070066 ... AND Stop Logging AddSameOLT
Andy Bavier4a8450e2020-02-04 08:58:37 -070067 ... AND Announce Message END TEST AddSameOLT
Suchitra Vemurif7a033c2020-02-26 17:22:41 -080068 # Add OLT device
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -080069 #setup
Andy Bavierc1904dc2020-03-20 11:39:15 -070070 Delete All Devices and Verify
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -080071 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000072 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
73 Set Suite Variable ${olt_device_id}
Suchitra Vemuri967a5572020-06-19 18:18:17 -070074 ${timeout} Set Variable 250s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000075 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 Vemuri6214b342020-06-19 14:59:27 -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 Vemuri6214b342020-06-19 14:59:27 -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 Bavierabeba262020-02-07 16:22:16 -070097 [Setup] Run Keywords Announce Message START TEST DisableInvalidDevice
98 ... AND Start Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070099 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700100 ... AND Stop Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700101 ... AND Announce Message END TEST DisableInvalidDevice
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800102 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +0000103 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
104 Should Be Equal As Integers ${rc} 0
105 ${jsondata}= To Json ${output}
106 Log ${jsondata}
107 ${length}= Get Length ${jsondata}
108 @{ids}= Create List
109 FOR ${INDEX} IN RANGE 0 ${length}
110 ${value}= Get From List ${jsondata} ${INDEX}
111 ${device_id}= Get From Dictionary ${value} id
112 Append To List ${ids} ${device_id}
113 END
114 #Create a new fake device id
115 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
116 Log ${fakeDeviceId}
117 #Ensure that the new id created is not in the device id list
118 List Should Not Contain Value ${ids} ${fakeDeviceId}
119 #Disable fake device id
120 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuria7e8ad22020-02-11 18:02:40 -0800121 Should Contain ${output} Error while disabling '${fakeDeviceId}'
Gayathri.Selvan967f5a52020-02-12 06:58:38 +0000122 #Disable device for VOL-2413
123 Disable Device ${device_id}
124 #Enable fake device id
125 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId}
126 Should Contain ${output} Error while enabling '${fakeDeviceId}'
suraj gourbaee2c62020-02-03 10:21:32 +0000127
128Check deletion of OLT/ONU before disabling
129 [Documentation] Try deleting OL/ONU before disabling and check error message
130 ... Assuming devices are already created, up and running fine; test1 or sanity was
131 ... executed where all the ONUs are authenticated/DHCP/pingable
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800132 ... VOL-2411
133 [Tags] functional DeleteBeforeDisableCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700134 [Setup] Run Keywords Announce Message START TEST DeleteBeforeDisableCheck
135 ... AND Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700136 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700137 ... AND Stop Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700138 ... AND Announce Message END TEST DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000139 #validate olt states
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800140 Run Keyword If ${has_dataplane} Clean Up Linux
141 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
suraj gourbaee2c62020-02-03 10:21:32 +0000142 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
143 ... ${olt_serial_number}
144 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
145 Log ${output}
146 Should Contain ${output} expected-admin-state:DISABLED
147 Wait Until Keyword Succeeds ${timeout} 5s
148 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
149 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
150 Set Global Variable ${of_id}
151 FOR ${I} IN RANGE 0 ${num_onus}
152 ${src}= Set Variable ${hosts.src[${I}]}
153 ${dst}= Set Variable ${hosts.dst[${I}]}
154 ${onu_device_id}= Get Device ID From SN ${src['onu']}
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 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
159 Log ${output}
160 Should Contain ${output} expected-admin-state:DISABLED
161 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
162 ... ENABLED ACTIVE REACHABLE
163 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
164 END
suraj gourb3160412020-02-04 06:11:31 +0000165
166Check disabling of pre-provisioned OLT before enabling
167 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800168 ... VOL-2414
169 [Tags] functional DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700170 [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700171 ... AND Start Logging DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700172 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700173 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700174 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700175 ... AND Announce Message END TEST DisablePreprovisionedOLTCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700176 Sleep 180s
Suchitra Vemuri9a6dd6d2020-02-28 17:46:26 -0800177 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000178 #create/preprovision device
179 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
180 Set Suite Variable ${olt_device_id}
181 #validate olt states
182 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800183 ... ${olt_device_id}
suraj gourb3160412020-02-04 06:11:31 +0000184 #Try disabling pre-provisioned OLT
185 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700186 Should Not Be Equal As Integers ${rc} 0
suraj gourb3160412020-02-04 06:11:31 +0000187 Log ${output}
188 Should Contain ${output} invalid-admin-state:PREPROVISIONED
189 #Enable OLT
190 Enable Device ${olt_device_id}
191 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
192 ... ${olt_serial_number}
193 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
Suchitra Vemuri6214b342020-06-19 14:59:27 -0700194 ${onu_reason}= Set Variable If '${workflow}' == 'DT' initial-mib-downloaded omci-flows-pushed
suraj gourb3160412020-02-04 06:11:31 +0000195 Set Suite Variable ${logical_id}
196 FOR ${I} IN RANGE 0 ${num_onus}
197 ${src}= Set Variable ${hosts.src[${I}]}
198 ${dst}= Set Variable ${hosts.dst[${I}]}
199 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
200 ... ENABLED ACTIVE REACHABLE
Suchitra Vemuri6214b342020-06-19 14:59:27 -0700201 ... ${src['onu']} onu=True onu_reason=${onu_reason}
suraj gourb3160412020-02-04 06:11:31 +0000202 END
Hema526eceb2020-02-04 13:11:40 +0530203
204Disable and Delete the logical device directly
205 [Documentation] Disable and delete the logical device directly is not possible
206 ... since it is allowed only through OLT device deletion.
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800207 ... VOL-2418
208 [Tags] functional DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700209 [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice
Andy Bavierabeba262020-02-07 16:22:16 -0700210 ... AND Start Logging DisableDelete_LogicalDevice
Andy Bavierde53a1f2020-03-25 14:53:56 -0700211 ... AND Delete All Devices and Verify
Andy Bavier4a8450e2020-02-04 08:58:37 -0700212 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700213 ... AND Stop Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700214 ... AND Announce Message END TEST DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530215 Run Keyword If ${has_dataplane} Sleep 180s
216 #create/preprovision OLT device
217 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
218 Set Suite Variable ${olt_device_id}
219 #validate olt states
220 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800221 ... ${olt_device_id}
Hema526eceb2020-02-04 13:11:40 +0530222 #Enable the created OLT device
223 Enable Device ${olt_device_id}
224 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
225 ... ${olt_serial_number}
226 #Check whether logical devices are also created
227 ${rc} ${output}= Run and Return Rc and Output
228 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
229 Should Be Equal As Integers ${rc} 0
230 Log ${output}
231 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
232 Should Not Be Empty ${logical_id}
233 ${rc} ${output}= Run and Return Rc and Output
234 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700235 Should Not Be Equal As Integers ${rc} 0
Hema526eceb2020-02-04 13:11:40 +0530236 Log ${output}
237 Should Contain '${output}' Unknown command
238 ${rc} ${output1}= Run and Return Rc and Output
239 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
Andy Bavierde53a1f2020-03-25 14:53:56 -0700240 Should Not Be Equal As Integers ${rc} 0
Hema526eceb2020-02-04 13:11:40 +0530241 Log ${output1}
242 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000243
244Check logical device creation and deletion
245 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
246 ... logical device, flows, ports
Suchitra Vemuri5f66f422020-03-02 16:43:49 -0800247 ... VOL-2416 VOL-2417
248 [Tags] functional LogicalDeviceCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700249 [Setup] Run Keywords Announce Message START TEST LogicalDeviceCheck
250 ... AND Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700251 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700252 ... AND Stop Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700253 ... AND Announce Message END TEST LogicalDeviceCheck
Andy Bavierde53a1f2020-03-25 14:53:56 -0700254 Delete All Devices and Verify
suraj goura4166222020-02-03 12:09:11 +0000255 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
256 Should Be Empty ${logical_id}
257 Run Keyword If ${has_dataplane} Sleep 180s
258 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
259 Set Suite Variable ${olt_device_id}
260 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
ubuntu6b6e7d42020-03-02 12:35:42 -0800261 ... ${olt_device_id}
suraj goura4166222020-02-03 12:09:11 +0000262 Enable Device ${olt_device_id}
263 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
264 ... ${olt_serial_number}
265 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
266 Should Not Be Empty ${logical_id}
267 ${rc} ${output}= Run and Return Rc and Output
268 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
269 Should Be Equal As Integers ${rc} 0
270 Log ${output}
271 Should Contain ${output} ${olt_device_id}
272 Set Suite Variable ${logical_id}
273 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
274 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
275 Run Keyword and Ignore Error Collect Logs
Suchitra Vemurie9c79bf2020-02-26 23:11:39 -0800276
277*** Keywords ***
278Setup Suite
279 [Documentation] Set up the test suite
280 Common Test Suite Setup
281