blob: b7cdc449d296df9cbaf295d83bf80563ef73423f [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
55*** Test Cases ***
56Adding the same OLT before and after enabling the device
57 [Documentation] Create OLT, Create the same OLT again and Check for the Error message
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -080058 [Tags] VOL-2405 VOL-2406 AddSameOLT functional
Andy Bavier4a8450e2020-02-04 08:58:37 -070059 [Setup] Announce Message START TEST AddSameOLT
60 [Teardown] Run Keywords Collect Logs
61 ... AND Announce Message END TEST AddSameOLT
Suchitra Vemuribd7fcd22020-01-22 19:08:32 -080062 Run Keyword If ${has_dataplane} Delete Device and Verify
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000063 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
64 Set Suite Variable ${olt_device_id}
65 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
66 ... ${EMPTY} ${olt_device_id}
67 ${rc} ${output}= Run and Return Rc and Output
68 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
69 Should Not Be Equal As Integers ${rc} 0
70 Should Contain ${output} Device is already pre-provisioned
71 #Enable the created OLT device
72 Enable Device ${olt_device_id}
73 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
74 ... ${olt_serial_number}
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 Log ${output}
79 Should Contain ${output} Device is already pre-provisioned
80 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000081
82Test Disable different device id which is not in the device list
83 [Documentation] Disable a device id which is not listed in the voltctl device list
84 ... command and ensure that error message is shown.
Suchitra Vemuri925db9d2020-01-27 15:41:26 -080085 [Tags] functional DisableInvalidDevice VOL-2412
Andy Bavier4a8450e2020-02-04 08:58:37 -070086 [Setup] Announce Message START TEST DisableInvalidDevice
87 [Teardown] Run Keywords Collect Logs
88 ... AND Announce Message END TEST DisableInvalidDevice
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000089 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
90 Should Be Equal As Integers ${rc} 0
91 ${jsondata}= To Json ${output}
92 Log ${jsondata}
93 ${length}= Get Length ${jsondata}
94 @{ids}= Create List
95 FOR ${INDEX} IN RANGE 0 ${length}
96 ${value}= Get From List ${jsondata} ${INDEX}
97 ${device_id}= Get From Dictionary ${value} id
98 Append To List ${ids} ${device_id}
99 END
100 #Create a new fake device id
101 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
102 Log ${fakeDeviceId}
103 #Ensure that the new id created is not in the device id list
104 List Should Not Contain Value ${ids} ${fakeDeviceId}
105 #Disable fake device id
106 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuri925db9d2020-01-27 15:41:26 -0800107 Should Contain ${output} Error while disabling '${fakeDeviceId}': rpc error: code = NotFound desc
suraj gourbaee2c62020-02-03 10:21:32 +0000108
109Check deletion of OLT/ONU before disabling
110 [Documentation] Try deleting OL/ONU before disabling and check error message
111 ... Assuming devices are already created, up and running fine; test1 or sanity was
112 ... executed where all the ONUs are authenticated/DHCP/pingable
113 [Tags] VOL-2411 DeleteBeforeDisableCheck notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700114 [Setup] Announce Message START TEST DeleteBeforeDisableCheck
115 [Teardown] Run Keywords Collect Logs
116 ... AND Announce Message END TEST DeleteBeforeDisableCheck
suraj gourbaee2c62020-02-03 10:21:32 +0000117 #validate olt states
118 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
119 ... ${olt_serial_number}
120 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
121 Log ${output}
122 Should Contain ${output} expected-admin-state:DISABLED
123 Wait Until Keyword Succeeds ${timeout} 5s
124 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
125 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
126 Set Global Variable ${of_id}
127 FOR ${I} IN RANGE 0 ${num_onus}
128 ${src}= Set Variable ${hosts.src[${I}]}
129 ${dst}= Set Variable ${hosts.dst[${I}]}
130 ${onu_device_id}= Get Device ID From SN ${src['onu']}
131 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
132 ... ENABLED ACTIVE REACHABLE
133 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
134 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
135 Log ${output}
136 Should Contain ${output} expected-admin-state:DISABLED
137 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
138 ... ENABLED ACTIVE REACHABLE
139 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
140 END
141 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000142
143Check disabling of pre-provisioned OLT before enabling
144 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
145 [Tags] VOL-2414 DisablePreprovisionedOLTCheck notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700146 [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck
147 ... AND Delete Device and Verify
148 [Teardown] Run Keywords Collect Logs
149 ... AND Announce Message END TEST DisablePreprovisionedOLTCheck
suraj gourb3160412020-02-04 06:11:31 +0000150 Run Keyword If ${has_dataplane} Sleep 180s
151 #create/preprovision device
152 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
153 Set Suite Variable ${olt_device_id}
154 #validate olt states
155 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
156 ... ${EMPTY} ${olt_device_id}
157 #Try disabling pre-provisioned OLT
158 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
159 Should Be Equal As Integers ${rc} 0
160 Log ${output}
161 Should Contain ${output} invalid-admin-state:PREPROVISIONED
162 #Enable OLT
163 Enable Device ${olt_device_id}
164 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
165 ... ${olt_serial_number}
166 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
167 Set Suite Variable ${logical_id}
168 FOR ${I} IN RANGE 0 ${num_onus}
169 ${src}= Set Variable ${hosts.src[${I}]}
170 ${dst}= Set Variable ${hosts.dst[${I}]}
171 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
172 ... ENABLED ACTIVE REACHABLE
173 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
174 END
175 Run Keyword and Ignore Error Collect Logs
Hema526eceb2020-02-04 13:11:40 +0530176
177Disable and Delete the logical device directly
178 [Documentation] Disable and delete the logical device directly is not possible
179 ... since it is allowed only through OLT device deletion.
180 [Tags] VOL-2418 DisableDelete_LogicalDevice notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700181 [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice
182 ... AND Delete Device and Verify
183 [Teardown] Run Keywords Collect Logs
184 ... AND Announce Message END TEST DisableDelete_LogicalDevice
Hema526eceb2020-02-04 13:11:40 +0530185 Run Keyword If ${has_dataplane} Sleep 180s
186 #create/preprovision OLT device
187 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
188 Set Suite Variable ${olt_device_id}
189 #validate olt states
190 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
191 ... ${EMPTY} ${olt_device_id}
192 #Enable the created OLT device
193 Enable Device ${olt_device_id}
194 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
195 ... ${olt_serial_number}
196 #Check whether logical devices are also created
197 ${rc} ${output}= Run and Return Rc and Output
198 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
199 Should Be Equal As Integers ${rc} 0
200 Log ${output}
201 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
202 Should Not Be Empty ${logical_id}
203 ${rc} ${output}= Run and Return Rc and Output
204 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id}
205 Should Be Equal As Integers ${rc} 0
206 Log ${output}
207 Should Contain '${output}' Unknown command
208 ${rc} ${output1}= Run and Return Rc and Output
209 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id}
210 Should Be Equal As Integers ${rc} 0
211 Log ${output1}
212 Should Contain '${output1}' Unknown command
suraj goura4166222020-02-03 12:09:11 +0000213
214Check logical device creation and deletion
215 [Documentation] Deletes all devices, checks logical device, creates devices again and checks
216 ... logical device, flows, ports
217 [Tags] VOL-2416 VOL-2417 LogicalDeviceCheck notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700218 [Setup] Announce Message START TEST LogicalDeviceCheck
219 [Teardown] Run Keywords Collect Logs
220 ... AND Announce Message END TEST LogicalDeviceCheck
suraj goura4166222020-02-03 12:09:11 +0000221 Delete Device and Verify
222 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
223 Should Be Empty ${logical_id}
224 Run Keyword If ${has_dataplane} Sleep 180s
225 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
226 Set Suite Variable ${olt_device_id}
227 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
228 ... ${EMPTY} ${olt_device_id}
229 Enable Device ${olt_device_id}
230 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
231 ... ${olt_serial_number}
232 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
233 Should Not Be Empty ${logical_id}
234 ${rc} ${output}= Run and Return Rc and Output
235 ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list
236 Should Be Equal As Integers ${rc} 0
237 Log ${output}
238 Should Contain ${output} ${olt_device_id}
239 Set Suite Variable ${logical_id}
240 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id}
241 Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id}
242 Run Keyword and Ignore Error Collect Logs