blob: 6f4b76b4585e3daf3294c10bf95b1442c7d5d670 [file] [log] [blame]
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -07001# 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 functional end-to-end scenarios for TT workflow
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite 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
34Resource ../../libraries/power_switch.robot
35
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
41${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
42${HELM_CHARTS_DIR} ~/helm-charts
43${VOLTHA_POD_NUM} 8
44${NAMESPACE} voltha
45# For below variable value, using deployment name as using grep for
46# parsing radius pod name, we can also use full radius pod name
47${RESTART_POD_NAME} radius
48${timeout} 60s
49${of_id} 0
50${logical_id} 0
51${has_dataplane} True
Hardik Windlass04896f62021-03-05 16:15:11 +053052${teardown_device} True
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070053${scripts} ../../scripts
54
55# Per-test logging on failure is turned off by default; set this variable to enable
56${container_log_dir} ${None}
57
Matteo Scandoloda1c64b2021-07-20 10:14:49 -070058# logging flag to enable Collect Logs, can be passed via the command line too
59# example: -v logging:False
60${logging} True
61
Emrehan UZUN62748282021-05-21 08:16:52 +000062${suppressaddsubscriber} True
63
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070064*** Test Cases ***
65Reboot TT ONUs Physically - Clean Up
66 [Documentation] This test reboots ONUs physically before execution all the tests
67 ... Test case runs only on the PODs that are configured with PowerSwitch that
68 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +000069 [Tags] functionalTT PowerSwitch RebootAllTTONUs
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070070 [Setup] Start Logging RebootAllTTONUs
71 [Teardown] Run Keywords Collect Logs
72 ... AND Stop Logging RebootAllTTONUs
73 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
Suchitra Vemuri7255c002020-11-09 11:44:36 -080074 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070075 ${src}= Set Variable ${hosts.src[${I}]}
76 ${dst}= Set Variable ${hosts.dst[${I}]}
77 Disable Switch Outlet ${src['power_switch_port']}
TorstenThieme2ed10502021-03-22 18:01:50 +000078 Sleep 10s
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070079 Enable Switch Outlet ${src['power_switch_port']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070080 END
81
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -070082Sanity E2E Test for TT (HSIA, VoD, VoIP)
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070083 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
84 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
85 ... Traffic sent with same vlan from different RGs,
86 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
87 ... Inner vlans from the RG should not change
88 [Tags] sanityTT
89 [Setup] Run Keywords Start Logging SanityTestTT
90 ... AND Setup
91 [Teardown] Run Keywords Collect Logs
92 ... AND Stop Logging SanityTestTT
93 Run Keyword If ${has_dataplane} Clean Up Linux
94 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
Suchitra Vemuri32dea012020-07-08 16:40:06 -070095 #Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070096
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -070097Sanity E2E Test for TT (MCAST)
98 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
99 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
100 ... Traffic sent with same vlan from different RGs,
101 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
102 ... Inner vlans from the RG should not change
103 [Tags] sanityTT-MCAST
104 [Setup] Run Keyword Start Logging SanityTestTT-MCAST
105 [Teardown] Run Keywords Collect Logs
106 ... AND Stop Logging SanityTestTT-MCAST
107 Run Keyword If ${has_dataplane} Clean Up Linux
108 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT MCAST
109
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000110Test Disable and Delete OLT for TT
111 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
112 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTt test was executed)
113 ... Perform disable on the OLT and validate ONUs state and that the pings do not succeed
114 ... Perform delete on the OLT, Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000115 [Tags] functionalTT DisableDeleteOLTTt
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000116 [Setup] Start Logging DisableDeleteOLTTt
117 [Teardown] Run Keywords Collect Logs
118 ... AND Stop Logging DisableDeleteOLTTt
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000119 @{particular_onu_device_port}= Create List
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000120 FOR ${I} IN RANGE 0 ${num_all_onus}
121 ${src}= Set Variable ${hosts.src[${I}]}
122 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
123 ... ${of_id} ${src['uni_id']}
124 Append To List ${particular_onu_device_port} ${onu_port}
125 END
126 ${list_onu_port}= Remove Duplicates ${particular_onu_device_port}
127 ${num_of_provisioned_onus}= Get Length ${list_onu_port}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000128 # Disable and Validate OLT Device
129 FOR ${I} IN RANGE 0 ${olt_count}
130 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
131 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
132 Disable Device ${olt_device_id}
133 ${of_id}= Get ofID From OLT List ${olt_serial_number}
134 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
135 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
136 ... ${olt_serial_number}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000137 ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
138 # Validate ONUs
139 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONUs After OLT Disable
140 ... ${num_onus} ${olt_serial_number}
141 # Verify ONOS Flows
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000142 # Number of Access Flows on ONOS equals 16 * the Number of Active ONUs + 3 for default LLDP, IGMP and DHCP
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000143 ${onos_flows_count}= Run Keyword If ${has_dataplane} Evaluate 16 * ${num_of_provisioned_onus} + 3
144 ... ELSE Evaluate 15 * ${num_of_provisioned_onus} + 3
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000145 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000146 ... Verify Added Flow Count for OLT TT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
147 ... ${onos_flows_count}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000148 # Verify VOLTHA Flows
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000149 # Number of per OLT Flows equals 10 * Number of Active ONUs + 3 for default LLDP, IGMP and DHCP
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000150 ${olt_flows}= Run Keyword If ${has_dataplane} Evaluate 10 * ${num_of_provisioned_onus} + 3
151 ... ELSE Evaluate 9 * ${num_of_provisioned_onus} + 3
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000152 # Number of per ONU Flows equals 6 for 3play service data plane + 4 for Trap to Host Flows
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000153 ${onu_flows}= Run Keyword If ${has_dataplane} Set Variable 10
154 ... ELSE Set Variable 9
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000155 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
156 ... ${olt_device_id}
157 ${List_ONU_Serial} Create List
158 Set Suite Variable ${List_ONU_Serial}
159 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number} ${num_onus}
160 Log ${List_ONU_Serial}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000161 # TODO: Fix ${onu_flows} calculations based on UNIs provisioned
162 # Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
163 # ... ${List_ONU_Serial} ${onu_flows}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000164 # Delete OLT and Validate Empty Device List
165 Delete Device ${olt_device_id}
166 # Check that the OLT and the ONUs are actually removed from the system
167 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
168 ... ${olt_serial_number}
169 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
170 ... ${olt_serial_number} ${timeout}
171 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
172 ... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
173 END
174 # Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
175 Run Keyword Setup
176 Run Keyword If ${has_dataplane} Clean Up Linux
177 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
178
Emrehan UZUN62748282021-05-21 08:16:52 +0000179Verify re-provisioning subscriber after removing provisoned subscriber for TT
180 [Documentation] Removing/Readding a particular subscriber should have no effect on any other subscriber.
181 [Tags] functionalTT Readd-subscriber-TT
182 [Setup] Start Logging Readd-subscriber-TT
183 [Teardown] Run Keywords Collect Logs
184 ... AND Stop Logging Readd-subscriber-TT
185 Run Keyword If ${has_dataplane} Clean Up Linux
186 FOR ${I} IN RANGE 0 ${num_all_onus}
187 ${src}= Set Variable ${hosts.src[${I}]}
188 ${dst}= Set Variable ${hosts.dst[${I}]}
189 ${service_type}= Get Variable Value ${src['service_type']} "null"
190 ${of_id}= Get ofID From OLT List ${src['olt']}
191 ${onu_device_id}= Get Device ID From SN ${src['onu']}
192 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000193 ... ${of_id} ${src['uni_id']}
Emrehan UZUN62748282021-05-21 08:16:52 +0000194 # Remove Subscriber Access
TorstenThieme4e2168e2021-06-22 14:01:47 +0000195 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Emrehan UZUN62748282021-05-21 08:16:52 +0000196 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
197 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
198 ... Wait Until Keyword Succeeds ${timeout} 2s
199 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
200 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
201 # Verify VOLTHA flows for ONU under test is Zero
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000202 # TODO: Fix ${onu_flows} calculations based on UNIs provisioned
203 # Wait Until Keyword Succeeds ${timeout} 5s Validate Device Flows
204 # ... ${onu_device_id} 0
Emrehan UZUN62748282021-05-21 08:16:52 +0000205 # Add Subscriber Access
TorstenThieme4e2168e2021-06-22 14:01:47 +0000206 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Emrehan UZUN62748282021-05-21 08:16:52 +0000207 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
208 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
209 ... Validate Device ENABLED ACTIVE
210 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-flows-pushed
211 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
212 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT one ONU ${src}
213 ... ${dst} ${suppressaddsubscriber}
214 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
215 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
216 ... ${dst} ${suppressaddsubscriber}
217 END
218
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000219Test Disable and Enable ONU for TT
220 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
221 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanitytt test was executed)
222 ... Perform disable on the ONUs and validate that the pings do not succeed
223 ... Perform enable on the ONUs and validate that the pings are successful
224 [Tags] functionalTT DisableEnableONUTT
225 [Setup] Start Logging DisableEnableONUTT
226 [Teardown] Run Keywords Collect Logs
227 ... AND Stop Logging DisableEnableONUTT
228 FOR ${I} IN RANGE 0 ${num_all_onus}
229 ${src}= Set Variable ${hosts.src[${I}]}
230 ${dst}= Set Variable ${hosts.dst[${I}]}
231 ${service_type}= Get Variable Value ${src['service_type']} "null"
232 ${of_id}= Get ofID From OLT List ${src['olt']}
233 ${onu_device_id}= Get Device ID From SN ${src['onu']}
234 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000235 ... ${of_id} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000236 Disable Device ${onu_device_id}
237 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
238 ... Validate Device DISABLED UNKNOWN
239 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-admin-lock
240 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000241 ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000242 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
243 ... Wait Until Keyword Succeeds 60s 2s
244 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
245 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
246 Sleep 5s
247 Enable Device ${onu_device_id}
248 Run Keyword If ${has_dataplane} and '${service_type}' == 'mcast' Clean Up Linux
249 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000250 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000251 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
252 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT one ONU ${src}
253 ... ${dst} ${suppressaddsubscriber}
254 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
255 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
256 ... ${dst} ${suppressaddsubscriber}
257 END
258
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700259*** Keywords ***
260Setup Suite
261 [Documentation] Set up the test suite
262 Common Test Suite Setup
263 ${switch_type}= Get Variable Value ${web_power_switch.type}
264 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
265
266
267Clear All Devices Then Create New Device
268 [Documentation] Remove any devices from VOLTHA and ONOS
269 # Remove all devices from voltha and nos
270 Delete All Devices and Verify
271 # Execute normal test Setup Keyword
272 Setup
273
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700274
275Teardown Suite
276 [Documentation] Tear down steps for the suite
277 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass04896f62021-03-05 16:15:11 +0530278 Run Keyword If ${teardown_device} Delete All Devices And Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000279 Close All ONOS SSH Connections