summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_pcap_remote.py10
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py13
3 files changed, 16 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index aae8781e..ac511561 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,7 +37,7 @@ scripts/stl/exportedFile.pcap
scripts/exp/stl_multi_burst1-0.erf
scripts/exp/stl_multi_pkt1-0.erf
scripts/exp/stl_multi_pkt2-0.erf
-scripts/pcap_remote_basic-0.erf
+scripts/exp/pcap_remote_basic-0.erf
scripts/exp/pcap_remote_duration-0.erf
scripts/exp/pcap_remote_loop-0.erf
scripts/exp/stl_single_pkt_burst1-0.erf
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_pcap_remote.py b/scripts/automation/trex_control_plane/stl/examples/stl_pcap_remote.py
index 2270b51c..c47eee31 100644
--- a/scripts/automation/trex_control_plane/stl/examples/stl_pcap_remote.py
+++ b/scripts/automation/trex_control_plane/stl/examples/stl_pcap_remote.py
@@ -13,8 +13,10 @@ def inject_pcap (c, pcap_file, port, loop_count, ipg_usec, duration):
# assume 100 seconds is enough - but can be more
c.wait_on_traffic(ports = [port], timeout = 100)
- #stats = c.get_stats()
- #opackets = stats[port]['opackets']
+ stats = c.get_stats()
+ opackets = stats[port]['opackets']
+
+ return opackets
#print("{0} packets were Tx on port {1}\n".format(opackets, port))
@@ -102,8 +104,8 @@ def start (args):
for i, cap in enumerate(caps, start = 1):
before = time.time()
print ("{:} CAP {:} @ {:} - ".format(i, cap, sizeof_fmt(os.path.getsize(cap)))),
- inject_pcap(c, cap, options.port, options.loop_count, options.ipg, options.duration)
- print("took {:.2f} seconds").format(time.time()-before)
+ injected = inject_pcap(c, cap, options.port, options.loop_count, options.ipg, options.duration)
+ print("took {:.2f} seconds for {:} packets").format(time.time() - before, injected)
except STLError as e:
print(e)
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index 9f96b237..d1352804 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -1931,7 +1931,8 @@ class STLClient(object):
ipg_usec = None,
speedup = 1.0,
count = 1,
- duration = -1):
+ duration = -1,
+ force = False):
"""
Push a local PCAP to the server
This is equivalent to loading a PCAP file to a profile
@@ -1958,6 +1959,9 @@ class STLClient(object):
duration: float
Limit runtime by duration in seconds
+ force: bool
+ Ignore file size limit - push any file size to the server
+
:raises:
+ :exc:`STLError`
@@ -1972,8 +1976,8 @@ class STLClient(object):
validate_type('duration', duration, (float, int))
# no support for > 1MB PCAP - use push remote
- if os.path.getsize(pcap_filename) > (1024 * 1024):
- raise STLError("PCAP size of {:,} B is too big for local push - consider using remote push".format(os.path.getsize(pcap_filename)))
+ if not force and os.path.getsize(pcap_filename) > (1024 * 1024):
+ raise STLError("PCAP size of {:} is too big for local push - consider using remote push or provide 'force'".format(format_num(os.path.getsize(pcap_filename), suffix = 'B')))
self.remove_all_streams(ports = ports)
@@ -2695,7 +2699,8 @@ class STLClient(object):
ipg_usec = opts.ipg_usec,
speedup = opts.speedup,
count = opts.count,
- duration = opts.duration)
+ duration = opts.duration,
+ force = opts.force)