Skip to content

Commit

Permalink
[copp] Adding a parameter - send rate-limit (#3548)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
PR#3384 changed copp test by introducing send rate-limit pps value,
which affects TC. Default is set to 2000 pps.
Different server/DUT combination might require different value of this parameter.

How did you do it?
Added parameter --send_rate_limit to test run command
example of use: copp/test_copp.py --send_rate_limit 2500

How did you verify/test it?
Run:
* copp/test_copp (without parameter)
* copp/test_copp --send_rate_limit 2500
All pass

Signed-off-by: Vladyslav Morokhovych <vladyslavx.morokhovych@intel.com>
  • Loading branch information
vmorokhx authored Jun 28, 2021
1 parent 8c0ae8d commit 6cc2135
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ansible/roles/test/files/ptftests/copp_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ControlPlaneBaseTest(BaseTest):
DEFAULT_PRE_SEND_INTERVAL_SEC = 1
DEFAULT_SEND_INTERVAL_SEC = 10
DEFAULT_RECEIVE_WAIT_TIME = 3
DEFAULT_SERVER_SEND_RATE_LIMIT_PPS = 2000

def __init__(self):
BaseTest.__init__(self)
Expand All @@ -55,6 +54,7 @@ def __init__(self):

self.myip = test_params.get('myip', None)
self.peerip = test_params.get('peerip', None)
self.default_server_send_rate_limit_pps = test_params.get('send_rate_limit', 2000)

self.needPreSend = None

Expand Down Expand Up @@ -136,7 +136,7 @@ def copp_test(self, packet, send_intf, recv_intf):

# Depending on the server/platform combination it is possible for the server to
# overwhelm the DUT, so we add an artificial delay here to rate-limit the server.
time.sleep(1.0 / self.DEFAULT_SERVER_SEND_RATE_LIMIT_PPS)
time.sleep(1.0 / float(self.default_server_send_rate_limit_pps))

self.log("Sent out %d packets in %ds" % (send_count, self.DEFAULT_SEND_INTERVAL_SEC))

Expand Down
6 changes: 6 additions & 0 deletions tests/copp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ def pytest_addoption(parser):
default=False,
help="Swap syncd container with syncd-rpc container",
)
parser.addoption(
"--send_rate_limit",
action="store",
default=2000,
help="Set custom server send rate limit",
)
11 changes: 8 additions & 3 deletions tests/copp/test_copp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Parameters:
--copp_swap_syncd: Used to install the RPC syncd image before running the tests. Default
is disabled.
--send_rate_limit: Used to set custom server send rate-limit pps. Default is 2000 pps
"""

Expand Down Expand Up @@ -44,7 +45,8 @@
"myip",
"peerip",
"nn_target_interface",
"nn_target_namespace"])
"nn_target_namespace",
"send_rate_limit"])
_SUPPORTED_PTF_TOPOS = ["ptf32", "ptf64"]
_SUPPORTED_T1_TOPOS = ["t1", "t1-lag", "t1-64-lag"]
_TOR_ONLY_PROTOCOL = ["DHCP"]
Expand Down Expand Up @@ -160,7 +162,8 @@ def _copp_runner(dut, ptf, protocol, test_params, dut_type):
params = {"verbose": False,
"target_port": test_params.nn_target_port,
"myip": test_params.myip,
"peerip": test_params.peerip}
"peerip": test_params.peerip,
"send_rate_limit": test_params.send_rate_limit}

dut_ip = dut.mgmt_ip
device_sockets = ["0-{}@tcp://127.0.0.1:10900".format(test_params.nn_target_port),
Expand All @@ -187,6 +190,7 @@ def _gather_test_params(tbinfo, duthost, request):
"""

swap_syncd = request.config.getoption("--copp_swap_syncd")
send_rate_limit = request.config.getoption("--send_rate_limit")
topo = tbinfo["topo"]["name"]
mg_facts = duthost.get_extended_minigraph_facts(tbinfo)
port_index_map = {
Expand Down Expand Up @@ -215,7 +219,8 @@ def _gather_test_params(tbinfo, duthost, request):
myip=myip,
peerip = peerip,
nn_target_interface=nn_target_interface,
nn_target_namespace=nn_target_namespace)
nn_target_namespace=nn_target_namespace,
send_rate_limit=send_rate_limit)

def _setup_testbed(dut, creds, ptf, test_params, tbinfo):
"""
Expand Down

0 comments on commit 6cc2135

Please sign in to comment.