summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stf
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stf')
-rwxr-xr-xscripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
index 074d9060..4fd1e4c7 100755
--- a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
+++ b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
@@ -592,7 +592,10 @@ class CTRexClient(object):
"""
try:
- return binascii.a2b_base64(self.server.get_trex_daemon_log())
+ res = binascii.a2b_base64(self.server.get_trex_daemon_log())
+ if type(res) is bytes:
+ return res.decode()
+ return res
except AppError as err:
self._handle_AppError_exception(err.args[0])
except ProtocolError:
@@ -613,7 +616,10 @@ class CTRexClient(object):
"""
try:
- return binascii.a2b_base64(self.server.get_trex_log())
+ res = binascii.a2b_base64(self.server.get_trex_log())
+ if type(res) is bytes:
+ return res.decode()
+ return res
except AppError as err:
self._handle_AppError_exception(err.args[0])
except ProtocolError:
@@ -636,7 +642,10 @@ class CTRexClient(object):
try:
version_dict = OrderedDict()
- result_lines = binascii.a2b_base64(self.server.get_trex_version()).split('\n')
+ res = binascii.a2b_base64(self.server.get_trex_version())
+ if type(res) is bytes:
+ res = res.decode()
+ result_lines = res.split('\n')
for line in result_lines:
if not line:
continue
@@ -1224,13 +1233,12 @@ class CTRexResult(object):
continue
hist_last_keys = deque([res['histogram'][-1]['key']], maxlen = 2)
sum_high = 0.0
-
- for i, elem in enumerate(reversed(res['histogram'])):
+ for elem in reversed(res['histogram']):
sum_high += elem['val']
hist_last_keys.append(elem['key'])
if sum_high / res['cnt'] >= filtered_latency_amount:
break
- result[max_port] = sum(hist_last_keys) / len(hist_last_keys)
+ result[max_port] = (hist_last_keys[0] + hist_last_keys[-1]) / 2
else:
return {}
return result