summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_pcap.py4
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py15
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py27
3 files changed, 19 insertions, 27 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_pcap.py b/scripts/automation/trex_control_plane/stl/examples/stl_pcap.py
index eae0f18b..98af6134 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_pcap.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_pcap.py
@@ -39,14 +39,12 @@ def inject_pcap (pcap_file, server, port, loop_count, ipg_usec, use_vm, remove_f
c.reset(ports = [port])
c.clear_stats()
- d = c.push_pcap(pcap_file,
+ c.push_pcap(pcap_file,
ipg_usec = ipg_usec,
count = loop_count,
vm = vm,
packet_hook = packet_hook)
- STLSim().run(d, outfile = 'test.cap')
-
c.wait_on_traffic()
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
index 11e80b9a..62724e64 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
@@ -40,18 +40,11 @@ class BpSimException(Exception):
# stateless simulation
class STLSim(object):
- def __init__ (self, bp_sim_path = None, handler = 0, port_id = 0, api_h = "dummy"):
+ def __init__ (self, bp_sim_path, handler = 0, port_id = 0, api_h = "dummy"):
- if not bp_sim_path:
- # auto find scripts
- m = re.match(".*/trex-core", os.getcwd())
- if not m:
- raise STLError('cannot find BP sim path, please provide it')
-
- self.bp_sim_path = os.path.join(m.group(0), 'scripts')
-
- else:
- self.bp_sim_path = bp_sim_path
+ self.bp_sim_path = os.path.abspath(bp_sim_path)
+ if not os.path.exists(self.bp_sim_path):
+ raise STLError('BP sim path %s does not exist' % self.bp_sim_path)
# dummies
self.handler = handler
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
index 94a45577..0ec98a0d 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py
@@ -1020,19 +1020,20 @@ class CLatencyStats(CTRexStats):
output[int_pg_id]['err_cntrs'] = current_pg['err_cntrs']
output[int_pg_id]['latency'] = {}
- output[int_pg_id]['latency']['last_max'] = current_pg['latency']['last_max']
- output[int_pg_id]['latency']['jitter'] = current_pg['latency']['jitter']
- if current_pg['latency']['h'] != "":
- output[int_pg_id]['latency']['average'] = current_pg['latency']['h']['s_avg']
- output[int_pg_id]['latency']['total_max'] = current_pg['latency']['h']['max_usec']
- output[int_pg_id]['latency']['histogram'] = {elem['key']: elem['val']
- for elem in current_pg['latency']['h']['histogram']}
- zero_count = current_pg['latency']['h']['cnt'] - current_pg['latency']['h']['high_cnt']
- if zero_count != 0:
- output[int_pg_id]['latency']['total_min'] = 1
- output[int_pg_id]['latency']['histogram'][0] = zero_count
- elif output[int_pg_id]['latency']['histogram']:
- output[int_pg_id]['latency']['total_min'] = min(output[int_pg_id]['latency']['histogram'].keys())
+ if 'latency' in current_pg:
+ for field in ['jitter', 'average', 'total_max', 'last_max']:
+ if field in current_pg['latency']:
+ output[int_pg_id]['latency'][field] = current_pg['latency'][field]
+ else:
+ output[int_pg_id]['latency'][field] = StatNotAvailable(field)
+
+ if 'histogram' in current_pg['latency']:
+ output[int_pg_id]['latency']['histogram'] = {int(elem): current_pg['latency']['histogram'][elem]
+ for elem in current_pg['latency']['histogram']}
+ min_val = min(output[int_pg_id]['latency']['histogram'].keys())
+ if min_val == 0:
+ min_val = 2
+ output[int_pg_id]['latency']['total_min'] = min_val
else:
output[int_pg_id]['latency']['total_min'] = StatNotAvailable('total_min')