blob: 2bb332a24f29ea884df534e16aea25f73ea099d3 [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
Emrehan UZUN62748282021-05-21 08:16:52 +000058${suppressaddsubscriber} True
59
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070060*** Test Cases ***
61Reboot TT ONUs Physically - Clean Up
62 [Documentation] This test reboots ONUs physically before execution all the tests
63 ... Test case runs only on the PODs that are configured with PowerSwitch that
64 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +000065 [Tags] functionalTT PowerSwitch RebootAllTTONUs
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070066 [Setup] Start Logging RebootAllTTONUs
67 [Teardown] Run Keywords Collect Logs
68 ... AND Stop Logging RebootAllTTONUs
69 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
Suchitra Vemuri7255c002020-11-09 11:44:36 -080070 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070071 ${src}= Set Variable ${hosts.src[${I}]}
72 ${dst}= Set Variable ${hosts.dst[${I}]}
73 Disable Switch Outlet ${src['power_switch_port']}
TorstenThieme2ed10502021-03-22 18:01:50 +000074 Sleep 10s
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070075 Enable Switch Outlet ${src['power_switch_port']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070076 END
77
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -070078Sanity E2E Test for TT (HSIA, VoD, VoIP)
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070079 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
80 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
81 ... Traffic sent with same vlan from different RGs,
82 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
83 ... Inner vlans from the RG should not change
84 [Tags] sanityTT
85 [Setup] Run Keywords Start Logging SanityTestTT
86 ... AND Setup
87 [Teardown] Run Keywords Collect Logs
88 ... AND Stop Logging SanityTestTT
89 Run Keyword If ${has_dataplane} Clean Up Linux
90 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
Suchitra Vemuri32dea012020-07-08 16:40:06 -070091 #Run Keyword If ${has_dataplane} Clean Up Linux
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -070092
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -070093Sanity E2E Test for TT (MCAST)
94 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
95 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
96 ... Traffic sent with same vlan from different RGs,
97 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
98 ... Inner vlans from the RG should not change
99 [Tags] sanityTT-MCAST
100 [Setup] Run Keyword Start Logging SanityTestTT-MCAST
101 [Teardown] Run Keywords Collect Logs
102 ... AND Stop Logging SanityTestTT-MCAST
103 Run Keyword If ${has_dataplane} Clean Up Linux
104 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT MCAST
105
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000106Test Disable and Delete OLT for TT
107 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
108 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTt test was executed)
109 ... Perform disable on the OLT and validate ONUs state and that the pings do not succeed
110 ... Perform delete on the OLT, Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000111 [Tags] functionalTT DisableDeleteOLTTt
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000112 [Setup] Start Logging DisableDeleteOLTTt
113 [Teardown] Run Keywords Collect Logs
114 ... AND Stop Logging DisableDeleteOLTTt
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000115 @{particular_onu_device_port}= Create List
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000116 FOR ${I} IN RANGE 0 ${num_all_onus}
117 ${src}= Set Variable ${hosts.src[${I}]}
118 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
119 ... ${of_id} ${src['uni_id']}
120 Append To List ${particular_onu_device_port} ${onu_port}
121 END
122 ${list_onu_port}= Remove Duplicates ${particular_onu_device_port}
123 ${num_of_provisioned_onus}= Get Length ${list_onu_port}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000124 # Disable and Validate OLT Device
125 FOR ${I} IN RANGE 0 ${olt_count}
126 ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn
127 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
128 Disable Device ${olt_device_id}
129 ${of_id}= Get ofID From OLT List ${olt_serial_number}
130 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
131 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
132 ... ${olt_serial_number}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000133 ${num_onus}= Set Variable ${list_olts}[${I}][onucount]
134 # Validate ONUs
135 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONUs After OLT Disable
136 ... ${num_onus} ${olt_serial_number}
137 # Verify ONOS Flows
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000138 # 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 +0000139 ${onos_flows_count}= Run Keyword If ${has_dataplane} Evaluate 16 * ${num_of_provisioned_onus} + 3
140 ... ELSE Evaluate 15 * ${num_of_provisioned_onus} + 3
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000141 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000142 ... Verify Added Flow Count for OLT TT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
143 ... ${onos_flows_count}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000144 # Verify VOLTHA Flows
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000145 # 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 +0000146 ${olt_flows}= Run Keyword If ${has_dataplane} Evaluate 10 * ${num_of_provisioned_onus} + 3
147 ... ELSE Evaluate 9 * ${num_of_provisioned_onus} + 3
Huseyin Ahmet AYDIN45922c82021-05-27 12:37:32 +0000148 # 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 +0000149 ${onu_flows}= Run Keyword If ${has_dataplane} Set Variable 10
150 ... ELSE Set Variable 9
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000151 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
152 ... ${olt_device_id}
153 ${List_ONU_Serial} Create List
154 Set Suite Variable ${List_ONU_Serial}
155 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number} ${num_onus}
156 Log ${List_ONU_Serial}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000157 # TODO: Fix ${onu_flows} calculations based on UNIs provisioned
158 # Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
159 # ... ${List_ONU_Serial} ${onu_flows}
Huseyin Ahmet AYDIN9ea27aa2021-05-20 14:32:29 +0000160 # Delete OLT and Validate Empty Device List
161 Delete Device ${olt_device_id}
162 # Check that the OLT and the ONUs are actually removed from the system
163 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed
164 ... ${olt_serial_number}
165 Run Keyword and Continue On Failure Validate all ONUS for OLT Removed ${num_all_onus} ${hosts}
166 ... ${olt_serial_number} ${timeout}
167 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
168 ... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
169 END
170 # Re-do Setup (Recreate the OLT) and Perform Sanity Test TT
171 Run Keyword Setup
172 Run Keyword If ${has_dataplane} Clean Up Linux
173 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
174
Emrehan UZUN62748282021-05-21 08:16:52 +0000175Verify re-provisioning subscriber after removing provisoned subscriber for TT
176 [Documentation] Removing/Readding a particular subscriber should have no effect on any other subscriber.
177 [Tags] functionalTT Readd-subscriber-TT
178 [Setup] Start Logging Readd-subscriber-TT
179 [Teardown] Run Keywords Collect Logs
180 ... AND Stop Logging Readd-subscriber-TT
181 Run Keyword If ${has_dataplane} Clean Up Linux
182 FOR ${I} IN RANGE 0 ${num_all_onus}
183 ${src}= Set Variable ${hosts.src[${I}]}
184 ${dst}= Set Variable ${hosts.dst[${I}]}
185 ${service_type}= Get Variable Value ${src['service_type']} "null"
186 ${of_id}= Get ofID From OLT List ${src['olt']}
187 ${onu_device_id}= Get Device ID From SN ${src['onu']}
188 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000189 ... ${of_id} ${src['uni_id']}
Emrehan UZUN62748282021-05-21 08:16:52 +0000190 # Remove Subscriber Access
TorstenThieme4e2168e2021-06-22 14:01:47 +0000191 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Emrehan UZUN62748282021-05-21 08:16:52 +0000192 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
193 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast'
194 ... Wait Until Keyword Succeeds ${timeout} 2s
195 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
196 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
197 # 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
TorstenThieme4e2168e2021-06-22 14:01:47 +0000202 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Emrehan UZUN62748282021-05-21 08:16:52 +0000203 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
204 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
205 ... Validate Device ENABLED ACTIVE
206 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-flows-pushed
207 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
208 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT one ONU ${src}
209 ... ${dst} ${suppressaddsubscriber}
210 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
211 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
212 ... ${dst} ${suppressaddsubscriber}
213 END
214
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000215Test Disable and Enable ONU for TT
216 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
217 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanitytt test was executed)
218 ... Perform disable on the ONUs and validate that the pings do not succeed
219 ... Perform enable on the ONUs and validate that the pings are successful
220 [Tags] functionalTT DisableEnableONUTT
221 [Setup] Start Logging DisableEnableONUTT
222 [Teardown] Run Keywords Collect Logs
223 ... AND Stop Logging DisableEnableONUTT
224 FOR ${I} IN RANGE 0 ${num_all_onus}
225 ${src}= Set Variable ${hosts.src[${I}]}
226 ${dst}= Set Variable ${hosts.dst[${I}]}
227 ${service_type}= Get Variable Value ${src['service_type']} "null"
228 ${of_id}= Get ofID From OLT List ${src['olt']}
229 ${onu_device_id}= Get Device ID From SN ${src['onu']}
230 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
Hardik Windlass1ed2eee2021-06-25 09:51:03 +0000231 ... ${of_id} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000232 Disable Device ${onu_device_id}
233 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
234 ... Validate Device DISABLED UNKNOWN
235 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-admin-lock
236 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000237 ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000238 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
239 ... Wait Until Keyword Succeeds 60s 2s
240 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
241 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
242 Sleep 5s
243 Enable Device ${onu_device_id}
244 Run Keyword If ${has_dataplane} and '${service_type}' == 'mcast' Clean Up Linux
245 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Hardik Windlass39015672021-07-05 05:48:08 +0000246 ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
Emrehan UZUNec59bea2021-05-27 13:45:57 +0000247 Run Keyword If ${has_dataplane} and '${service_type}' != 'mcast' Run Keyword And Continue On Failure
248 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT one ONU ${src}
249 ... ${dst} ${suppressaddsubscriber}
250 ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast' Run Keyword And Continue On Failure
251 ... Wait Until Keyword Succeeds ${timeout} 2s Sanity Test TT MCAST one ONU ${src}
252 ... ${dst} ${suppressaddsubscriber}
253 END
254
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700255*** Keywords ***
256Setup Suite
257 [Documentation] Set up the test suite
258 Common Test Suite Setup
259 ${switch_type}= Get Variable Value ${web_power_switch.type}
260 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
261
262
263Clear All Devices Then Create New Device
264 [Documentation] Remove any devices from VOLTHA and ONOS
265 # Remove all devices from voltha and nos
266 Delete All Devices and Verify
267 # Execute normal test Setup Keyword
268 Setup
269
Suchitra Vemuri32dea012020-07-08 16:40:06 -0700270
271Teardown Suite
272 [Documentation] Tear down steps for the suite
273 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass04896f62021-03-05 16:15:11 +0530274 Run Keyword If ${teardown_device} Delete All Devices And Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000275 Close All ONOS SSH Connections