blob: 41a306cbeed95b7d02ea9f6b8f3f3a6e5d0cfb4d [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
Hardik Windlass4288c6a2021-09-28 07:22:06 +000045${INFRA_NAMESPACE} default
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070046# For below variable value, using deployment name as using grep for
47# parsing radius pod name, we can also use full radius pod name
48${RESTART_POD_NAME} radius
49${timeout} 60s
50${of_id} 0
51${logical_id} 0
52${has_dataplane} True
Hardik Windlass04896f62021-03-05 16:15:11 +053053${teardown_device} True
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070054${scripts} ../../scripts
55
56# Per-test logging on failure is turned off by default; set this variable to enable
57${container_log_dir} ${None}
58
Matteo Scandoloda1c64b2021-07-20 10:14:49 -070059# logging flag to enable Collect Logs, can be passed via the command line too
60# example: -v logging:False
61${logging} True
62
Emrehan UZUN62748282021-05-21 08:16:52 +000063${suppressaddsubscriber} True
64
Hardik Windlassb1bda362021-11-24 11:54:36 +000065# flag to choose the subscriber provisioning command type in ONOS
66# TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other.
67# if set to True, command used is "volt-add-subscriber-unitag"
68# if set to False, comand used is "volt-add-subscriber-access"
69${unitag_sub} False
70
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070071*** Test Cases ***
72Reboot TT ONUs Physically - Clean Up
73 [Documentation] This test reboots ONUs physically before execution all the tests
74 ... Test case runs only on the PODs that are configured with PowerSwitch that
75 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +000076 [Tags] functionalTT PowerSwitch RebootAllTTONUs
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070077 [Setup] Start Logging RebootAllTTONUs
78 [Teardown] Run Keywords Collect Logs
79 ... AND Stop Logging RebootAllTTONUs
80 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
Suchitra Vemuri7255c002020-11-09 11:44:36 -080081 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070082 ${src}= Set Variable ${hosts.src[${I}]}
83 ${dst}= Set Variable ${hosts.dst[${I}]}
84 Disable Switch Outlet ${src['power_switch_port']}
TorstenThieme2ed10502021-03-22 18:01:50 +000085 Sleep 10s
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070086 Enable Switch Outlet ${src['power_switch_port']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070087 END
88
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -070089Sanity E2E Test for TT (HSIA, VoD, VoIP)
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070090 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
91 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
92 ... Traffic sent with same vlan from different RGs,
93 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
94 ... Inner vlans from the RG should not change
95 [Tags] sanityTT
96 [Setup] Run Keywords Start Logging SanityTestTT
97 ... AND Setup
98 [Teardown] Run Keywords Collect Logs
99 ... AND Stop Logging SanityTestTT
100 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000101 Perform Sanity Test TT
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700102
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700103Sanity E2E Test for TT (MCAST)
104 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
105 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
106 ... Traffic sent with same vlan from different RGs,
107 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
108 ... Inner vlans from the RG should not change
109 [Tags] sanityTT-MCAST
110 [Setup] Run Keyword Start Logging SanityTestTT-MCAST
111 [Teardown] Run Keywords Collect Logs
112 ... AND Stop Logging SanityTestTT-MCAST
113 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000114 Perform Sanity Test TT MCAST
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700115
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000116Test Disable and Delete OLT for TT
117 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
118 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTt test was executed)
119 ... Perform disable on the OLT and validate ONUs state and that the pings do not succeed
120 ... Perform delete on the OLT, Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000121 [Tags] functionalTT DisableDeleteOLTTt
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000122 [Setup] Start Logging DisableDeleteOLTTt
123 [Teardown] Run Keywords Collect Logs
124 ... AND Stop Logging DisableDeleteOLTTt
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000125 @{particular_onu_device_port}= Create List
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000126 FOR ${I} IN RANGE 0 ${num_all_onus}
127 ${src}= Set Variable ${hosts.src[${I}]}
128 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
129 ... ${of_id} ${src['uni_id']}
130 Append To List ${particular_onu_device_port} ${onu_port}
131 END
132 ${list_onu_port}= Remove Duplicates ${particular_onu_device_port}
133 ${num_of_provisioned_onus}= Get Length ${list_onu_port}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000134 # Disable and Validate OLT Device
135 FOR ${I} IN RANGE 0 ${olt_count}
136 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
137 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
138 Disable Device ${olt_device_id}
139 ${of_id}= Get ofID From OLT List ${olt_serial_number}
140 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
141 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
142 ... ${olt_serial_number}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000143 ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
144 # Validate ONUs
145 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONUs After OLT Disable
146 ... ${num_onus} ${olt_serial_number}
147 # Verify ONOS Flows
Hardik Windlass3a294892021-11-23 17:05:29 +0000148 # When we disable the device should only have 3 default flows LLDP, IGMP and DHCP
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000149 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass3a294892021-11-23 17:05:29 +0000150 ... Verify Added Flow Count for OLT TT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} 3
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000151 # Verify VOLTHA Flows
Hardik Windlass3a294892021-11-23 17:05:29 +0000152 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows 3
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000153 ... ${olt_device_id}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000154 # Delete OLT and Validate Empty Device List
155 Delete Device ${olt_device_id}
156 # Check that the OLT and the ONUs are actually removed from the system
157 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
158 ... ${olt_serial_number}
159 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
160 ... ${olt_serial_number} ${timeout}
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000161 Wait Until Keyword Succeeds ${timeout} 5s
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000162 ... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
163 END
164 # Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
165 Run Keyword Setup
166 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000167 Perform Sanity Tests TT
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000168
Emrehan UZUN62748282021-05-21 08:16:52 +0000169Verify re-provisioning subscriber after removing provisoned subscriber for TT
170 [Documentation] Removing/Readding a particular subscriber should have no effect on any other subscriber.
171 [Tags] functionalTT Readd-subscriber-TT
172 [Setup] Start Logging Readd-subscriber-TT
173 [Teardown] Run Keywords Collect Logs
174 ... AND Stop Logging Readd-subscriber-TT
175 Run Keyword If ${has_dataplane} Clean Up Linux
176 FOR ${I} IN RANGE 0 ${num_all_onus}
177 ${src}= Set Variable ${hosts.src[${I}]}
178 ${dst}= Set Variable ${hosts.dst[${I}]}
179 ${service_type}= Get Variable Value ${src['service_type']} "null"
180 ${of_id}= Get ofID From OLT List ${src['olt']}
181 ${onu_device_id}= Get Device ID From SN ${src['onu']}
182 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000183 ... ${of_id} ${src['uni_id']}
Emrehan UZUN62748282021-05-21 08:16:52 +0000184 # Remove Subscriber Access
Hardik Windlassb1bda362021-11-24 11:54:36 +0000185 ${del_sub_cmd}= Run Keyword If ${unitag_sub}
186 ... Catenate volt-remove-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
187 ... --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
188 ... ELSE
189 ... Set Variable volt-remove-subscriber-access ${of_id} ${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000190 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Hardik Windlassb1bda362021-11-24 11:54:36 +0000191 ... ${ONOS_SSH_PORT} ${del_sub_cmd}
Emrehan UZUN62748282021-05-21 08:16:52 +0000192 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000193 ... Wait Until Keyword Succeeds ${timeout} 5s
Emrehan UZUN62748282021-05-21 08:16:52 +0000194 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
195 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Girish Gowdrab1ef7932021-10-29 10:57:47 -0700196 ... ELSE Sleep 10s Wait for flows to be deleted
Emrehan UZUN62748282021-05-21 08:16:52 +0000197 # Verify VOLTHA flows for ONU under test is Zero
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000198 # TODO: Fix ${onu_flows} calculations based on UNIs provisioned
199 # Wait Until Keyword Succeeds ${timeout} 5s Validate Device Flows
200 # ... ${onu_device_id} 0
Emrehan UZUN62748282021-05-21 08:16:52 +0000201 # Add Subscriber Access
Hardik Windlassb1bda362021-11-24 11:54:36 +0000202 ${add_sub_cmd}= Run Keyword If ${unitag_sub}
203 ... Catenate volt-add-subscriber-unitag --tpId ${src['tp_id']} --sTag ${src['s_tag']}
204 ... --cTag ${src['c_tag']} ${src['onu']}-${src['uni_id']}
205 ... ELSE
206 ... Set Variable volt-add-subscriber-access ${of_id} ${onu_port}
TorstenThieme4e2168e2021-06-22 14:01:47 +0000207 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Hardik Windlassb1bda362021-11-24 11:54:36 +0000208 ... ${ONOS_SSH_PORT} ${add_sub_cmd}
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000209 Wait Until Keyword Succeeds ${timeout} 5s
Emrehan UZUN62748282021-05-21 08:16:52 +0000210 ... Validate Device ENABLED ACTIVE
211 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass5a2d1f42021-11-12 12:52:04 +0000212 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000213 ... Sanity Test TT one ONU ${src} ${dst} ${suppressaddsubscriber}
Hardik Windlass5a2d1f42021-11-12 12:52:04 +0000214 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast'
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000215 ... Sanity Test TT MCAST one ONU ${src} ${dst} ${suppressaddsubscriber}
Emrehan UZUN62748282021-05-21 08:16:52 +0000216 END
217
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000218Test Disable and Enable ONU for TT
219 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
220 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanitytt test was executed)
221 ... Perform disable on the ONUs and validate that the pings do not succeed
222 ... Perform enable on the ONUs and validate that the pings are successful
223 [Tags] functionalTT DisableEnableONUTT
224 [Setup] Start Logging DisableEnableONUTT
225 [Teardown] Run Keywords Collect Logs
226 ... AND Stop Logging DisableEnableONUTT
227 FOR ${I} IN RANGE 0 ${num_all_onus}
228 ${src}= Set Variable ${hosts.src[${I}]}
229 ${dst}= Set Variable ${hosts.dst[${I}]}
230 ${service_type}= Get Variable Value ${src['service_type']} "null"
231 ${of_id}= Get ofID From OLT List ${src['olt']}
232 ${onu_device_id}= Get Device ID From SN ${src['onu']}
233 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000234 ... ${of_id} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000235 Disable Device ${onu_device_id}
236 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
237 ... Validate Device DISABLED UNKNOWN
238 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-admin-lock
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000239 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000240 ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000241 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000242 ... Wait Until Keyword Succeeds ${timeout} 2s
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000243 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
244 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
245 Sleep 5s
246 Enable Device ${onu_device_id}
Girish Gowdrafc0bdf22021-12-06 16:57:50 +0530247 Wait Until Keyword Succeeds ${timeout} 2s
248 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
249 # Workaround for issue seen in VOL-4489. Keep this workaround until VOL-4489 is fixed.
250 Run Keyword If ${has_dataplane} Reboot XGSPON ONU ${src['olt']} ${src['onu']} omci-flows-pushed
251 # Workaround ends here for issue seen in VOL-4489.
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000252 Run Keyword If ${has_dataplane} and '${service_type}' == 'mcast' Clean Up Linux
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000253 Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000254 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Hardik Windlass5a2d1f42021-11-12 12:52:04 +0000255 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000256 ... Sanity Test TT one ONU ${src} ${dst} ${suppressaddsubscriber}
Hardik Windlass5a2d1f42021-11-12 12:52:04 +0000257 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast'
Hardik Windlass5083b3a2021-11-11 12:16:22 +0000258 ... Sanity Test TT MCAST one ONU ${src} ${dst} ${suppressaddsubscriber}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000259 END
260
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700261*** Keywords ***
262Setup Suite
263 [Documentation] Set up the test suite
264 Common Test Suite Setup
265 ${switch_type}= Get Variable Value ${web_power_switch.type}
266 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
267
268
269Clear All Devices Then Create New Device
270 [Documentation] Remove any devices from VOLTHA and ONOS
271 # Remove all devices from voltha and nos
272 Delete All Devices and Verify
273 # Execute normal test Setup Keyword
274 Setup
275
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700276
277Teardown Suite
278 [Documentation] Tear down steps for the suite
Matteo Scandolo6a90bda2021-11-30 11:31:38 -0800279 Start Logging Setup or Teardown Teardown-${SUITE NAME}
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700280 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass04896f62021-03-05 16:15:11 +0530281 Run Keyword If ${teardown_device} Delete All Devices And Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000282 Close All ONOS SSH Connections
Matteo Scandolo6a90bda2021-11-30 11:31:38 -0800283 Stop Logging Setup or Teardown Teardown-${SUITE NAME}