aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-10-11 12:12:48 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-10-11 12:57:32 +0000
commit1fc868d1126b3e01afbadaac1d72b58d60f6e283 (patch)
tree5f88e6f2eaf0103e9cc9d645bb5f8004a89e36b5 /resources/libraries/python
parent86ec9713ecde3d92ec4585d487ddfac5077428c8 (diff)
feat(core): Multilink TRex Async mode
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I02468203f3eb4545b6662bad2ce9aa72ecd5a5f6
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/TrafficGenerator.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 6f4483b970..5b98a6ba51 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -174,7 +174,7 @@ class TrafficGenerator(AbstractMeasurer):
self.ramp_up_duration = None
self.state_timeout = None
# Transient data needed for async measurements.
- self._xstats = (None, None)
+ self._xstats = ()
@property
def node(self):
@@ -499,11 +499,11 @@ class TrafficGenerator(AbstractMeasurer):
command_line = OptionString().add(u"python3")
dirname = f"{Constants.REMOTE_FW_DIR}/GPL/tools/trex"
command_line.add(f"'{dirname}/trex_stl_stop.py'")
- command_line.change_prefix(u"--")
+ command_line.add("--xstat")
for index, value in enumerate(self._xstats):
if value is not None:
- value = value.replace(u"'", u"\"")
- command_line.add_equals(f"xstat{index}", f"'{value}'")
+ value = value.replace("'", "\"")
+ command_line.add(f"'{value}'")
stdout, _ = exec_cmd_no_error(
node, command_line,
message=u"T-Rex STL runtime error!"
@@ -654,7 +654,7 @@ class TrafficGenerator(AbstractMeasurer):
self._sent = None
self._loss = None
self._latency = None
- xstats = [None, None]
+ xstats = []
self._l7_data = dict()
self._l7_data[u"client"] = dict()
self._l7_data[u"client"][u"active_flows"] = None
@@ -689,8 +689,6 @@ class TrafficGenerator(AbstractMeasurer):
if f"Xstats snapshot {index}: " in line:
xstats[index] = line[19:]
index += 1
- if index == 2:
- break
self._xstats = tuple(xstats)
else:
self._target_duration = duration
@@ -761,14 +759,12 @@ class TrafficGenerator(AbstractMeasurer):
self._loss = None
self._latency = None
- xstats = [None, None]
+ xstats = []
index = 0
for line in stdout.splitlines():
if f"Xstats snapshot {index}: " in line:
- xstats[index] = line[19:]
+ xstats.append(line[19:])
index += 1
- if index == 2:
- break
self._xstats = tuple(xstats)
else:
self._target_duration = duration