blob: 2166a6d74751c81172bca3a0b7994007fafa6b57 [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
60
61*** Test Cases ***
Girish Gowdracb8482a2021-05-27 09:06:13 -070062Test that the BW is limited to Limiting Bandwidth
Hardik Windlass2013d0c2021-05-20 13:37:25 +000063 [Documentation] Verify support for Tcont type 1.
Girish Gowdracb8482a2021-05-27 09:06:13 -070064 ... Verify that traffic is limited to Limiting Bandwidth (eir+cir+air) configured for the service/onu.
Hardik Windlass2013d0c2021-05-20 13:37:25 +000065 ... Pump 500Mbps in the upstream from RG and verify that the received traffic is only 200Mbps at the BNG.
66 ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario.
67 [Tags] functionalTT VOL-4093
68 [Setup] Run Keywords Start Logging TcontType1Onu1
69 ... AND Setup
70 [Teardown] Run Keywords Collect Logs
71 ... AND Stop Logging TcontType1Onu1
72 Run Keyword If ${has_dataplane} Clean Up Linux
73 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
74 # Find the ONU as required for this test
75 ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]}
76 ${test_onu_sn}= Set Variable ${test_onu['onu']}
77 ${test_service_type}= Set Variable ${test_onu['service_type']}
78 ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']}
79 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type}
80 ... ${test_us_bw_profile}
81 Pass Execution If '${matched}' != 'True'
82 ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}'
83 # Check for iperf3 and jq tools
84 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
85 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
86 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
Girish Gowdracb8482a2021-05-27 09:06:13 -070087 ${limiting_bw_value_upstream}= Get Limiting Bandwidth Details ${test_us_bw_profile}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000088 # Stream UDP packets from RG to server
89 ${updict}= Run Iperf3 Test Client ${src} server=${dst['dp_iface_ip_qinq']}
90 ... args=-u -b 500M -t 30 -p 5201
91 # With UDP test, bits per second is the sending rate. Multiply by the loss rate to get the throughput.
92 ${actual_upstream_bw_used}= Evaluate
93 ... (100 - ${updict['end']['sum']['lost_percent']})*${updict['end']['sum']['bits_per_second']}/100000
Girish Gowdracb8482a2021-05-27 09:06:13 -070094 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${limiting_bw_value_upstream}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000095 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
96 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
97
98*** Keywords ***
99Get ONU details with Given Sn and Service
100 [Documentation] This keyword finds the ONU details (as required for multi-tcont test)
101 ... with given serial number and service type
102 ... The keyword, additionally, also verifies the associated upstream bandwidth profile
103 [Arguments] ${onu_sn} ${service_type} ${us_bw_profile}
104 ${matched}= Set Variable False
105 FOR ${I} IN RANGE 0 ${num_all_onus}
106 ${src}= Set Variable ${hosts.src[${I}]}
107 ${dst}= Set Variable ${hosts.dst[${I}]}
108 ${service}= Get Variable Value ${src['service_type']} "null"
109 ${onu}= Get Variable Value ${src['onu']} "null"
110 Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}'
111 # Additional verification to check upstream bandwidth profile
112 ${of_id}= Get ofID From OLT List ${src['olt']}
113 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
114 ${subscriber_id}= Set Variable ${of_id}/${onu_port}
115 ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile
116 ${matched}= Set Variable If
117 ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}'
118 ... True False
119 Exit For Loop If ${matched}
120 END
121 [Return] ${matched} ${src} ${dst}
122
123Setup Suite
124 [Documentation] Set up the test suite
125 Common Test Suite Setup
126 ${switch_type}= Get Variable Value ${web_power_switch.type}
127 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
128
129
130Clear All Devices Then Create New Device
131 [Documentation] Remove any devices from VOLTHA and ONOS
132 # Remove all devices from voltha and nos
133 Delete All Devices and Verify
134 # Execute normal test Setup Keyword
135 Setup
136
137
138Teardown Suite
139 [Documentation] Tear down steps for the suite
140 Run Keyword If ${has_dataplane} Clean Up Linux
141 Run Keyword If ${teardown_device} Delete All Devices And Verify