blob: c282a18cbc0ebbb8fac19385e2096c9986fcbbbc [file] [log] [blame]
Hardik Windlass2013d0c2021-05-20 13:37:25 +00001# Copyright 2021 - 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
52${teardown_device} True
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# For dataplane bandwidth testing
59${lower_margin_pct} 90 # Allow 10% under the limit
Emrehan UZUNd6f85892021-07-01 13:54:26 +000060${upper_margin_pct} 120 # Allow 20% under the limit
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +000061${pon_max_bw_capacity_xgs}= 9700000 # Mbps, for xgs-pon OLT, when FEC Disabled
Hardik Windlass2013d0c2021-05-20 13:37:25 +000062
63*** Test Cases ***
Girish Gowdracb8482a2021-05-27 09:06:13 -070064Test that the BW is limited to Limiting Bandwidth
Hardik Windlass2013d0c2021-05-20 13:37:25 +000065 [Documentation] Verify support for Tcont type 1.
Girish Gowdracb8482a2021-05-27 09:06:13 -070066 ... Verify that traffic is limited to Limiting Bandwidth (eir+cir+air) configured for the service/onu.
Hardik Windlass2013d0c2021-05-20 13:37:25 +000067 ... Pump 500Mbps in the upstream from RG and verify that the received traffic is only 200Mbps at the BNG.
68 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
69 [Tags] functionalTT VOL-4093
70 [Setup] Run Keywords Start Logging TcontType1Onu1
71 ... AND Setup
72 [Teardown] Run Keywords Collect Logs
73 ... AND Stop Logging TcontType1Onu1
Hardik Windlass35db2aa2021-06-03 12:41:26 +000074 ... AND Delete All Devices and Verify
Hardik Windlass2013d0c2021-05-20 13:37:25 +000075 Run Keyword If ${has_dataplane} Clean Up Linux
76 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
77 # Find the ONU as required for this test
78 ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]}
79 ${test_onu_sn}= Set Variable ${test_onu['onu']}
80 ${test_service_type}= Set Variable ${test_onu['service_type']}
81 ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']}
82 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type}
83 ... ${test_us_bw_profile}
84 Pass Execution If '${matched}' != 'True'
85 ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}'
86 # Check for iperf3 and jq tools
87 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
88 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
89 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
Girish Gowdracb8482a2021-05-27 09:06:13 -070090 ${limiting_bw_value_upstream}= Get Limiting Bandwidth Details ${test_us_bw_profile}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000091 # Stream UDP packets from RG to server
92 ${updict}= Run Iperf3 Test Client ${src} server=${dst['dp_iface_ip_qinq']}
93 ... args=-u -b 500M -t 30 -p 5201
94 # With UDP test, bits per second is the sending rate. Multiply by the loss rate to get the throughput.
95 ${actual_upstream_bw_used}= Evaluate
96 ... (100 - ${updict['end']['sum']['lost_percent']})*${updict['end']['sum']['bits_per_second']}/100000
Girish Gowdracb8482a2021-05-27 09:06:13 -070097 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${limiting_bw_value_upstream}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000098 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
99 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000100 Should Be True ${pct_limit_up} <= ${upper_margin_pct}
101 ... The upstream bandwidth exceeded the limit (${pct_limit_up}% of limit)
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000102
Hardik Windlassd388b462021-05-27 05:40:00 +0000103Test that assured BW is allocated as needed on the PON
104 [Documentation] Verify support for Tcont type 2 and 4.
105 ... Verify that the BW from tcont type 4 is bequeathed to type2 as needed.
106 ... 1) Pump 1Gbps in the upstream from the RG for HSIA service and verify that no more than 1Gbps is received at the BNG.
107 ... 2) Pump 500Mbps from the RG for the VoD service and verify that close to 500Mbps is received at the BNG.
108 ... Also, verify that the HSI rate is now truncated to 500Mbps at BNG.
109 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
110 [Tags] functionalTT VOL-4095
111 [Setup] Run Keywords Start Logging TcontType2Type4Onu1
112 ... AND Setup
113 [Teardown] Run Keywords Collect Logs
114 ... AND Stop Logging TcontType2Type4Onu1
115 ... AND Delete All Devices and Verify
116 Run Keyword If ${has_dataplane} Clean Up Linux
117 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
118
119 # The test expects the first entry in multi_tcont_tests.tcont2tcont4 input will be for service: vod and tcont: 2
120 # The test expects the second entry in multi_tcont_tests.tcont2tcont4 input will be for service: hsia and tcont: 4
121 ${list_onus_ut}= Create List
122 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont2tcont4}
123 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
124 ${onu}= Set Variable ${multi_tcont_tests.tcont2tcont4[${I}]}
125 ${onu_sn}= Set Variable ${onu['onu']}
126 ${service}= Set Variable ${onu['service_type']}
127 ${us_bw}= Set Variable ${onu['us_bw_profile']}
128 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
129 ... ${service} ${us_bw}
130 Pass Execution If '${matched}' != 'True'
131 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
132 # Check for iperf3 and jq tools
133 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
134 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
135 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
136 # Get Upstream BW Profile details
137 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
138 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
139 Append To List ${list_onus_ut} ${onu_ut}
140 END
141
142 # Case 1: Verify only for HSIA service
143 ${dst}= Set Variable ${list_onus_ut}[1][dst]
144 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
145 ... args=-t 30 -p 5202
146 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
147 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
148 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
149 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000150 Should Be True ${pct_limit_up} <= ${upper_margin_pct}
151 ... The upstream bandwidth exceeded the limit (${pct_limit_up}% of limit)
Hardik Windlassd388b462021-05-27 05:40:00 +0000152
153 # Case 2: Verify for VOD (with index [0]) and HSIA (with index [1]) service combined
154 ${out_file_0}= Set Variable ${CURDIR}/../../tests/data/out_tcont2
155 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
156 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
157 ... args=-t 30 -p 5201 out_file=${out_file_0}
158 ${out_file_1}= Set Variable ${CURDIR}/../../tests/data/out_tcont4
159 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
160 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
161 ... args=-t 30 -p 5202 out_file=${out_file_1}
162 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
163 Sleep 35s
164 ${out_0}= Read Output File on System ${out_file_0}
165 ${out_1}= Read Output File on System ${out_file_1}
166 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
167 ${pct_limit_up_0}= Evaluate 100*${actual_upstream_bw_used_0}/${list_onus_ut}[0][limiting_bw_us]
168 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
169 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000170 Should Be True ${pct_limit_up_0} <= ${upper_margin_pct}
171 ... The upstream bandwidth exceeded the limit (${pct_limit_up_0}% of limit)
Hardik Windlassd388b462021-05-27 05:40:00 +0000172 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
173 ${pct_limit_up_1}= Evaluate
174 ... 100*${actual_upstream_bw_used_1}/(${list_onus_ut}[1][limiting_bw_us]-${list_onus_ut}[0][limiting_bw_us])
175 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
176 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000177 Should Be True ${pct_limit_up_1} <= ${upper_margin_pct}
178 ... The upstream bandwidth exceeded the limit (${pct_limit_up_1}% of limit)
Hardik Windlassd388b462021-05-27 05:40:00 +0000179
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000180Test that the AIR BW is reserved for a ONU
181 [Documentation] Verify support for Tcont type 1 + type 4 at the same time.
182 ... Verify that 8700Mbps is reserved in the upstream as AIR requirement for the VoIP service.
183 ... Pump 1Gbpbs in the upstream from the RG for HSI service, respectively ONU2, ONU3 and verify that up to 1Gbps
184 ... is received at the BNG.
185 ... Then pump ONU2 and ONU3 HSIA combined. ONUs must be share rest of bw in PON Port. (Expect fixed tcont1)
186 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
187 [Tags] functionalTT VOL-4094
188 [Setup] Run Keywords Start Logging TcontType1Type4Onu1Onu2Onu3
189 ... AND Setup
190 [Teardown] Run Keywords Collect Logs
191 ... AND Stop Logging TcontType1Type4Onu1Onu2Onu3
192 ... AND Delete All Devices and Verify
193 # Push multi-tcont sadis to ONOS
194 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
195 Run Keyword If ${has_dataplane} Clean Up Linux
196 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
197
198 # The test expects the first entry in multi_tcont_tests.tcont1tcont4 input will be for service: voip and tcont: 1
199 # The test expects the second entry in multi_tcont_tests.tcont1tcont4 input will be for service: hsia and tcont: 4
200 ${list_onus_ut}= Create List
201 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont1tcont4}
202 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
203 ${onu}= Set Variable ${multi_tcont_tests.tcont1tcont4[${I}]}
204 ${onu_sn}= Set Variable ${onu['onu']}
205 ${service}= Set Variable ${onu['service_type']}
206 ${us_bw}= Set Variable ${onu['us_bw_profile']}
207 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
208 ... ${service} ${us_bw}
209 Pass Execution If '${matched}' != 'True'
210 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
211 # Check for iperf3 and jq tools
212 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
213 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
214 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
215 # Get Upstream BW Profile details
216 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
217 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
218 Append To List ${list_onus_ut} ${onu_ut}
219 END
220
221 # Fill the OLT PON Bandwidth with Fixed Bandwidth Profile ONU
222 ${onu_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("serial")
223 ${olt_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("olt")
224 ${us_bw_profile_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("us_bw_profile")
225 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_fill_pon_bw}
226 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
227 ... Get ONU Port in ONOS ${onu_fill_pon_bw} ${of_id}
228 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
229 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
230 ... volt-add-subscriber-access ${of_id} ${onu_port}
231 Sleep 10s
232 ${limiting_bw_us_fill_pon_bw}= Get Limiting Bandwidth Details ${us_bw_profile_fill_pon_bw}
233
234 # Case 1: Verify both ONUs should be able to get 1Gbps separately when only HSIA service is available
235 ${dst}= Set Variable ${list_onus_ut}[0][dst]
236 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[0][src] server=${dst['dp_iface_ip_qinq']}
237 ... args=-t 30 -p 5202
238 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
239 ${pct_limit_up}= Evaluate
240 ... 100*${actual_upstream_bw_used}/${list_onus_ut}[0][limiting_bw_us]
241 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
242 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
243
244 ${dst}= Set Variable ${list_onus_ut}[1][dst]
245 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
246 ... args=-t 30 -p 5202
247 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
248 ${pct_limit_up}= Evaluate
249 ... 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
250 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
251 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000252 Should Be True ${pct_limit_up} <= ${upper_margin_pct}
253 ... The upstream bandwidth exceeded the limit (${pct_limit_up}% of limit)
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000254
255 # Case 2: Verify ONU1 and ONU2 will share rest of bw in PON Port. (Expect provisioned fixed bw)
256 ${out_file_0}= Set Variable /tmp/out1_tcont4
257 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
258 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
259 ... args=-t 30 -p 5201 out_file=${out_file_0}
260 ${out_file_1}= Set Variable /tmp/out2_tcont4
261 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
262 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
263 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
264 ... args=-t 30 -p 5202 out_file=${out_file_1}
265 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
266 Sleep 35s
267 ${out_0}= Read Output File on System ${out_file_0}
268 ${out_1}= Read Output File on Remote System ${list_onus_ut}[1][src] ${out_file_1}
269 # Verify ONU1 and ONU2 tcont4 is share rest of bw.
270 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
271 ${pct_limit_up_0}= Evaluate
272 ... 100*${actual_upstream_bw_used_0}/((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw})/2)
273 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
274 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000275 Should Be True ${pct_limit_up_0} <= ${upper_margin_pct}
276 ... The upstream bandwidth exceeded the limit (${pct_limit_up_0}% of limit)
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000277 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
278 ${pct_limit_up_1}= Evaluate
279 ... 100*${actual_upstream_bw_used_1}/((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw})/2)
280 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
281 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000282 Should Be True ${pct_limit_up_1} <= ${upper_margin_pct}
283 ... The upstream bandwidth exceeded the limit (${pct_limit_up_1}% of limit)
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000284 # Verify ONU3 (fixed bw) tcont1 air bw is reservered.
285 ${actual_reserved_upstream_bw_for_tcont1}= Evaluate
286 ... ${pon_max_bw_capacity_xgs}-(${actual_upstream_bw_used_0}+${actual_upstream_bw_used_1})
287 ${pct_limit_up_tcont1}= Evaluate 100*${actual_reserved_upstream_bw_for_tcont1}/${limiting_bw_us_fill_pon_bw}
288 Should Be True ${pct_limit_up_tcont1} >= ${lower_margin_pct}
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000289 ... The upstream bandwidth guarantee was not met (${pct_limit_up_tcont1}% of resv)
290 Should Be True ${pct_limit_up_tcont1} <= ${upper_margin_pct}
291 ... The upstream bandwidth exceeded the limit (${pct_limit_up_tcont1}% of limit)
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000292
293 # Sent original sadis file to onos
294 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT.json
295
Emrehan UZUN683bb962021-06-11 11:59:31 +0000296Verify that non-assured BW is released to assured BW allocation as needed for TT
297 [Documentation] Verify support for Tcont type 2 and 3.
298 ... Pump 1Gbps in the upstream from RG of ONU2 for VoD service and
299 ... then verify that no more than 700Mbps is received at the BNG.
300 ... Firstly, pump 500Mbps from the RG of ONU1 for the VoD service and
301 ... then verify that close to 500Mbps is received at the BNG.
302 ... Also verify that the VoD rate is now truncated to 500Mbps at BNG for ONU2.
303 [Tags] functionalTT VOL-4096
304 [Setup] Run Keywords Start Logging TcontType2Onu1Type3Onu2
305 ... AND Setup
306 [Teardown] Run Keywords Collect Logs
307 ... AND Stop Logging TcontType2Onu1Type3Onu2
308 # Push multi-tcont sadis to ONOS
309 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
310 Run Keyword If ${has_dataplane} Clean Up Linux
311 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
312
313 # The test expects the first entry in multi_tcont_tests.tcont2tcont3 input will be for service: vod and tcont: 2
314 # The test expects the second entry in multi_tcont_tests.tcont2tcont3 input will be for service: vod and tcont: 3
315 ${list_onus_ut}= Create List
316 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont2tcont3}
317 ${uni_capacity}= Set Variable 1000000
318 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
319 ${onu}= Set Variable ${multi_tcont_tests.tcont2tcont3[${I}]}
320 ${onu_sn}= Set Variable ${onu['onu']}
321 ${service}= Set Variable ${onu['service_type']}
322 ${us_bw}= Set Variable ${onu['us_bw_profile']}
323 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
324 ... ${service} ${us_bw}
325 Pass Execution If '${matched}' != 'True'
326 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
327 # Check for iperf3 and jq tools
328 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
329 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
330 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
331 # Get Upstream BW Profile details
332 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
333 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
334 Append To List ${list_onus_ut} ${onu_ut}
335 END
336
337 # Fill the OLT PON Bandwidth with Fixed Bandwidth Profile ONU
338 ${onu_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("serial")
339 ${olt_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("olt")
340 ${us_bw_profile_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("us_bw_profile")
341 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_fill_pon_bw}
342 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
343 ... Get ONU Port in ONOS ${onu_fill_pon_bw} ${of_id}
344 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
345 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
346 ... volt-add-subscriber-access ${of_id} ${onu_port}
347 Sleep 10s
348 ${limiting_bw_us_fill_pon_bw}= Get Limiting Bandwidth Details ${us_bw_profile_fill_pon_bw}
349
350 # Case 1: Verify only for VoD service from the RG of ONU2
351 ${dst}= Set Variable ${list_onus_ut}[1][dst]
352 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
353 ... args=-t 30 -p 5202
354 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
355 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
356 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
357 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000358 Should Be True ${pct_limit_up} <= ${upper_margin_pct}
359 ... The upstream bandwidth exceeded the limit (${pct_limit_up}% of limit)
Emrehan UZUN683bb962021-06-11 11:59:31 +0000360
361 # Case 2: Verify for ONU1 (with index [0]) and ONU2 (with index [1]) devices combined
362 ${out_file_0}= Set Variable /tmp/out_tcont2
363 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
364 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
365 ... args=-t 30 -p 5201 out_file=${out_file_0}
366 ${out_file_1}= Set Variable /tmp/out_tcont3
367 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
368 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
369 ... args=-t 30 -p 5202 out_file=${out_file_1}
370 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
371 Sleep 35s
372 ${out_0}= Read Output File on System ${out_file_0}
373 ${out_1}= Read Output File on Remote System ${list_onus_ut}[1][src] ${out_file_1}
374 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
375 ${pct_limit_up_0}= Evaluate 100*${actual_upstream_bw_used_0}/${list_onus_ut}[0][limiting_bw_us]
376 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
377 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000378 Should Be True ${pct_limit_up_0} <= ${upper_margin_pct}
379 ... The upstream bandwidth exceeded the limit (${pct_limit_up_0}% of limit)
Emrehan UZUN683bb962021-06-11 11:59:31 +0000380 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
381 ${pct_limit_up_1}= Evaluate
382 ... 100*${actual_upstream_bw_used_1}/(${uni_capacity}-${list_onus_ut}[0][limiting_bw_us])
383 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
384 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
Emrehan UZUNd6f85892021-07-01 13:54:26 +0000385 Should Be True ${pct_limit_up_1} <= ${upper_margin_pct}
386 ... The upstream bandwidth exceeded the limit (${pct_limit_up_1}% of limit)
387
388 # Sent original sadis file to onos
389 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT.json
390
391Verify that best effort BW is released to assured BW requirement as needed and that fixed BW is reserved always on the PON for TT
392 [Documentation] Verify support for Tcont type 4 and 5.
393 ... Pump 1Gbps upstream from the RG for HSI service of ONU2.
394 ... Verify that no more than 1Gbps is received at the BNG.
395 ... Now pump traffic from the RG's for the HSI service both ONU1 and ONU2 at the same time.
396 ... The BNG should receive at least 700Mbps (500 + 200 Mbps) for ONU2.
397 ... The remaining 300Mbps on the PON should be rationed between the two ONUs.
398 ... Now this is largely scheduler implementation dependent, so this is to be observed on the scheduler in the BAL behaves.
399 ... If it equally distributes the remaining BW,
400 ... ONU1 should get 150Mbps and ONU2 in total should get 850Mbps (500+200+150Mbps).
401 [Tags] functionalTT VOL-4097 non-critical
402 [Setup] Run Keywords Start Logging TcontType4Onu1Type5Onu2
403 ... AND Setup
404 [Teardown] Run Keywords Collect Logs
405 ... AND Stop Logging TcontType4Onu1Type5Onu2
406 ... AND Delete All Devices and Verify
407 Run Keyword If ${has_dataplane} Clean Up Linux
408 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont-1.json
409 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
410
411 # The test expects the first entry in multi_tcont_tests.tcont4tcont5 input will be for service: hsıa and tcont: 4
412 # The test expects the second entry in multi_tcont_tests.tcont4tcont5 input will be for service: hsıa and tcont: 5
413 ${list_onus_ut}= Create List
414 ${list_onus_ut_air_cir}= Create List
415 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont4tcont5}
416 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
417 ${onu}= Set Variable ${multi_tcont_tests.tcont4tcont5[${I}]}
418 ${onu_sn}= Set Variable ${onu['onu']}
419 ${service}= Set Variable ${onu['service_type']}
420 ${us_bw}= Set Variable ${onu['us_bw_profile']}
421 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
422 ... ${service} ${us_bw}
423 Pass Execution If '${matched}' != 'True'
424 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
425 # Check for iperf3 and jq tools
426 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
427 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
428 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
429 # Get Upstream BW Profile details
430 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
431 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
432 Append To List ${list_onus_ut} ${onu_ut}
433 ${limiting_bw_us_air_cir}= Get Limiting Bandwidth Details for Fixed and Committed ${us_bw}
434 ${onu_ut_air_cir} Create Dictionary src ${src} dst ${dst}
435 ... limiting_bw_us_air_cir ${limiting_bw_us_air_cir}
436 Append To List ${list_onus_ut_air_cir} ${onu_ut_air_cir}
437 END
438
439 # Fill the OLT PON Bandwidth with Fixed Bandwidth Profile ONU
440 ${onu_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("serial")
441 ${olt_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("olt")
442 ${us_bw_profile_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("us_bw_profile")
443 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_fill_pon_bw}
444 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
445 ... Get ONU Port in ONOS ${onu_fill_pon_bw} ${of_id}
446 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
447 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
448 ... volt-add-subscriber-access ${of_id} ${onu_port}
449 Sleep 10s
450 ${limiting_bw_us_fill_pon_bw}= Get Limiting Bandwidth Details ${us_bw_profile_fill_pon_bw}
451
452 # Case 1: Verify only for HSIA service from the RG of ONU2
453 ${dst}= Set Variable ${list_onus_ut}[1][dst]
454 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
455 ... args=-t 30 -p 5202
456 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
457 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
458 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
459 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
460 Should Be True ${pct_limit_up} <= ${upper_margin_pct}
461 ... The upstream bandwidth exceeded the limit (${pct_limit_up}% of limit)
462
463 # Case 2: Verify for ONU1 (with index [0]) and ONU2 (with index [1]) devices combined
464 ${out_file_0}= Set Variable /tmp/out_tcont4
465 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
466 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
467 ... args=-t 30 -p 5201 out_file=${out_file_0}
468 ${out_file_1}= Set Variable /tmp/out_tcont5
469 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
470 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
471 ... args=-t 30 -p 5202 out_file=${out_file_1}
472 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
473 Sleep 35s
474 ${out_0}= Read Output File on System ${out_file_0}
475 ${out_1}= Read Output File on Remote System ${list_onus_ut}[1][src] ${out_file_1}
476 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
477 ${limit_up_0_denominator}= Evaluate
478 ... ((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw}-${list_onus_ut_air_cir}[1][limiting_bw_us_air_cir])/2)
479 ${pct_limit_up_0}= Evaluate
480 ... 100*${actual_upstream_bw_used_0}/${limit_up_0_denominator}
481 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
482 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
483 Should Be True ${pct_limit_up_0} <= ${upper_margin_pct}
484 ... The upstream bandwidth exceeded the limit (${pct_limit_up_0}% of limit)
485 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
486 ${limit_up_1_numerator}= Evaluate
487 ... (${actual_upstream_bw_used_1}-${list_onus_ut_air_cir}[1][limiting_bw_us_air_cir])
488 ${limit_up_1_denominator}= Evaluate
489 ... ((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw}-${list_onus_ut_air_cir}[1][limiting_bw_us_air_cir])/2)
490 ${pct_limit_up_1}= Evaluate
491 ... 100*${limit_up_1_numerator}/${limit_up_1_denominator}
492 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
493 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
494 Should Be True ${pct_limit_up_1} <= ${upper_margin_pct}
495 ... The upstream bandwidth exceeded the limit (${pct_limit_up_1}% of limit)
Emrehan UZUN683bb962021-06-11 11:59:31 +0000496
497 # Sent original sadis file to onos
498 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT.json
499
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000500*** Keywords ***
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000501Read Output File on Remote System
502 [Arguments] ${src} ${file}
503 [Documentation] Login to ${src} and reads the content of ${file}.
504 Get File from Remote System ${file} ${src['ip']} ${src['user']} ${src['pass']}
505 ${output}= OperatingSystem.Get File ${file}
506 Log ${output}
507 ${object}= Evaluate json.loads(r'''${output}''') json
508 [Return] ${object}
509
510Get File from Remote System
511 [Arguments] ${file} ${ip} ${user} ${pass}=${None}
512 [Documentation] Gets file from the remote system and stores it in /tmp folder on local
513 ${conn_id}= SSHLibrary.Open Connection ${ip}
514 Run Keyword If '${pass}' != '${None}'
515 ... SSHLibrary.Login ${user} ${pass}
516 ... ELSE
517 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
518 SSHLibrary.Get File ${file} /tmp/
519 SSHLibrary.Close Connection
520
Hardik Windlassd388b462021-05-27 05:40:00 +0000521Read Output File on System
522 [Arguments] ${file}
523 [Documentation] Reads the content of ${file}.
524 ${output}= OperatingSystem.Get File ${file}
525 Log ${output}
526 ${object}= Evaluate json.loads(r'''${output}''') json
527 [Return] ${object}
528
529Run Iperf3 Test Client in Background
530 [Arguments] ${src} ${server} ${args} ${out_file}
531 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args} in background.
532 ... Stores the results of the test in ${out_file}.
533 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} > ${out_file} &
534 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
535 Should Be Equal As Integers ${rc} 0
536
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000537Get ONU details with Given Sn and Service
538 [Documentation] This keyword finds the ONU details (as required for multi-tcont test)
539 ... with given serial number and service type
540 ... The keyword, additionally, also verifies the associated upstream bandwidth profile
541 [Arguments] ${onu_sn} ${service_type} ${us_bw_profile}
542 ${matched}= Set Variable False
543 FOR ${I} IN RANGE 0 ${num_all_onus}
544 ${src}= Set Variable ${hosts.src[${I}]}
545 ${dst}= Set Variable ${hosts.dst[${I}]}
546 ${service}= Get Variable Value ${src['service_type']} "null"
547 ${onu}= Get Variable Value ${src['onu']} "null"
548 Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}'
549 # Additional verification to check upstream bandwidth profile
550 ${of_id}= Get ofID From OLT List ${src['olt']}
551 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
552 ${subscriber_id}= Set Variable ${of_id}/${onu_port}
553 ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile
Hardik Windlass35db2aa2021-06-03 12:41:26 +0000554 ... ${service_type}
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000555 ${matched}= Set Variable If
556 ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}'
557 ... True False
558 Exit For Loop If ${matched}
559 END
560 [Return] ${matched} ${src} ${dst}
561
562Setup Suite
563 [Documentation] Set up the test suite
564 Common Test Suite Setup
565 ${switch_type}= Get Variable Value ${web_power_switch.type}
566 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
567
568
569Clear All Devices Then Create New Device
570 [Documentation] Remove any devices from VOLTHA and ONOS
571 # Remove all devices from voltha and nos
572 Delete All Devices and Verify
573 # Execute normal test Setup Keyword
574 Setup
575
576
577Teardown Suite
578 [Documentation] Tear down steps for the suite
579 Run Keyword If ${has_dataplane} Clean Up Linux
580 Run Keyword If ${teardown_device} Delete All Devices And Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000581 Close All ONOS SSH Connections