From 4145ff0ff4b8fbc9c376ab80cb02a8bab34c28bb Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sat, 20 Feb 2016 20:00:01 +0200 Subject: hlt updates: split by cores, direction --- .../trex_stl_lib/trex_stl_packet_builder_scapy.py | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (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 24a7301b..fc4750c3 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 @@ -28,17 +28,24 @@ class CTRexPacketBuildException(Exception): ################################################################################################ -def ipv4_str_to_num (ipv4_buffer): +def _buffer_to_num(str_buffer): + assert type(str_buffer)==str, 'type of str_buffer is not str' + res=0 + for i in str_buffer: + res = res << 8 + res += ord(i) + return res + +def ipv4_str_to_num (ipv4_buffer): assert type(ipv4_buffer)==str, 'type of ipv4_buffer is not str' assert len(ipv4_buffer)==4, 'size of ipv4_buffer is not 4' - res=0 - shift=24 - for i in ipv4_buffer: - res = res + (ord(i)<