blob: 977087c6025d4952eab8af351532bbbbfce5c2ba [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 Vemuribc5e3162020-01-23 11:21:10 -080047${timeout} 90s
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${external_libs} True
52${teardown_device} False
53${scripts} ../../scripts
54
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 Vemuri2fa9bba2020-01-22 17:38:48 -080061 [Tags] VOL-2405 VOL-2406 AddSameOLT functional
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 Vemuribd7fcd22020-01-22 19:08:32 -080067 Run Keyword If ${has_dataplane} Delete Device and Verify
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000068 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
69 Set Suite Variable ${olt_device_id}
70 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
71 ... ${EMPTY} ${olt_device_id}
72 ${rc} ${output}= Run and Return Rc and Output
73 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
74 Should Not Be Equal As Integers ${rc} 0
75 Should Contain ${output} Device is already pre-provisioned
76 #Enable the created OLT device
77 Enable Device ${olt_device_id}
78 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
79 ... ${olt_serial_number}
80 ${rc} ${output}= Run and Return Rc and Output
81 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
82 Should Not Be Equal As Integers ${rc} 0
83 Log ${output}
84 Should Contain ${output} Device is already pre-provisioned
85 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000086
87Test Disable different device id which is not in the device list
88 [Documentation] Disable a device id which is not listed in the voltctl device list
89 ... command and ensure that error message is shown.
Suchitra Vemuri925db9d2020-01-27 15:41:26 -080090 [Tags] functional DisableInvalidDevice VOL-2412
Andy Bavierabeba262020-02-07 16:22:16 -070091 [Setup] Run Keywords Announce Message START TEST DisableInvalidDevice
92 ... AND Start Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070093 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -070094 ... AND Stop Logging DisableInvalidDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -070095 ... AND Announce Message END TEST DisableInvalidDevice
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000096 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
97 Should Be Equal As Integers ${rc} 0
98 ${jsondata}= To Json ${output}
99 Log ${jsondata}
100 ${length}= Get Length ${jsondata}
101 @{ids}= Create List
102 FOR ${INDEX} IN RANGE 0 ${length}
103 ${value}= Get From List ${jsondata} ${INDEX}
104 ${device_id}= Get From Dictionary ${value} id
105 Append To List ${ids} ${device_id}
106 END
107 #Create a new fake device id
108 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
109 Log ${fakeDeviceId}
110 #Ensure that the new id created is not in the device id list
111 List Should Not Contain Value ${ids} ${fakeDeviceId}
112 #Disable fake device id
113 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuri925db9d2020-01-27 15:41:26 -0800114 Should Contain ${output} Error while disabling '${fakeDeviceId}': rpc error: code = NotFound desc
suraj gourbaee2c62020-02-03 10:21:32 +0000115
116Check deletion of OLT/ONU before disabling
117 [Documentation] Try deleting OL/ONU before disabling and check error message
118 ... Assuming devices are already created, up and running fine; test1 or sanity was
119 ... executed where all the ONUs are authenticated/DHCP/pingable
120 [Tags] VOL-2411 DeleteBeforeDisableCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700121 [Setup] Run Keywords Announce Message START TEST DeleteBeforeDisableCheck
122 ... AND Start Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700123 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700124 ... AND Stop Logging DeleteBeforeDisableCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700125 ... AND Announce Message END TEST DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000126 #validate olt states
127 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
128 ... ${olt_serial_number}
129 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
130 Log ${output}
131 Should Contain ${output} expected-admin-state:DISABLED
132 Wait Until Keyword Succeeds ${timeout} 5s
133 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
134 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
135 Set Global Variable ${of_id}
136 FOR ${I} IN RANGE 0 ${num_onus}
137 ${src}= Set Variable ${hosts.src[${I}]}
138 ${dst}= Set Variable ${hosts.dst[${I}]}
139 ${onu_device_id}= Get Device ID From SN ${src['onu']}
140 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
141 ... ENABLED ACTIVE REACHABLE
142 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
143 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
144 Log ${output}
145 Should Contain ${output} expected-admin-state:DISABLED
146 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
147 ... ENABLED ACTIVE REACHABLE
148 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
149 END
150 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000151
152Check disabling of pre-provisioned OLT before enabling
153 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
154 [Tags] VOL-2414 DisablePreprovisionedOLTCheck notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700155 [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck
Andy Bavierabeba262020-02-07 16:22:16 -0700156 ... AND Start Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700157 ... AND Delete Device and Verify
158 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700159 ... AND Stop Logging DisablePreprovisionedOLTCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700160 ... AND Announce Message END TEST DisablePreprovisionedOLTCheck
suraj gourb3160412020-02-04 06:11:31 +0000161 Run Keyword If ${has_dataplane} Sleep 180s
162 #create/preprovision device
163 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
164 Set Suite Variable ${olt_device_id}
165 #validate olt states
166 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
167 ... ${EMPTY} ${olt_device_id}
168 #Try disabling pre-provisioned OLT
169 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
170 Should Be Equal As Integers ${rc} 0
171 Log ${output}
172 Should Contain ${output} invalid-admin-state:PREPROVISIONED
173 #Enable OLT
174 Enable Device ${olt_device_id}
175 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
176 ... ${olt_serial_number}
177 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
178 Set Suite Variable ${logical_id}
179 FOR ${I} IN RANGE 0 ${num_onus}
180 ${src}= Set Variable ${hosts.src[${I}]}
181 ${dst}= Set Variable ${hosts.dst[${I}]}
182 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
183 ... ENABLED ACTIVE REACHABLE
184 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
185 END
186 Run Keyword and Ignore Error Collect Logs
Hema526eceb2020-02-04 13:11:40 +0530187
188Disable and Delete the logical device directly
189 [Documentation] Disable and delete the logical device directly is not possible
190 ... since it is allowed only through OLT device deletion.
191 [Tags] VOL-2418 DisableDelete_LogicalDevice notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700192 [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice
Andy Bavierabeba262020-02-07 16:22:16 -0700193 ... AND Start Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700194 ... AND Delete Device and Verify
195 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700196 ... AND Stop Logging DisableDelete_LogicalDevice
Andy Bavier4a8450e2020-02-04 08:58:37 -0700197 ... AND Announce Message END TEST DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530198 Run Keyword If ${has_dataplane} Sleep 180s
199 #create/preprovision OLT device
200 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
201 Set Suite Variable ${olt_device_id}
202 #validate olt states
203 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
204 ... ${EMPTY} ${olt_device_id}
205 #Enable the created OLT device
206 Enable Device ${olt_device_id}
207 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
208 ... ${olt_serial_number}
209 #Check whether logical devices are also created
210 ${rc} ${output}= Run and Return Rc and Output
211 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
212 Should Be Equal As Integers ${rc} 0
213 Log ${output}
214 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
215 Should Not Be Empty ${logical_id}
216 ${rc} ${output}= Run and Return Rc and Output
217 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
218 Should Be Equal As Integers ${rc} 0
219 Log ${output}
220 Should Contain '${output}' Unknown command
221 ${rc} ${output1}= Run and Return Rc and Output
222 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
223 Should Be Equal As Integers ${rc} 0
224 Log ${output1}
225 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000226
227Check logical device creation and deletion
228 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
229 ... logical device, flows, ports
230 [Tags] VOL-2416 VOL-2417 LogicalDeviceCheck notready
Andy Bavierabeba262020-02-07 16:22:16 -0700231 [Setup] Run Keywords Announce Message START TEST LogicalDeviceCheck
232 ... AND Start Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700233 [Teardown] Run Keywords Collect Logs
Andy Bavierabeba262020-02-07 16:22:16 -0700234 ... AND Stop Logging LogicalDeviceCheck
Andy Bavier4a8450e2020-02-04 08:58:37 -0700235 ... AND Announce Message END TEST LogicalDeviceCheck
suraj goura4166222020-02-03 12:09:11 +0000236 Delete Device and Verify
237 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
238 Should Be Empty ${logical_id}
239 Run Keyword If ${has_dataplane} Sleep 180s
240 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
241 Set Suite Variable ${olt_device_id}
242 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
243 ... ${EMPTY} ${olt_device_id}
244 Enable Device ${olt_device_id}
245 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
246 ... ${olt_serial_number}
247 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
248 Should Not Be Empty ${logical_id}
249 ${rc} ${output}= Run and Return Rc and Output
250 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
251 Should Be Equal As Integers ${rc} 0
252 Log ${output}
253 Should Contain ${output} ${olt_device_id}
254 Set Suite Variable ${logical_id}
255 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
256 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
257 Run Keyword and Ignore Error Collect Logs