summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2017-02-06 13:20:41 +0200
committerimarom <imarom@cisco.com>2017-02-06 13:21:44 +0200
commitbcea02625fb2ce43ee81e56320941dfd8ff10327 (patch)
tree1f237b927b4a3a75a53befca0e68ae765cd05b04 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
parent1570aea16299122399e14c7c281fe3d4259e63a7 (diff)
added example for functional tests using start_capture/stop_capture APIs
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
index efa450e1..8d727d6d 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
@@ -1047,6 +1047,9 @@ class STLProfile(object):
if split_mode is None:
pkts = PCAPReader(pcap_file).read_all()
+ if len(pkts) == 0:
+ raise STLError("'{0}' does not contain any packets".format(pcap_file))
+
return STLProfile.__pkts_to_streams(pkts,
ipg_usec,
min_ipg_usec,
@@ -1056,7 +1059,9 @@ class STLProfile(object):
packet_hook)
else:
pkts_a, pkts_b = PCAPReader(pcap_file).read_all(split_mode = split_mode)
-
+ if (len(pkts_a) + len(pkts_b)) == 0:
+ raise STLError("'{0}' does not contain any packets".format(pcap_file))
+
# swap the packets if a is empty, or the ts of first packet in b is earlier
if not pkts_a:
pkts_a, pkts_b = pkts_b, pkts_a