aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2020-01-21 19:02:14 +0000
committerVratko Polak <vrpolak@cisco.com>2020-01-29 15:48:30 +0000
commit676f4ae7d4df07dc41471e829f9d4c0b7a5bc8ca (patch)
tree3d0dd8bd2870815873297731484ee23ae943f2c0 /resources/libraries/python
parent40bd774810d9e328f96725bcbf5f52ace04ac9a2 (diff)
perf: hoststack iperf3 test tuning
Change-Id: I53425f57fe9ecef9cff2c94642cc7cb24537a961 Signed-off-by: Dave Wallace <dwallacelf@gmail.com> (cherry picked from commit b340b5c9925b43869b91197850504760757a0bfe)
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/Constants.py2
-rw-r--r--resources/libraries/python/DUTSetup.py22
-rw-r--r--resources/libraries/python/HoststackUtil.py14
-rw-r--r--resources/libraries/python/VppConfigGenerator.py9
-rw-r--r--resources/libraries/python/autogen/Regenerator.py26
-rw-r--r--resources/libraries/python/autogen/Testcase.py8
6 files changed, 47 insertions, 34 deletions
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py
index 4e600098d5..5ffc7c04e3 100644
--- a/resources/libraries/python/Constants.py
+++ b/resources/libraries/python/Constants.py
@@ -152,7 +152,7 @@ class Constants:
RESOURCES_TP_WRK_WWW = u"resources/traffic_profiles/wrk/www"
# VPP Communications Library LD_PRELOAD library
- VCL_LDPRELOAD_LIBRARY=u"/usr/lib/x86_64-linux-gnu/libvcl_ldpreload.so"
+ VCL_LDPRELOAD_LIBRARY = u"/usr/lib/x86_64-linux-gnu/libvcl_ldpreload.so"
# OpenVPP VAT binary name
VAT_BIN_NAME = u"vpp_api_test"
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index 49c3d41062..85e72e6463 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -175,24 +175,24 @@ class DUTSetup:
else:
shell_cmd = f"ip netns exec {namespace} sh -c"
- pgrep_cmd = f"{shell_cmd} \'pgrep {program}\'"
- ret_code, _, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
- sudo=True)
- if ret_code == 0:
+ pgrep_cmd = f"{shell_cmd} \'pgrep -c {program}\'"
+ _, stdout, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
+ sudo=True)
+ if int(stdout) == 0:
logger.trace(f"{program} is not running on {host}")
return
- ret_code, _, _ = exec_cmd(node, f"{shell_cmd} \'pkill {program}\'",
- timeout=cmd_timeout, sudo=True)
+ exec_cmd(node, f"{shell_cmd} \'pkill {program}\'",
+ timeout=cmd_timeout, sudo=True)
for attempt in range(5):
- ret_code, _, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
- sudo=True)
- if ret_code != 0:
+ _, stdout, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
+ sudo=True)
+ if int(stdout) == 0:
logger.trace(f"Attempt {attempt}: {program} is dead on {host}")
return
sleep(1)
logger.trace(f"SIGKILLing {program} on {host}")
- ret_code, _, _ = exec_cmd(node, f"{shell_cmd} \'pkill -9 {program}\'",
- timeout=cmd_timeout, sudo=True)
+ exec_cmd(node, f"{shell_cmd} \'pkill -9 {program}\'",
+ timeout=cmd_timeout, sudo=True)
@staticmethod
def verify_program_installed(node, program):
diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py
index ad95d5114d..670a81b19b 100644
--- a/resources/libraries/python/HoststackUtil.py
+++ b/resources/libraries/python/HoststackUtil.py
@@ -94,9 +94,9 @@ class HoststackUtil():
if u"parallel" in iperf3_attributes:
iperf3_cmd[u"args"] += \
f" --parallel {iperf3_attributes[u'parallel']}"
- if u"bytes" in iperf3_attributes:
+ if u"time" in iperf3_attributes:
iperf3_cmd[u"args"] += \
- f" --bytes {iperf3_attributes[u'bytes']}"
+ f" --time {iperf3_attributes[u'time']}"
return iperf3_cmd
@staticmethod
@@ -162,20 +162,22 @@ class HoststackUtil():
return stdout_log, stderr_log
@staticmethod
- def start_hoststack_test_program(node, namespace, program):
+ def start_hoststack_test_program(node, namespace, core_list, program):
"""Start the specified HostStack test program.
:param node: DUT node.
:param namespace: Net Namespace to run program in.
+ :param core_list: List of cpu's to pass to taskset to pin the test
+ program to a different set of cores on the same numa node as VPP.
:param program: Test program.
:type node: dict
:type namespace: str
+ :type core_list: str
:type program: dict
:returns: Process ID
:rtype: int
:raises RuntimeError: If node subtype is not a DUT or startup failed.
"""
- # TODO: Pin test program to core(s) on same numa node as VPP.
if node[u"type"] != u"DUT":
raise RuntimeError(u"Node type is not a DUT!")
@@ -189,8 +191,8 @@ class HoststackUtil():
env_vars = f"{program[u'env_vars']} " if u"env_vars" in program else u""
args = program[u"args"]
- cmd = f"nohup {shell_cmd} \'{env_vars}{program_name} {args} " \
- f">/tmp/{program_name}_stdout.log " \
+ cmd = f"nohup {shell_cmd} \'{env_vars}taskset --cpu-list {core_list} " \
+ f"{program_name} {args} >/tmp/{program_name}_stdout.log " \
f"2>/tmp/{program_name}_stderr.log &\'"
try:
exec_cmd_no_error(node, cmd, sudo=True)
diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py
index 3318f57d63..7a687ae200 100644
--- a/resources/libraries/python/VppConfigGenerator.py
+++ b/resources/libraries/python/VppConfigGenerator.py
@@ -495,6 +495,15 @@ class VppConfigGenerator:
path = [u"nat"]
self.add_config_item(self._nodeconfig, value, path)
+ def add_tcp_congestion_control_algorithm(self, value=u"cubic"):
+ """Add TCP congestion control algorithm.
+
+ :param value: The congestion control algorithm to use. Example: cubic
+ :type value: str
+ """
+ path = [u"tcp", u"cc-algo"]
+ self.add_config_item(self._nodeconfig, value, path)
+
def add_tcp_preallocated_connections(self, value):
"""Add TCP pre-allocated connections.
diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py
index cb0d3329d5..5b112f5a73 100644
--- a/resources/libraries/python/autogen/Regenerator.py
+++ b/resources/libraries/python/autogen/Regenerator.py
@@ -280,8 +280,8 @@ def write_default_files(in_filename, in_prolog, kwargs_list):
iface, suite_id, suite_tag = get_iface_and_suite_ids(
out_filename
)
- # The next replace is probably a noop, but it is safer to maintain
- # the same structure as for other edits.
+ # The next replace is probably a noop, but it is safer to
+ # maintain the same structure as for other edits.
out_prolog = replace_defensively(
out_prolog, old_suite_tag, suite_tag, 1,
f"Perf suite tag {old_suite_tag} should appear once.",
@@ -466,27 +466,23 @@ class Regenerator:
u"streams": 1, u"bytes_str": u"1G"}
]
hoststack_wrk_kwargs_list = [
- {u"phy_cores": i, u"frame_size": 0, u"clients": 1,
+ {u"frame_size": 0, u"phy_cores": i, u"clients": 1,
u"streams": 1, u"bytes_str": u"1G"} for i in (1, 2, 4)
]
hoststack_iperf3_kwargs_list = [
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 1,
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 1,
u"streams": 1, u"bytes_str": u"1G"},
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 1,
- u"streams": 10, u"bytes_str": u"10G"},
- {u"phy_cores": 2, u"frame_size": 0, u"clients": 1,
- u"streams": 10, u"bytes_str": u"10G"},
- {u"phy_cores": 4, u"frame_size": 0, u"clients": 1,
- u"streams": 10, u"bytes_str": u"10G"},
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 1,
+ u"streams": 10, u"bytes_str": u"1G"},
]
hoststack_quic_kwargs_list = [
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 1,
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 1,
u"streams": 1, u"bytes_str": u"100M"},
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 1,
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 1,
u"streams": 10, u"bytes_str": u"100M"},
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 10,
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 10,
u"streams": 1, u"bytes_str": u"100M"},
- {u"phy_cores": 1, u"frame_size": 0, u"clients": 10,
+ {u"frame_size": 0, u"phy_cores": 1, u"clients": 10,
u"streams": 10, u"bytes_str": u"100M"},
]
@@ -516,7 +512,7 @@ class Regenerator:
elif in_filename[-10:] in (u"-cps.robot", u"-rps.robot"):
write_tcp_files(in_filename, in_prolog,
hoststack_wrk_kwargs_list)
- elif in_filename[-10:] in (u"-bps.robot"):
+ elif in_filename[-10:] in u"-bps.robot":
write_tcp_files(in_filename, in_prolog,
hoststack_iperf3_kwargs_list if u"iperf3"
in in_filename else hoststack_quic_kwargs_list)
diff --git a/resources/libraries/python/autogen/Testcase.py b/resources/libraries/python/autogen/Testcase.py
index 6b4cfb2e06..c540d8ccec 100644
--- a/resources/libraries/python/autogen/Testcase.py
+++ b/resources/libraries/python/autogen/Testcase.py
@@ -122,9 +122,15 @@ class Testcase:
| | [Tags] | ${{cores_str}}C
| | phy_cores=${{cores_num}}
'''
+ elif u"iperf3" in suite_id:
+ template_string = f'''
+| ${{tc_num}}-9000B-${{cores_str}}c-{suite_id}
+| | [Tags] | ${{cores_str}}C | ${{clients_str}}CLIENT | ${{streams_str}}STREAM
+| | phy_cores=${{cores_num}} | clients=${{clients_num}}'''
+ template_string += f" | streams=${{streams_num}}\n"
else:
template_string = f'''
-| ${{tc_num}}-IMIX-${{cores_str}}c-{suite_id}
+| ${{tc_num}}-9000B-${{cores_str}}c-{suite_id}
| | [Tags] | ${{cores_str}}C | ${{clients_str}}CLIENT | ${{streams_str}}STREAM
| | phy_cores=${{cores_num}} | clients=${{clients_num}}'''
template_string += f" | streams=${{streams_num}}" \