diff options
author | 2016-03-04 17:10:33 +0200 | |
---|---|---|
committer | 2016-03-04 17:10:33 +0200 | |
commit | 2a3171f73e838fccbc82d2d8553e36c7c3820e28 (patch) | |
tree | b9a77061079deeb96de9ce69958582fe27c4bce3 /scripts/automation/trex_control_plane/stl/trex_stl_lib | |
parent | 5650f2add4b03ef8d51d670af5db9fccade80f3f (diff) |
add manual padding to 60 bytes with zeros
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py | 14 | ||||
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 2 |
2 files changed, 6 insertions, 10 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 a3430c79..6a2e268f 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 @@ -950,20 +950,18 @@ class CScapyTRexPktBuilder(CTrexPktBuilderInterface): # for buffer, promote to a scapy packet if self.pkt_raw: self.pkt = Ether(self.pkt_raw) - if self.remove_fcs and self.pkt.lastlayer().name == 'Padding': - self.pkt.lastlayer().underlayer.remove_payload() - self.pkt.build() self.pkt_raw = None # regular scapy packet - elif self.pkt: - self.pkt.build() - - else: + elif not self.pkt: # should not reach here raise CTRexPacketBuildException(-11, 'empty packet') - + if self.remove_fcs and self.pkt.lastlayer().name == 'Padding': + self.pkt.lastlayer().underlayer.remove_payload() + if len(self.pkt) < 60: # simulator can write padding with non-zeros, set it explicit + self.pkt /= Padding('\x00' * (60 - len(self.pkt))) + self.pkt.build() self.is_pkt_built = True def _pkt_layer_offset (self,layer_name): 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 c41fa0c2..5aa544ab 100644 --- 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 @@ -344,8 +344,6 @@ class STLStream(object): imports_arr = [] if 'MPLS(' in packet_command: imports_arr.append('from scapy.contrib.mpls import MPLS') - if 'VXLAN(' in packet_command: - imports_arr.append('from scapy.contrib.mpls import MPLS') imports = '\n'.join(imports_arr) if payload: |