blob: 29db0d5decb2205f94168f058e0303088dd4ff2c [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
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +000060${pon_max_bw_capacity_xgs}= 9700000 # Mbps, for xgs-pon OLT, when FEC Disabled
Hardik Windlass2013d0c2021-05-20 13:37:25 +000061
62*** Test Cases ***
Girish Gowdracb8482a2021-05-27 09:06:13 -070063Test that the BW is limited to Limiting Bandwidth
Hardik Windlass2013d0c2021-05-20 13:37:25 +000064 [Documentation] Verify support for Tcont type 1.
Girish Gowdracb8482a2021-05-27 09:06:13 -070065 ... Verify that traffic is limited to Limiting Bandwidth (eir+cir+air) configured for the service/onu.
Hardik Windlass2013d0c2021-05-20 13:37:25 +000066 ... Pump 500Mbps in the upstream from RG and verify that the received traffic is only 200Mbps at the BNG.
67 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
68 [Tags] functionalTT VOL-4093
69 [Setup] Run Keywords Start Logging TcontType1Onu1
70 ... AND Setup
71 [Teardown] Run Keywords Collect Logs
72 ... AND Stop Logging TcontType1Onu1
Hardik Windlass35db2aa2021-06-03 12:41:26 +000073 ... AND Delete All Devices and Verify
Hardik Windlass2013d0c2021-05-20 13:37:25 +000074 Run Keyword If ${has_dataplane} Clean Up Linux
75 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
76 # Find the ONU as required for this test
77 ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]}
78 ${test_onu_sn}= Set Variable ${test_onu['onu']}
79 ${test_service_type}= Set Variable ${test_onu['service_type']}
80 ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']}
81 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type}
82 ... ${test_us_bw_profile}
83 Pass Execution If '${matched}' != 'True'
84 ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}'
85 # Check for iperf3 and jq tools
86 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
87 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
88 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
Girish Gowdracb8482a2021-05-27 09:06:13 -070089 ${limiting_bw_value_upstream}= Get Limiting Bandwidth Details ${test_us_bw_profile}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000090 # Stream UDP packets from RG to server
91 ${updict}= Run Iperf3 Test Client ${src} server=${dst['dp_iface_ip_qinq']}
92 ... args=-u -b 500M -t 30 -p 5201
93 # With UDP test, bits per second is the sending rate. Multiply by the loss rate to get the throughput.
94 ${actual_upstream_bw_used}= Evaluate
95 ... (100 - ${updict['end']['sum']['lost_percent']})*${updict['end']['sum']['bits_per_second']}/100000
Girish Gowdracb8482a2021-05-27 09:06:13 -070096 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${limiting_bw_value_upstream}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000097 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
98 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
99
Hardik Windlassd388b462021-05-27 05:40:00 +0000100Test that assured BW is allocated as needed on the PON
101 [Documentation] Verify support for Tcont type 2 and 4.
102 ... Verify that the BW from tcont type 4 is bequeathed to type2 as needed.
103 ... 1) Pump 1Gbps in the upstream from the RG for HSIA service and verify that no more than 1Gbps is received at the BNG.
104 ... 2) Pump 500Mbps from the RG for the VoD service and verify that close to 500Mbps is received at the BNG.
105 ... Also, verify that the HSI rate is now truncated to 500Mbps at BNG.
106 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
107 [Tags] functionalTT VOL-4095
108 [Setup] Run Keywords Start Logging TcontType2Type4Onu1
109 ... AND Setup
110 [Teardown] Run Keywords Collect Logs
111 ... AND Stop Logging TcontType2Type4Onu1
112 ... AND Delete All Devices and Verify
113 Run Keyword If ${has_dataplane} Clean Up Linux
114 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
115
116 # The test expects the first entry in multi_tcont_tests.tcont2tcont4 input will be for service: vod and tcont: 2
117 # The test expects the second entry in multi_tcont_tests.tcont2tcont4 input will be for service: hsia and tcont: 4
118 ${list_onus_ut}= Create List
119 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont2tcont4}
120 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
121 ${onu}= Set Variable ${multi_tcont_tests.tcont2tcont4[${I}]}
122 ${onu_sn}= Set Variable ${onu['onu']}
123 ${service}= Set Variable ${onu['service_type']}
124 ${us_bw}= Set Variable ${onu['us_bw_profile']}
125 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
126 ... ${service} ${us_bw}
127 Pass Execution If '${matched}' != 'True'
128 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
129 # Check for iperf3 and jq tools
130 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
131 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
132 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
133 # Get Upstream BW Profile details
134 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
135 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
136 Append To List ${list_onus_ut} ${onu_ut}
137 END
138
139 # Case 1: Verify only for HSIA service
140 ${dst}= Set Variable ${list_onus_ut}[1][dst]
141 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
142 ... args=-t 30 -p 5202
143 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
144 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
145 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
146 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
147
148 # Case 2: Verify for VOD (with index [0]) and HSIA (with index [1]) service combined
149 ${out_file_0}= Set Variable ${CURDIR}/../../tests/data/out_tcont2
150 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
151 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
152 ... args=-t 30 -p 5201 out_file=${out_file_0}
153 ${out_file_1}= Set Variable ${CURDIR}/../../tests/data/out_tcont4
154 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
155 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
156 ... args=-t 30 -p 5202 out_file=${out_file_1}
157 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
158 Sleep 35s
159 ${out_0}= Read Output File on System ${out_file_0}
160 ${out_1}= Read Output File on System ${out_file_1}
161 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
162 ${pct_limit_up_0}= Evaluate 100*${actual_upstream_bw_used_0}/${list_onus_ut}[0][limiting_bw_us]
163 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
164 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
165 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
166 ${pct_limit_up_1}= Evaluate
167 ... 100*${actual_upstream_bw_used_1}/(${list_onus_ut}[1][limiting_bw_us]-${list_onus_ut}[0][limiting_bw_us])
168 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
169 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
170
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000171Test that the AIR BW is reserved for a ONU
172 [Documentation] Verify support for Tcont type 1 + type 4 at the same time.
173 ... Verify that 8700Mbps is reserved in the upstream as AIR requirement for the VoIP service.
174 ... Pump 1Gbpbs in the upstream from the RG for HSI service, respectively ONU2, ONU3 and verify that up to 1Gbps
175 ... is received at the BNG.
176 ... Then pump ONU2 and ONU3 HSIA combined. ONUs must be share rest of bw in PON Port. (Expect fixed tcont1)
177 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
178 [Tags] functionalTT VOL-4094
179 [Setup] Run Keywords Start Logging TcontType1Type4Onu1Onu2Onu3
180 ... AND Setup
181 [Teardown] Run Keywords Collect Logs
182 ... AND Stop Logging TcontType1Type4Onu1Onu2Onu3
183 ... AND Delete All Devices and Verify
184 # Push multi-tcont sadis to ONOS
185 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
186 Run Keyword If ${has_dataplane} Clean Up Linux
187 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
188
189 # The test expects the first entry in multi_tcont_tests.tcont1tcont4 input will be for service: voip and tcont: 1
190 # The test expects the second entry in multi_tcont_tests.tcont1tcont4 input will be for service: hsia and tcont: 4
191 ${list_onus_ut}= Create List
192 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont1tcont4}
193 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
194 ${onu}= Set Variable ${multi_tcont_tests.tcont1tcont4[${I}]}
195 ${onu_sn}= Set Variable ${onu['onu']}
196 ${service}= Set Variable ${onu['service_type']}
197 ${us_bw}= Set Variable ${onu['us_bw_profile']}
198 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
199 ... ${service} ${us_bw}
200 Pass Execution If '${matched}' != 'True'
201 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
202 # Check for iperf3 and jq tools
203 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
204 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
205 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
206 # Get Upstream BW Profile details
207 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
208 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
209 Append To List ${list_onus_ut} ${onu_ut}
210 END
211
212 # Fill the OLT PON Bandwidth with Fixed Bandwidth Profile ONU
213 ${onu_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("serial")
214 ${olt_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("olt")
215 ${us_bw_profile_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("us_bw_profile")
216 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_fill_pon_bw}
217 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
218 ... Get ONU Port in ONOS ${onu_fill_pon_bw} ${of_id}
219 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
220 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
221 ... volt-add-subscriber-access ${of_id} ${onu_port}
222 Sleep 10s
223 ${limiting_bw_us_fill_pon_bw}= Get Limiting Bandwidth Details ${us_bw_profile_fill_pon_bw}
224
225 # Case 1: Verify both ONUs should be able to get 1Gbps separately when only HSIA service is available
226 ${dst}= Set Variable ${list_onus_ut}[0][dst]
227 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[0][src] server=${dst['dp_iface_ip_qinq']}
228 ... args=-t 30 -p 5202
229 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
230 ${pct_limit_up}= Evaluate
231 ... 100*${actual_upstream_bw_used}/${list_onus_ut}[0][limiting_bw_us]
232 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
233 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
234
235 ${dst}= Set Variable ${list_onus_ut}[1][dst]
236 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][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}[1][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 # Case 2: Verify ONU1 and ONU2 will share rest of bw in PON Port. (Expect provisioned fixed bw)
245 ${out_file_0}= Set Variable /tmp/out1_tcont4
246 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
247 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
248 ... args=-t 30 -p 5201 out_file=${out_file_0}
249 ${out_file_1}= Set Variable /tmp/out2_tcont4
250 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
251 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
252 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
253 ... args=-t 30 -p 5202 out_file=${out_file_1}
254 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
255 Sleep 35s
256 ${out_0}= Read Output File on System ${out_file_0}
257 ${out_1}= Read Output File on Remote System ${list_onus_ut}[1][src] ${out_file_1}
258 # Verify ONU1 and ONU2 tcont4 is share rest of bw.
259 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
260 ${pct_limit_up_0}= Evaluate
261 ... 100*${actual_upstream_bw_used_0}/((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw})/2)
262 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
263 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
264 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
265 ${pct_limit_up_1}= Evaluate
266 ... 100*${actual_upstream_bw_used_1}/((${pon_max_bw_capacity_xgs}-${limiting_bw_us_fill_pon_bw})/2)
267 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
268 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
269 # Verify ONU3 (fixed bw) tcont1 air bw is reservered.
270 ${actual_reserved_upstream_bw_for_tcont1}= Evaluate
271 ... ${pon_max_bw_capacity_xgs}-(${actual_upstream_bw_used_0}+${actual_upstream_bw_used_1})
272 ${pct_limit_up_tcont1}= Evaluate 100*${actual_reserved_upstream_bw_for_tcont1}/${limiting_bw_us_fill_pon_bw}
273 Should Be True ${pct_limit_up_tcont1} >= ${lower_margin_pct}
274 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
275
276 # Sent original sadis file to onos
277 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT.json
278
Emrehan UZUN683bb962021-06-11 11:59:31 +0000279Verify that non-assured BW is released to assured BW allocation as needed for TT
280 [Documentation] Verify support for Tcont type 2 and 3.
281 ... Pump 1Gbps in the upstream from RG of ONU2 for VoD service and
282 ... then verify that no more than 700Mbps is received at the BNG.
283 ... Firstly, pump 500Mbps from the RG of ONU1 for the VoD service and
284 ... then verify that close to 500Mbps is received at the BNG.
285 ... Also verify that the VoD rate is now truncated to 500Mbps at BNG for ONU2.
286 [Tags] functionalTT VOL-4096
287 [Setup] Run Keywords Start Logging TcontType2Onu1Type3Onu2
288 ... AND Setup
289 [Teardown] Run Keywords Collect Logs
290 ... AND Stop Logging TcontType2Onu1Type3Onu2
291 # Push multi-tcont sadis to ONOS
292 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
293 Run Keyword If ${has_dataplane} Clean Up Linux
294 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT
295
296 # The test expects the first entry in multi_tcont_tests.tcont2tcont3 input will be for service: vod and tcont: 2
297 # The test expects the second entry in multi_tcont_tests.tcont2tcont3 input will be for service: vod and tcont: 3
298 ${list_onus_ut}= Create List
299 ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont2tcont3}
300 ${uni_capacity}= Set Variable 1000000
301 FOR ${I} IN RANGE 0 ${num_multi_tcont_input}
302 ${onu}= Set Variable ${multi_tcont_tests.tcont2tcont3[${I}]}
303 ${onu_sn}= Set Variable ${onu['onu']}
304 ${service}= Set Variable ${onu['service_type']}
305 ${us_bw}= Set Variable ${onu['us_bw_profile']}
306 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn}
307 ... ${service} ${us_bw}
308 Pass Execution If '${matched}' != 'True'
309 ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}'
310 # Check for iperf3 and jq tools
311 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
312 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
313 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
314 # Get Upstream BW Profile details
315 ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw}
316 ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us}
317 Append To List ${list_onus_ut} ${onu_ut}
318 END
319
320 # Fill the OLT PON Bandwidth with Fixed Bandwidth Profile ONU
321 ${onu_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("serial")
322 ${olt_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("olt")
323 ${us_bw_profile_fill_pon_bw}= Evaluate ${onus_fill_pon_bw}[0].get("us_bw_profile")
324 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_fill_pon_bw}
325 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
326 ... Get ONU Port in ONOS ${onu_fill_pon_bw} ${of_id}
327 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
328 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
329 ... volt-add-subscriber-access ${of_id} ${onu_port}
330 Sleep 10s
331 ${limiting_bw_us_fill_pon_bw}= Get Limiting Bandwidth Details ${us_bw_profile_fill_pon_bw}
332
333 # Case 1: Verify only for VoD service from the RG of ONU2
334 ${dst}= Set Variable ${list_onus_ut}[1][dst]
335 ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']}
336 ... args=-t 30 -p 5202
337 ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000
338 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us]
339 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
340 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
341
342 # Case 2: Verify for ONU1 (with index [0]) and ONU2 (with index [1]) devices combined
343 ${out_file_0}= Set Variable /tmp/out_tcont2
344 ${dst_0}= Set Variable ${list_onus_ut}[0][dst]
345 Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']}
346 ... args=-t 30 -p 5201 out_file=${out_file_0}
347 ${out_file_1}= Set Variable /tmp/out_tcont3
348 ${dst_1}= Set Variable ${list_onus_ut}[1][dst]
349 Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']}
350 ... args=-t 30 -p 5202 out_file=${out_file_1}
351 # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command)
352 Sleep 35s
353 ${out_0}= Read Output File on System ${out_file_0}
354 ${out_1}= Read Output File on Remote System ${list_onus_ut}[1][src] ${out_file_1}
355 ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000
356 ${pct_limit_up_0}= Evaluate 100*${actual_upstream_bw_used_0}/${list_onus_ut}[0][limiting_bw_us]
357 Should Be True ${pct_limit_up_0} >= ${lower_margin_pct}
358 ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv)
359 ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000
360 ${pct_limit_up_1}= Evaluate
361 ... 100*${actual_upstream_bw_used_1}/(${uni_capacity}-${list_onus_ut}[0][limiting_bw_us])
362 Should Be True ${pct_limit_up_1} >= ${lower_margin_pct}
363 ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv)
364
365 # Sent original sadis file to onos
366 Send File To Onos ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT.json
367
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000368*** Keywords ***
Huseyin Ahmet AYDIN42d3b712021-06-10 14:46:17 +0000369Read Output File on Remote System
370 [Arguments] ${src} ${file}
371 [Documentation] Login to ${src} and reads the content of ${file}.
372 Get File from Remote System ${file} ${src['ip']} ${src['user']} ${src['pass']}
373 ${output}= OperatingSystem.Get File ${file}
374 Log ${output}
375 ${object}= Evaluate json.loads(r'''${output}''') json
376 [Return] ${object}
377
378Get File from Remote System
379 [Arguments] ${file} ${ip} ${user} ${pass}=${None}
380 [Documentation] Gets file from the remote system and stores it in /tmp folder on local
381 ${conn_id}= SSHLibrary.Open Connection ${ip}
382 Run Keyword If '${pass}' != '${None}'
383 ... SSHLibrary.Login ${user} ${pass}
384 ... ELSE
385 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
386 SSHLibrary.Get File ${file} /tmp/
387 SSHLibrary.Close Connection
388
Hardik Windlassd388b462021-05-27 05:40:00 +0000389Read Output File on System
390 [Arguments] ${file}
391 [Documentation] Reads the content of ${file}.
392 ${output}= OperatingSystem.Get File ${file}
393 Log ${output}
394 ${object}= Evaluate json.loads(r'''${output}''') json
395 [Return] ${object}
396
397Run Iperf3 Test Client in Background
398 [Arguments] ${src} ${server} ${args} ${out_file}
399 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args} in background.
400 ... Stores the results of the test in ${out_file}.
401 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} > ${out_file} &
402 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
403 Should Be Equal As Integers ${rc} 0
404
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000405Get ONU details with Given Sn and Service
406 [Documentation] This keyword finds the ONU details (as required for multi-tcont test)
407 ... with given serial number and service type
408 ... The keyword, additionally, also verifies the associated upstream bandwidth profile
409 [Arguments] ${onu_sn} ${service_type} ${us_bw_profile}
410 ${matched}= Set Variable False
411 FOR ${I} IN RANGE 0 ${num_all_onus}
412 ${src}= Set Variable ${hosts.src[${I}]}
413 ${dst}= Set Variable ${hosts.dst[${I}]}
414 ${service}= Get Variable Value ${src['service_type']} "null"
415 ${onu}= Get Variable Value ${src['onu']} "null"
416 Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}'
417 # Additional verification to check upstream bandwidth profile
418 ${of_id}= Get ofID From OLT List ${src['olt']}
419 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
420 ${subscriber_id}= Set Variable ${of_id}/${onu_port}
421 ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile
Hardik Windlass35db2aa2021-06-03 12:41:26 +0000422 ... ${service_type}
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000423 ${matched}= Set Variable If
424 ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}'
425 ... True False
426 Exit For Loop If ${matched}
427 END
428 [Return] ${matched} ${src} ${dst}
429
430Setup Suite
431 [Documentation] Set up the test suite
432 Common Test Suite Setup
433 ${switch_type}= Get Variable Value ${web_power_switch.type}
434 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
435
436
437Clear All Devices Then Create New Device
438 [Documentation] Remove any devices from VOLTHA and ONOS
439 # Remove all devices from voltha and nos
440 Delete All Devices and Verify
441 # Execute normal test Setup Keyword
442 Setup
443
444
445Teardown Suite
446 [Documentation] Tear down steps for the suite
447 Run Keyword If ${has_dataplane} Clean Up Linux
448 Run Keyword If ${teardown_device} Delete All Devices And Verify
TorstenThieme4e2168e2021-06-22 14:01:47 +0000449 Close All ONOS SSH Connections