aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/TrafficGenerator.py8
-rwxr-xr-xresources/tools/trex/trex_stateless_profile.py4
2 files changed, 12 insertions, 0 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 35a701f362..9e0a1d2735 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -422,6 +422,14 @@ class TrafficGenerator(AbstractMeasurer):
ssh.connect(self._node)
reorder = self._ifaces_reordered # Just to make the next line fit.
p_0, p_1 = (rx_port, tx_port) if reorder else (tx_port, rx_port)
+ # Values from Robot can introduce type unicode,
+ # we need to encode them, so that repr() does not lead with 'u'.
+ if isinstance(rate, unicode):
+ rate = rate.encode("utf-8")
+ if isinstance(duration, unicode):
+ duration = duration.encode("utf-8")
+ if isinstance(warmup_time, unicode):
+ warmup_time = warmup_time.encode("utf-8")
command = (
"sh -c '{tool}/resources/tools/trex/trex_stateless_profile.py"
" --profile {prof}/resources/traffic_profiles/trex/{traffic}.py"
diff --git a/resources/tools/trex/trex_stateless_profile.py b/resources/tools/trex/trex_stateless_profile.py
index 9b629754ca..aa68a014b8 100755
--- a/resources/tools/trex/trex_stateless_profile.py
+++ b/resources/tools/trex/trex_stateless_profile.py
@@ -245,6 +245,10 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0,
else:
if client:
client.disconnect()
+ if isinstance(rate, unicode):
+ rate = rate.encode("utf-8")
+ if isinstance(duration, unicode):
+ duration = duration.encode("utf-8")
print("rate={0!r}, totalReceived={1}, totalSent={2}, "
"frameLoss={3}, latencyStream0(usec)={4}, "
"latencyStream1(usec)={5}, targetDuration={d!r}".