summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stf
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-21 15:07:05 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-21 15:07:05 +0300
commit6dc9c07fda0508d46ddccdb6888bae844b78361b (patch)
treefd502f34605eb40e379268cfb3fa52fe59a6c2de /scripts/automation/trex_control_plane/stf
parentd42a2a5567958ea052aac0ab0dc291876f97f4e2 (diff)
stateful API: avoid zero division
Diffstat (limited to 'scripts/automation/trex_control_plane/stf')
-rwxr-xr-xscripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py11
1 files changed, 7 insertions, 4 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 412f52d4..27428e69 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
@@ -728,8 +728,11 @@ class CTRexClient(object):
def get_files_list (self, path):
"""
- Gets a tuple (dirs, files) with lists of dirs and files from given path.
- Path is limited to /tmp/trex_files or TRex directory (can be used relative path)
+ Gets a list of dirs and files either from /tmp/trex_files or path relative to TRex server.
+
+ :parameters:
+ path : str
+ a path to directory to read.
:return:
Tuple: list of dirs and list of files in given path
@@ -751,7 +754,7 @@ class CTRexClient(object):
def get_file(self, filepath):
"""
- Gets a file from /tmp/trex_files or TRex server directory.
+ Gets content of file as bytes string from /tmp/trex_files or TRex server directory.
:parameters:
filepath : str
@@ -1285,7 +1288,7 @@ class CTRexResult(object):
for elem in reversed(res['histogram']):
sum_high += elem['val']
hist_last_keys.append(elem['key'])
- if sum_high / res['cnt'] >= filtered_latency_amount:
+ if sum_high >= filtered_latency_amount * res['cnt']:
break
result[max_port] = (hist_last_keys[0] + hist_last_keys[-1]) / 2
else: