diff options
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py')
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 7 |
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 165942d8..6ee587c3 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 @@ -7,6 +7,7 @@ from .trex_stl_packet_builder_scapy import STLPktBuilder, Ether, IP, UDP, TCP, R from collections import OrderedDict, namedtuple from scapy.utils import ltoa +from scapy.error import Scapy_Exception import random import yaml import base64 @@ -967,7 +968,11 @@ class STLProfile(object): streams = [] last_ts_usec = 0 - pkts = RawPcapReader(pcap_file).read_all() + try: + pkts = RawPcapReader(pcap_file).read_all() + except Scapy_Exception as e: + raise STLError("failed to open PCAP file '{0}'".format(pcap_file)) + for i, (cap, meta) in enumerate(pkts, start = 1): # IPG - if not provided, take from cap |