aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-12-18 16:28:28 +0000
committerPeter Mikus <pmikus@cisco.com>2020-01-02 07:03:37 +0000
commitefcdd3eadfadb2814a9e3b67cce84b5dc89c7108 (patch)
tree36e81c492f55e65496e6cea06396650ecaedc44b /resources/libraries/python/TrafficGenerator.py
parent13d39ef24703505a44e5983ce42df2a1e3ca67af (diff)
TREX: Ability to configure from outside TrafficGenerator.py
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: Ia9832e5e65dbcf2d4f99c52fd0570d456262ab9a
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-rw-r--r--resources/libraries/python/TrafficGenerator.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 007079f254..a73e471f77 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -286,6 +286,7 @@ class TrafficGenerator(AbstractMeasurer):
self._node,
f"sh -c 'cat << EOF > /etc/trex_cfg.yaml\n"
f"- version: 2\n"
+ f" limit_memory: {Constants.TREX_LIMIT_MEMORY}\n"
f" interfaces: [\"{if1_pci}\",\"{if2_pci}\"]\n"
f" port_info:\n"
f" - dest_mac: [{dst_mac0}]\n"
@@ -300,6 +301,7 @@ class TrafficGenerator(AbstractMeasurer):
self._node,
f"sh -c 'cat << EOF > /etc/trex_cfg.yaml\n"
f"- version: 2\n"
+ f" limit_memory: {Constants.TREX_LIMIT_MEMORY}\n"
f" interfaces: [\"{if1_pci}\",\"{if2_pci}\"]\n"
f" port_info:\n"
f" - ip: [{if1_addr}]\n"
@@ -343,10 +345,10 @@ class TrafficGenerator(AbstractMeasurer):
# Start TRex.
cmd = f"sh -c \"cd {Constants.TREX_INSTALL_DIR}/scripts/ && " \
- f"nohup ./t-rex-64 " \
- f"--hdrh{u' --astf' if osi_layer == u'L7' else u''} " \
- f"--prefix $(hostname) -i -c 7 > /tmp/trex.log 2>&1 &\" > " \
- f"/dev/null"
+ f"nohup ./t-rex-64 -i -c {Constants.TREX_CORE_COUNT} --hdrh " \
+ f"{u' --astf' if osi_layer == u'L7' else u''} " \
+ f"--prefix $(hostname) {Constants.TREX_EXTRA_CMDLINE} " \
+ f"> /tmp/trex.log 2>&1 &\" > /dev/null"
try:
exec_cmd_no_error(self._node, cmd, sudo=True)
except RuntimeError: