blob: 0d6c730b7dc96a7ee4bf5a4e0f781299d07a20c0 [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
Hardik Windlass35db2aa2021-06-03 12:41:26 +000072 ... AND Delete All Devices and Verify
Hardik Windlass2013d0c2021-05-20 13:37:25 +000073 Run Keyword If ${has_dataplane} Clean Up Linux
74 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT
75 # Find the ONU as required for this test
76 ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]}
77 ${test_onu_sn}= Set Variable ${test_onu['onu']}
78 ${test_service_type}= Set Variable ${test_onu['service_type']}
79 ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']}
80 ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type}
81 ... ${test_us_bw_profile}
82 Pass Execution If '${matched}' != 'True'
83 ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}'
84 # Check for iperf3 and jq tools
85 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq
86 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
87 Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG
Girish Gowdracb8482a2021-05-27 09:06:13 -070088 ${limiting_bw_value_upstream}= Get Limiting Bandwidth Details ${test_us_bw_profile}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000089 # Stream UDP packets from RG to server
90 ${updict}= Run Iperf3 Test Client ${src} server=${dst['dp_iface_ip_qinq']}
91 ... args=-u -b 500M -t 30 -p 5201
92 # With UDP test, bits per second is the sending rate. Multiply by the loss rate to get the throughput.
93 ${actual_upstream_bw_used}= Evaluate
94 ... (100 - ${updict['end']['sum']['lost_percent']})*${updict['end']['sum']['bits_per_second']}/100000
Girish Gowdracb8482a2021-05-27 09:06:13 -070095 ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${limiting_bw_value_upstream}
Hardik Windlass2013d0c2021-05-20 13:37:25 +000096 Should Be True ${pct_limit_up} >= ${lower_margin_pct}
97 ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv)
98
99*** Keywords ***
100Get ONU details with Given Sn and Service
101 [Documentation] This keyword finds the ONU details (as required for multi-tcont test)
102 ... with given serial number and service type
103 ... The keyword, additionally, also verifies the associated upstream bandwidth profile
104 [Arguments] ${onu_sn} ${service_type} ${us_bw_profile}
105 ${matched}= Set Variable False
106 FOR ${I} IN RANGE 0 ${num_all_onus}
107 ${src}= Set Variable ${hosts.src[${I}]}
108 ${dst}= Set Variable ${hosts.dst[${I}]}
109 ${service}= Get Variable Value ${src['service_type']} "null"
110 ${onu}= Get Variable Value ${src['onu']} "null"
111 Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}'
112 # Additional verification to check upstream bandwidth profile
113 ${of_id}= Get ofID From OLT List ${src['olt']}
114 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
115 ${subscriber_id}= Set Variable ${of_id}/${onu_port}
116 ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile
Hardik Windlass35db2aa2021-06-03 12:41:26 +0000117 ... ${service_type}
Hardik Windlass2013d0c2021-05-20 13:37:25 +0000118 ${matched}= Set Variable If
119 ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}'
120 ... True False
121 Exit For Loop If ${matched}
122 END
123 [Return] ${matched} ${src} ${dst}
124
125Setup Suite
126 [Documentation] Set up the test suite
127 Common Test Suite Setup
128 ${switch_type}= Get Variable Value ${web_power_switch.type}
129 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
130
131
132Clear All Devices Then Create New Device
133 [Documentation] Remove any devices from VOLTHA and ONOS
134 # Remove all devices from voltha and nos
135 Delete All Devices and Verify
136 # Execute normal test Setup Keyword
137 Setup
138
139
140Teardown Suite
141 [Documentation] Tear down steps for the suite
142 Run Keyword If ${has_dataplane} Clean Up Linux
143 Run Keyword If ${teardown_device} Delete All Devices And Verify