summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-10 08:21:58 -0500
committerimarom <imarom@cisco.com>2016-02-10 08:22:53 -0500
commitcd4cf9917fb516a5b5575b932ee71c64b4214ed4 (patch)
treeb94fc20bdd916c8448eb79f4d194a765155ed2fe /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
parent289e0fae5a115ec2e9dda53d63ddd40cf970be25 (diff)
support for pcap/cap files (console, simulation and API)
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
index 0828fbd9..ca02f004 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
@@ -592,7 +592,7 @@ class CScapyTRexPktBuilder(CTrexPktBuilderInterface):
Using this class the user can also define how TRex will handle the packet by specifying the VM setting.
pkt could be Scapy pkt or pcap file name
"""
- def __init__(self, pkt = None, vm = None):
+ def __init__(self, pkt = None, pkt_buffer = None, vm = None):
"""
Instantiate a CTRexPktBuilder object
@@ -609,12 +609,17 @@ class CScapyTRexPktBuilder(CTrexPktBuilderInterface):
self.metadata=""
was_set=False
+ if pkt != None and pkt_buffer != None:
+ raise CTRexPacketBuildException(-15, "packet builder cannot be provided with both pkt and pkt_buffer")
# process packet
if pkt != None:
self.set_packet(pkt)
was_set=True
+ if pkt_buffer != None:
+ self.set_pkt_as_str(pkt_buffer)
+
# process VM
if vm != None:
if not isinstance(vm, (CTRexScRaw, list)):