blob: 950a696d4b73068aa2e52811db04f7eea220850f [file] [log] [blame]
Hardik Windlassa3d04b92020-02-17 15:06:05 +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 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
Suchitra Vemuri77f7abf2020-06-19 15:52:25 -070034Resource ../../libraries/power_switch.robot
Hardik Windlassa3d04b92020-02-17 15:06:05 +000035
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 Windlassa3d04b92020-02-17 15:06:05 +000052${teardown_device} False
53${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
58*** Test Cases ***
Suchitra Vemuri77f7abf2020-06-19 15:52:25 -070059Reboot ONUs Physically
60 [Documentation] This test reboots ONUs physically before execution all the tests
61 ... Test case runs only on the PODs that are configured with PowerSwitch that
62 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
Hardik Windlassb6dffed2020-06-29 20:37:05 +053063 [Tags] functionalDt PowerSwitch RebootAllONUs
Suchitra Vemuri77f7abf2020-06-19 15:52:25 -070064 [Setup] Start Logging RebootAllONUs
65 [Teardown] Run Keywords Collect Logs
66 ... AND Stop Logging RebootAllONUs
67 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
68 FOR ${I} IN RANGE 0 ${num_onus}
69 ${src}= Set Variable ${hosts.src[${I}]}
70 Disable Switch Outlet ${src['power_switch_port']}
71 Sleep 60s
72 Enable Switch Outlet ${src['power_switch_port']}
73 Sleep 60s
74 END
75
Hardik Windlassa3d04b92020-02-17 15:06:05 +000076Sanity E2E Test for OLT/ONU on POD for DT
77 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
78 ... Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
79 ... Traffic sent with same vlan from different RGs,
80 ... should reach the NNI port on the OLT with the expected double tagged vlan ids
81 ... Inner vlans from the RG should not change
Suchitra Vemurif2388ad2020-03-15 21:44:44 -070082 [Tags] sanityDt
Hardik Windlassa3d04b92020-02-17 15:06:05 +000083 [Setup] Run Keywords Announce Message START TEST SanityTestDt
84 ... AND Start Logging SanityTestDt
85 ... AND Setup
86 [Teardown] Run Keywords Collect Logs
87 ... AND Stop Logging SanityTestDt
88 ... AND Announce Message END TEST SanityTestDt
89 Run Keyword If ${has_dataplane} Clean Up Linux
90 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
91
Hardik Windlass35706ba2020-02-20 08:16:42 +000092Test Subscriber Delete and Add for DT
93 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
Hardik Windlass63d5e002020-03-06 21:07:09 +053094 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
Hardik Windlass35706ba2020-02-20 08:16:42 +000095 ... Delete a subscriber and validate that the pings do not succeed and state is purged
96 ... Disable and Enable the ONU (This is to replicate the existing DT behaviour)
97 ... Re-add the subscriber, and validate that the flows are present and pings are successful
Suchitra Vemurif2388ad2020-03-15 21:44:44 -070098 [Tags] functionalDt SubAddDeleteDt
Hardik Windlass35706ba2020-02-20 08:16:42 +000099 [Setup] Run Keywords Announce Message START TEST SubAddDeleteDt
100 ... AND Start Logging SubAddDeleteDt
101 [Teardown] Run Keywords Collect Logs
102 ... AND Stop Logging SubAddDeleteDt
103 ... AND Announce Message END TEST SubAddDeleteDt
104 FOR ${I} IN RANGE 0 ${num_onus}
105 ${src}= Set Variable ${hosts.src[${I}]}
106 ${dst}= Set Variable ${hosts.dst[${I}]}
107 ${onu_device_id}= Get Device ID From SN ${src['onu']}
108 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
109 ... ${of_id}
110 # Remove Subscriber Access
ubuntu6b6e7d42020-03-02 12:35:42 -0800111 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Hardik Windlass35706ba2020-02-20 08:16:42 +0000112 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
113 Sleep 10s
Hardik Windlass59a759f2020-03-26 14:49:01 +0530114 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlass35706ba2020-02-20 08:16:42 +0000115 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
116 ... Wait Until Keyword Succeeds 60s 2s
117 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
118 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlass59a759f2020-03-26 14:49:01 +0530119 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
120 ${onos_flows_count}= Evaluate 4 * ( ${num_onus} - 1 )
121 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
122 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassf187a872020-03-30 20:05:19 +0530123 ... ${of_id} ${onos_flows_count}
Hardik Windlass35706ba2020-02-20 08:16:42 +0000124 # Verify VOLTHA flows for OLT equals twice the number of ONUS (minus ONU under test) + 1 for LLDP
125 ${olt_flows}= Evaluate 2 * ( ${num_onus} - 1 ) + 1
126 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
127 # Verify VOLTHA flows for ONU under test is Zero
128 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate Device Flows
129 ... ${onu_device_id} 0
130 # Disable and Re-Enable the ONU (To replicate DT current workflow)
131 # TODO: Delete and Auto-Discovery Add of ONU (not yet supported)
132 Disable Device ${onu_device_id}
133 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
134 ... Validate Device DISABLED UNKNOWN
135 ... REACHABLE ${src['onu']}
136 Enable Device ${onu_device_id}
137 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
138 ... Validate Device ENABLED ACTIVE
139 ... REACHABLE ${src['onu']}
140 # Add Subscriber Access
ubuntu6b6e7d42020-03-02 12:35:42 -0800141 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
Hardik Windlass35706ba2020-02-20 08:16:42 +0000142 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
143 Sleep 10s
Hardik Windlass59a759f2020-03-26 14:49:01 +0530144 # Verify subscriber access flows are added for the ONU port
145 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlassf187a872020-03-30 20:05:19 +0530146 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
147 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlass35706ba2020-02-20 08:16:42 +0000148 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
149 ... Validate Device ENABLED ACTIVE
150 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass59a759f2020-03-26 14:49:01 +0530151 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlass35706ba2020-02-20 08:16:42 +0000152 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
153 ... Wait Until Keyword Succeeds 60s 2s
154 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
155 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
156 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
157 Run Keyword and Ignore Error Collect Logs
158 END
Hardik Windlass59a759f2020-03-26 14:49:01 +0530159 # Verify ONOS Flows
160 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
161 ${onos_flows_count}= Evaluate 4 * ${num_onus}
162 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlassf187a872020-03-30 20:05:19 +0530163 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
164 ... ${of_id} ${onos_flows_count}
Hardik Windlass59a759f2020-03-26 14:49:01 +0530165 # Verify VOLTHA Flows
Hardik Windlass35706ba2020-02-20 08:16:42 +0000166 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
167 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
168 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
169 ${onu_flows}= Set Variable 2
170 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
171 ${List_ONU_Serial} Create List
172 Set Suite Variable ${List_ONU_Serial}
173 Build ONU SN List ${List_ONU_Serial}
174 Log ${List_ONU_Serial}
175 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
176 ... ${List_ONU_Serial} ${onu_flows}
177
Hardik Windlass63d5e002020-03-06 21:07:09 +0530178Test Disable and Enable ONU for DT
179 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
180 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
181 ... Perform disable on the ONUs and validate that the pings do not succeed
182 ... Perform enable on the ONUs and validate that the pings are successful
Suchitra Vemurif2388ad2020-03-15 21:44:44 -0700183 [Tags] functionalDt DisableEnableONUDt
Hardik Windlass63d5e002020-03-06 21:07:09 +0530184 [Setup] Run Keywords Announce Message START TEST DisableEnableONUDt
185 ... AND Start Logging DisableEnableONUDt
186 [Teardown] Run Keywords Collect Logs
187 ... AND Stop Logging DisableEnableONUDt
188 ... AND Announce Message END TEST DisableEnableONUDt
189 FOR ${I} IN RANGE 0 ${num_onus}
190 ${src}= Set Variable ${hosts.src[${I}]}
191 ${dst}= Set Variable ${hosts.dst[${I}]}
192 ${onu_device_id}= Get Device ID From SN ${src['onu']}
193 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
194 ... ${of_id}
195 Disable Device ${onu_device_id}
196 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
197 ... Validate Device DISABLED UNKNOWN
198 ... REACHABLE ${src['onu']} onu=True onu_reason=omci-admin-lock
199 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri1ed9be72020-06-18 11:22:18 -0700200 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass59a759f2020-03-26 14:49:01 +0530201 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlass63d5e002020-03-06 21:07:09 +0530202 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
203 ... Wait Until Keyword Succeeds 60s 2s
204 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
205 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
206 Sleep 5s
207 Enable Device ${onu_device_id}
208 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
209 ... Validate Device ENABLED ACTIVE
210 ... REACHABLE ${src['onu']} onu=True onu_reason=onu-reenabled
211 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri1ed9be72020-06-18 11:22:18 -0700212 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlass59a759f2020-03-26 14:49:01 +0530213 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlass63d5e002020-03-06 21:07:09 +0530214 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
215 ... Wait Until Keyword Succeeds 60s 2s
216 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
217 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
218 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
219 Run Keyword and Ignore Error Collect Logs
220 END
221
Hardik Windlassaaea3402020-03-10 19:45:45 +0530222Test Disable and Delete OLT for DT
223 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
224 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
225 ... Perform disable on the OLT and validate ONUs state and that the pings do not succeed
226 ... Perform delete on the OLT, Re-do Setup (Recreate the OLT) and Perform Sanity Test DT
Suchitra Vemurif2388ad2020-03-15 21:44:44 -0700227 [Tags] functionalDt DisableDeleteOLTDt
Hardik Windlassaaea3402020-03-10 19:45:45 +0530228 [Setup] Run Keywords Announce Message START TEST DisableDeleteOLTDt
229 ... AND Start Logging DisableDeleteOLTDt
230 [Teardown] Run Keywords Collect Logs
231 ... AND Stop Logging DisableDeleteOLTDt
232 ... AND Announce Message END TEST DisableDeleteOLTDt
233 # Disable and Validate OLT Device
234 Disable Device ${olt_device_id}
235 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
236 ... Validate OLT Device DISABLED UNKNOWN REACHABLE
237 ... ${olt_serial_number}
238 # Validate ONUs
239 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONUs After OLT Disable
Hardik Windlass59a759f2020-03-26 14:49:01 +0530240 # Verify ONOS Flows
241 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
242 ${onos_flows_count}= Evaluate 4 * ${num_onus}
243 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlassf187a872020-03-30 20:05:19 +0530244 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
245 ... ${of_id} ${onos_flows_count}
Hardik Windlass59a759f2020-03-26 14:49:01 +0530246 # Verify VOLTHA Flows
Hardik Windlassaaea3402020-03-10 19:45:45 +0530247 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
248 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
249 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
250 ${onu_flows}= Set Variable 2
251 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
252 ${List_ONU_Serial} Create List
253 Set Suite Variable ${List_ONU_Serial}
254 Build ONU SN List ${List_ONU_Serial}
255 Log ${List_ONU_Serial}
256 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
257 ... ${List_ONU_Serial} ${onu_flows}
258 # Delete OLT and Validate Empty Device List
259 Delete Device ${olt_device_id}
260 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Test Empty Device List
Hardik Windlassb80b25b2020-04-02 20:14:14 +0530261 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
262 ... Verify Device Flows Removed ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530263 Run Keyword and Ignore Error Collect Logs
264 # Re-do Setup (Recreate the OLT) and Perform Sanity Test DT
265 Run Keyword Setup
266 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
Suchitra Vemuriae9cecb2020-03-12 12:59:14 -0700267 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlassaaea3402020-03-10 19:45:45 +0530268
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000269*** Keywords ***
270Setup Suite
271 [Documentation] Set up the test suite
272 Common Test Suite Setup
Hung-Wei Chiu228d7ae2020-05-29 22:16:56 +0000273 #Restore all ONUs
Hung-Wei Chiu5a2a55f2020-06-19 10:29:53 -0700274 #Run Keyword If ${has_dataplane} RestoreONUs ${num_onus}
Suchitra Vemuri77f7abf2020-06-19 15:52:25 -0700275 ${switch_type}= Get Variable Value ${web_power_switch.type}
276 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
277
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000278
279Clear All Devices Then Create New Device
280 [Documentation] Remove any devices from VOLTHA and ONOS
281 # Remove all devices from voltha and nos
282 Delete All Devices and Verify
283 # Execute normal test Setup Keyword
284 Setup
285