From cd4cf9917fb516a5b5575b932ee71c64b4214ed4 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 10 Feb 2016 08:21:58 -0500 Subject: support for pcap/cap files (console, simulation and API) --- .../stl/trex_stl_lib/trex_stl_packet_builder_scapy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py') 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)): -- cgit 1.2.3-korg