aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-05-14 10:51:15 +0200
committerJan Gelety <jgelety@cisco.com>2019-05-16 12:16:26 +0000
commitac259ea21d8663dbdaea21589bace5f5f8ea94c7 (patch)
treedbdb4e71deabf6bb7a5dcdcfb6fc72f6af5c878e /resources/libraries/python
parent0903fff5fdd647e4b5357c107219142738d377e9 (diff)
Avoid !r format appending u on unicode
Change-Id: I2c0877f4d8b6cad2694c43a4350998cd2b830680 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/TrafficGenerator.py8
1 files changed, 8 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"