From a9c35eacd8caebe65e8c685f9285740b2764ea21 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sun, 28 Feb 2016 18:04:50 +0200 Subject: hltapi: remove default for l3_protocol and l4_protocol, add several profiles --- .../unit_tests/functional_tests/stl_basic_tests.py | 8 +++++ .../stl/trex_stl_lib/trex_stl_hltapi.py | 37 +++++++++++++-------- scripts/exp/hlt_4vlans.pcap | Bin 0 -> 2344 bytes scripts/exp/hlt_david1.pcap | Bin 4192 -> 4192 bytes scripts/exp/hlt_david2.pcap | Bin 4158 -> 4158 bytes scripts/exp/hlt_david3.pcap | Bin 10264 -> 10264 bytes scripts/exp/hlt_david4.pcap | Bin 1624 -> 1624 bytes scripts/exp/hlt_framesize_vm.pcap | Bin 0 -> 8296 bytes scripts/exp/hlt_ipv6_default.pcap | Bin 0 -> 3624 bytes scripts/exp/hlt_ipv6_ranges.pcap | Bin 0 -> 3624 bytes scripts/exp/hlt_l3_length_vm.pcap | Bin 0 -> 31624 bytes scripts/exp/hlt_vlan_default.pcap | Bin 0 -> 1624 bytes scripts/exp/hlt_vlans_vm.pcap | Bin 0 -> 2344 bytes scripts/stl/hlt/hlt_4vlans.py | 28 ++++++++++++++++ scripts/stl/hlt/hlt_framesize_vm.py | 36 ++++++++++++++++++++ scripts/stl/hlt/hlt_imix_4rates.py | 1 + scripts/stl/hlt/hlt_imix_default.py | 3 +- scripts/stl/hlt/hlt_ip_ranges.py | 29 ++++++++++++++++ scripts/stl/hlt/hlt_ipv6_default.py | 25 ++++++++++++++ scripts/stl/hlt/hlt_ipv6_ranges.py | 25 ++++++++++++++ scripts/stl/hlt/hlt_l3_length_vm.py | 36 ++++++++++++++++++++ scripts/stl/hlt/hlt_tcp_ranges.py | 4 ++- scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py | 2 ++ scripts/stl/hlt/hlt_udp_ports.py | 3 +- scripts/stl/hlt/hlt_udp_random_ports.py | 3 +- scripts/stl/hlt/hlt_vlan_default.py | 23 +++++++++++++ scripts/stl/hlt/hlt_vlans_vm.py | 30 +++++++++++++++++ 27 files changed, 275 insertions(+), 18 deletions(-) create mode 100644 scripts/exp/hlt_4vlans.pcap create mode 100644 scripts/exp/hlt_framesize_vm.pcap create mode 100644 scripts/exp/hlt_ipv6_default.pcap create mode 100644 scripts/exp/hlt_ipv6_ranges.pcap create mode 100644 scripts/exp/hlt_l3_length_vm.pcap create mode 100644 scripts/exp/hlt_vlan_default.pcap create mode 100644 scripts/exp/hlt_vlans_vm.pcap create mode 100755 scripts/stl/hlt/hlt_4vlans.py create mode 100755 scripts/stl/hlt/hlt_framesize_vm.py create mode 100755 scripts/stl/hlt/hlt_ip_ranges.py create mode 100755 scripts/stl/hlt/hlt_ipv6_default.py create mode 100755 scripts/stl/hlt/hlt_ipv6_ranges.py create mode 100755 scripts/stl/hlt/hlt_l3_length_vm.py create mode 100755 scripts/stl/hlt/hlt_vlan_default.py create mode 100755 scripts/stl/hlt/hlt_vlans_vm.py diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py index bca44cbe..e31ef59f 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py @@ -212,6 +212,14 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ['hlt/hlt_tcp_ranges.py', '-m 1 -l 20', True], ['hlt/hlt_udp_ports.py', '-m 1 -l 20', True], ['hlt/hlt_udp_random_ports.py', '-m 1 -l 20', True], + #['hlt/hlt_ip_ranges.py', '-m 1 -l 20', True], # can't run now, random on full range issue + ['hlt/hlt_framesize_vm.py', '-m 1 -l 20', True], + ['hlt/hlt_l3_length_vm.py', '-m 1 -l 20', True], + ['hlt/hlt_vlan_default.py', '-m 1 -l 20', True], + ['hlt/hlt_4vlans.py', '-m 1 -l 20', True], + ['hlt/hlt_vlans_vm.py', '-m 1 -l 20', True], + ['hlt/hlt_ipv6_default.py', '-m 1 -l 20', True], + ['hlt/hlt_ipv6_ranges.py', '-m 1 -l 20', True], ) for obj in p: diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py index 7bd43333..3fad0bfb 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py @@ -79,7 +79,7 @@ traffic_config_kwargs = { 'vlan_cfi': 1, 'vlan_protocol_tag_id': None, #L3, general - 'l3_protocol': 'ipv4', # ( ipv4 | ipv6 ) + 'l3_protocol': None, # ( ipv4 | ipv6 ) 'l3_length_min': 110, 'l3_length_max': 238, 'l3_length_step': 1, @@ -122,7 +122,7 @@ traffic_config_kwargs = { 'ipv6_dst_step': 1, # we are changing only 32 lowest bits; can be ipv6 or number 'ipv6_dst_count': 1, #L4, TCP - 'l4_protocol': 'tcp', # ( tcp | udp ) + 'l4_protocol': None, # ( tcp | udp ) 'tcp_src_port': 1024, 'tcp_dst_port': 80, 'tcp_seq_num': 1, @@ -673,6 +673,8 @@ def STLHltStream(**user_kwargs): rate_key = intersect_rate_args[0] except IndexError: rate_key = 'rate_percent' + if rate_key is 'rate_percent' and float(kwargs['rate_percent']) > 100: + raise STLError('rate_percent should not exceed 100%') if kwargs['length_mode'] == 'imix': # several streams with given length streams_arr = [] @@ -732,7 +734,7 @@ def STLHltStream(**user_kwargs): # stream generation try: stream = STLStream(packet = packet, - random_seed = 1 if kwargs['consistent_random'] else 0, + random_seed = 1 if is_true(kwargs['consistent_random']) else 0, #enabled = True, #self_start = True, mode = transmit_mode_class, @@ -894,7 +896,9 @@ def generate_packet(**user_kwargs): base_pkt = l2_layer ### L3 ### - if kwargs['l3_protocol'] == 'ipv4': + if kwargs['l3_protocol'] is None: + l3_layer = None + elif kwargs['l3_protocol'] == 'ipv4': #fields_desc = [ BitField("version" , 4 , 4), # BitField("ihl", None, 4), # XByteField("tos", 0), @@ -1088,12 +1092,15 @@ def generate_packet(**user_kwargs): raise STLError('ipv6_dst_mode %s is not supported' % kwargs['ipv6_dst_mode']) vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = var_name, pkt_offset = 'IPv6.dst', offset_fixup = 12, add_val = add_val)) - else: + elif kwargs['l3_protocol'] is not None: raise NotImplementedError("l3_protocol '%s' is not supported by TRex yet." % kwargs['l3_protocol']) - base_pkt /= l3_layer + if l3_layer is not None: + base_pkt /= l3_layer ### L4 ### + l4_layer = None if kwargs['l4_protocol'] == 'tcp': + assert kwargs['l3_protocol'] in ('ipv4', 'ipv6'), 'TCP must be over ipv4/ipv6' #fields_desc = [ ShortEnumField("sport", 20, TCP_SERVICES), # ShortEnumField("dport", 80, TCP_SERVICES), # IntField("seq", 0), @@ -1105,6 +1112,7 @@ def generate_packet(**user_kwargs): # XShortField("chksum", None), # ShortField("urgptr", 0), # TCPOptionsField("options", {}) ] + tcp_flags = ('F' if kwargs['tcp_fin_flag'] else '' + 'S' if kwargs['tcp_syn_flag'] else '' + 'R' if kwargs['tcp_rst_flag'] else '' + @@ -1190,6 +1198,7 @@ def generate_packet(**user_kwargs): vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = var_name, pkt_offset = 'TCP.dport', add_val = add_val)) elif kwargs['l4_protocol'] == 'udp': + assert kwargs['l3_protocol'] in ('ipv4', 'ipv6'), 'UDP must be over ipv4/ipv6' #fields_desc = [ ShortEnumField("sport", 53, UDP_SERVICES), # ShortEnumField("dport", 53, UDP_SERVICES), # ShortField("len", None), @@ -1261,9 +1270,10 @@ def generate_packet(**user_kwargs): else: raise STLError('udp_dst_port_mode %s is not supported' % kwargs['udp_dst_port_mode']) vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = var_name, pkt_offset = 'UDP.dport', add_val = add_val)) - else: - raise NotImplementedError("l4_protocol '%s' is not supported by TRex yet." % kwargs['l3_protocol']) - base_pkt /= l4_layer + elif kwargs['l4_protocol'] is not None: + raise NotImplementedError("l4_protocol '%s' is not supported by TRex yet." % kwargs['l4_protocol']) + if l4_layer is not None: + base_pkt /= l4_layer trim_dict = {'increment': 'inc', 'decrement': 'dec', 'random': 'random'} length_mode = kwargs['length_mode'] @@ -1304,11 +1314,10 @@ def generate_packet(**user_kwargs): payload_len = kwargs['l3_length_max'] + len(l2_layer) - len(base_pkt) vm_cmds.append(CTRexVmDescTrimPktSize('pkt_len')) - if l3_layer.name == 'IP' or l4_layer.name == 'UDP': # add here other things need to fix due to size change - if l3_layer.name == 'IP': - vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = 'pkt_len', pkt_offset = 'IP.len', add_val = -len(l2_layer))) - if l4_layer.name == 'UDP': - vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = 'pkt_len', pkt_offset = 'UDP.len', add_val = -len(l2_layer) - len(l3_layer))) + if (l3_layer and l3_layer.name == 'IP'): + vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = 'pkt_len', pkt_offset = 'IP.len', add_val = -len(l2_layer))) + if (l4_layer and l4_layer.name == 'UDP'): + vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = 'pkt_len', pkt_offset = 'UDP.len', add_val = -len(l2_layer) - len(l3_layer))) else: raise STLError('length_mode should be one of the following: %s' % ['auto', 'fixed'] + trim_dict.keys()) diff --git a/scripts/exp/hlt_4vlans.pcap b/scripts/exp/hlt_4vlans.pcap new file mode 100644 index 00000000..642bbee5 Binary files /dev/null and b/scripts/exp/hlt_4vlans.pcap differ diff --git a/scripts/exp/hlt_david1.pcap b/scripts/exp/hlt_david1.pcap index 6c9a1cc8..2ce91a93 100644 Binary files a/scripts/exp/hlt_david1.pcap and b/scripts/exp/hlt_david1.pcap differ diff --git a/scripts/exp/hlt_david2.pcap b/scripts/exp/hlt_david2.pcap index 2c76a8a8..5474dc35 100644 Binary files a/scripts/exp/hlt_david2.pcap and b/scripts/exp/hlt_david2.pcap differ diff --git a/scripts/exp/hlt_david3.pcap b/scripts/exp/hlt_david3.pcap index d7c43f2b..ce492579 100644 Binary files a/scripts/exp/hlt_david3.pcap and b/scripts/exp/hlt_david3.pcap differ diff --git a/scripts/exp/hlt_david4.pcap b/scripts/exp/hlt_david4.pcap index 520675c4..f03cbd7a 100644 Binary files a/scripts/exp/hlt_david4.pcap and b/scripts/exp/hlt_david4.pcap differ diff --git a/scripts/exp/hlt_framesize_vm.pcap b/scripts/exp/hlt_framesize_vm.pcap new file mode 100644 index 00000000..69c2e7d9 Binary files /dev/null and b/scripts/exp/hlt_framesize_vm.pcap differ diff --git a/scripts/exp/hlt_ipv6_default.pcap b/scripts/exp/hlt_ipv6_default.pcap new file mode 100644 index 00000000..9ca1cd81 Binary files /dev/null and b/scripts/exp/hlt_ipv6_default.pcap differ diff --git a/scripts/exp/hlt_ipv6_ranges.pcap b/scripts/exp/hlt_ipv6_ranges.pcap new file mode 100644 index 00000000..a05aca32 Binary files /dev/null and b/scripts/exp/hlt_ipv6_ranges.pcap differ diff --git a/scripts/exp/hlt_l3_length_vm.pcap b/scripts/exp/hlt_l3_length_vm.pcap new file mode 100644 index 00000000..fd028414 Binary files /dev/null and b/scripts/exp/hlt_l3_length_vm.pcap differ diff --git a/scripts/exp/hlt_vlan_default.pcap b/scripts/exp/hlt_vlan_default.pcap new file mode 100644 index 00000000..fd4d3bda Binary files /dev/null and b/scripts/exp/hlt_vlan_default.pcap differ diff --git a/scripts/exp/hlt_vlans_vm.pcap b/scripts/exp/hlt_vlans_vm.pcap new file mode 100644 index 00000000..b5107639 Binary files /dev/null and b/scripts/exp/hlt_vlans_vm.pcap differ diff --git a/scripts/stl/hlt/hlt_4vlans.py b/scripts/stl/hlt/hlt_4vlans.py new file mode 100755 index 00000000..bdbd3d31 --- /dev/null +++ b/scripts/stl/hlt/hlt_4vlans.py @@ -0,0 +1,28 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Eth/802.1Q/802.1Q/802.1Q/802.1Q/IPv6/TCP stream without VM + Missing values will be filled with defaults + ''' + + def create_streams (self, direction = 0): + + return STLHltStream(frame_size = 100, + vlan_id = [1, 2, 3, 4], # can be either array or string separated by spaces + vlan_protocol_tag_id = '8100 0x8100', # hex with optional prefix '0x' + vlan_user_priority = '4 3 2', # forth will be default + l3_protocol = 'ipv6', + l4_protocol = 'tcp', + direction = direction) + + def get_streams (self, direction = 0): + return self.create_streams(direction = direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_framesize_vm.py b/scripts/stl/hlt/hlt_framesize_vm.py new file mode 100755 index 00000000..ed1ac54e --- /dev/null +++ b/scripts/stl/hlt/hlt_framesize_vm.py @@ -0,0 +1,36 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Two Eth/IP/UDP streams with VM to get different size of packet by frame_size + ''' + + def create_streams (self, direction = 0): + return [STLHltStream(length_mode = 'increment', + frame_size_min = 100, + frame_size_max = 3000, + l3_protocol = 'ipv4', + l4_protocol = 'udp', + rate_bps = 1000000, + direction = direction, + ), + STLHltStream(length_mode = 'decrement', + frame_size_min = 100, + frame_size_max = 3000, + l3_protocol = 'ipv4', + l4_protocol = 'udp', + rate_bps = 100000, + direction = direction, + ) + ] + + def get_streams (self, direction = 0): + return self.create_streams(direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_imix_4rates.py b/scripts/stl/hlt/hlt_imix_4rates.py index f6bfdd30..0b245277 100755 --- a/scripts/stl/hlt/hlt_imix_4rates.py +++ b/scripts/stl/hlt/hlt_imix_4rates.py @@ -13,6 +13,7 @@ class STLS1(object): l3_imix2_size = 400, l3_imix2_ratio = 3, l3_imix3_size = 2000, l3_imix3_ratio = 2, l3_imix4_size = 8000, l3_imix4_ratio = 1, + l3_protocol = 'ipv4', l4_protocol = 'udp', direction = direction, ) diff --git a/scripts/stl/hlt/hlt_imix_default.py b/scripts/stl/hlt/hlt_imix_default.py index ac8762c1..85c6b1a4 100755 --- a/scripts/stl/hlt/hlt_imix_default.py +++ b/scripts/stl/hlt/hlt_imix_default.py @@ -4,7 +4,8 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream class STLS1(object): def create_streams (self): - return STLHltStream(length_mode = 'imix', rate_pps = 2) + return STLHltStream(length_mode = 'imix', rate_pps = 2, + l3_protocol = 'ipv4', l4_protocol = 'tcp') def get_streams (self, direction = 0): return self.create_streams() diff --git a/scripts/stl/hlt/hlt_ip_ranges.py b/scripts/stl/hlt/hlt_ip_ranges.py new file mode 100755 index 00000000..4346065c --- /dev/null +++ b/scripts/stl/hlt/hlt_ip_ranges.py @@ -0,0 +1,29 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Eth/IP/TCP stream with VM to get different ip addresses + ''' + + def create_streams (self, direction = 0): + return [STLHltStream(split_by_cores = 'duplicate', + l3_protocol = 'ipv4', + ip_src_addr = '192.168.1.1', + ip_src_mode = 'increment', + ip_src_count = 5, + ip_dst_addr = '5.5.5.5', + ip_dst_mode = 'random', + consistent_random = True, + rate_pps = 1), + ] + + def get_streams (self, direction = 0): + return self.create_streams(direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_ipv6_default.py b/scripts/stl/hlt/hlt_ipv6_default.py new file mode 100755 index 00000000..4cc73d6a --- /dev/null +++ b/scripts/stl/hlt/hlt_ipv6_default.py @@ -0,0 +1,25 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Eth/IPv6/UDP stream without VM, default values + ''' + + def create_streams (self, direction = 0): + return [STLHltStream(l3_protocol = 'ipv6', + l3_length = 150, + l4_protocol = 'udp', + direction = direction, + ), + ] + + def get_streams (self, direction = 0): + return self.create_streams(direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_ipv6_ranges.py b/scripts/stl/hlt/hlt_ipv6_ranges.py new file mode 100755 index 00000000..6d9c1573 --- /dev/null +++ b/scripts/stl/hlt/hlt_ipv6_ranges.py @@ -0,0 +1,25 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Eth/IPv6/UDP stream with VM, to change the ipv6 addr (only 32 lsb) + ''' + + def create_streams (self, direction = 0): + return STLHltStream(l3_protocol = 'ipv6', l3_length = 150, l4_protocol = 'udp', + ipv6_src_addr = '1111:2222:3333:4444:5555:6666:7777:8888', + ipv6_dst_addr = '1111:1111:1111:1111:1111:1111:1111:1111', + ipv6_src_mode = 'increment', ipv6_src_step = 5, ipv6_src_count = 10, + ipv6_dst_mode = 'decrement', ipv6_dst_step = '1111:1111:1111:1111:1111:0000:0000:0011', ipv6_dst_count = 150, + ) + + def get_streams (self, direction = 0): + return self.create_streams(direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_l3_length_vm.py b/scripts/stl/hlt/hlt_l3_length_vm.py new file mode 100755 index 00000000..e9b6654c --- /dev/null +++ b/scripts/stl/hlt/hlt_l3_length_vm.py @@ -0,0 +1,36 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Two Eth/IP/UDP streams with VM to get different size of packet by l3_length + ''' + + def create_streams (self, direction = 0): + return [STLHltStream(length_mode = 'increment', + l3_length_min = 100, + l3_length_max = 3000, + l3_protocol = 'ipv4', + l4_protocol = 'udp', + rate_bps = 1000000, + direction = direction, + ), + STLHltStream(length_mode = 'decrement', + l3_length_min = 100, + l3_length_max = 3000, + l3_protocol = 'ipv4', + l4_protocol = 'udp', + rate_bps = 1000000, + direction = direction, + ) + ] + + def get_streams (self, direction = 0): + return self.create_streams(direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_tcp_ranges.py b/scripts/stl/hlt/hlt_tcp_ranges.py index 28e66855..911fdecd 100755 --- a/scripts/stl/hlt/hlt_tcp_ranges.py +++ b/scripts/stl/hlt/hlt_tcp_ranges.py @@ -7,7 +7,9 @@ class STLS1(object): ''' def create_streams (self, direction = 0): - return [STLHltStream(tcp_src_port_mode = 'decrement', + return [STLHltStream(l3_protocol = 'ipv4', + l4_protocol = 'tcp', + tcp_src_port_mode = 'decrement', tcp_src_port_count = 10, tcp_src_port = 1234, tcp_dst_port_mode = 'increment', diff --git a/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py b/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py index b3fec989..5fb86875 100755 --- a/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py +++ b/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py @@ -12,6 +12,7 @@ class STLS1(object): max_size = 9*1024 return [STLHltStream(length_mode = 'increment', frame_size_max = max_size, + l3_protocol = 'ipv4', ip_src_addr = '16.0.0.1', ip_dst_addr = '48.0.0.1', l4_protocol = 'udp', @@ -21,6 +22,7 @@ class STLS1(object): ), STLHltStream(length_mode = 'decrement', frame_size_max = max_size, + l3_protocol = 'ipv4', ip_src_addr = '16.0.0.1', ip_dst_addr = '48.0.0.1', l4_protocol = 'udp', diff --git a/scripts/stl/hlt/hlt_udp_ports.py b/scripts/stl/hlt/hlt_udp_ports.py index 20862141..cdb1af1c 100755 --- a/scripts/stl/hlt/hlt_udp_ports.py +++ b/scripts/stl/hlt/hlt_udp_ports.py @@ -8,7 +8,8 @@ class STLS1(object): ''' def create_streams (self, direction = 0): - return [STLHltStream(l4_protocol = 'udp', + return [STLHltStream(l3_protocol = 'ipv4', + l4_protocol = 'udp', udp_src_port_mode = 'decrement', udp_src_port_count = 45, udp_src_port_step = 20, diff --git a/scripts/stl/hlt/hlt_udp_random_ports.py b/scripts/stl/hlt/hlt_udp_random_ports.py index 0f60958d..6397ba17 100755 --- a/scripts/stl/hlt/hlt_udp_random_ports.py +++ b/scripts/stl/hlt/hlt_udp_random_ports.py @@ -8,7 +8,8 @@ class STLS1(object): ''' def create_streams (self, direction = 0): - return [STLHltStream(l4_protocol = 'udp', + return [STLHltStream(l3_protocol = 'ipv4', + l4_protocol = 'udp', udp_src_port_mode = 'random', udp_dst_port_mode = 'random', direction = direction, diff --git a/scripts/stl/hlt/hlt_vlan_default.py b/scripts/stl/hlt/hlt_vlan_default.py new file mode 100755 index 00000000..8e50eef3 --- /dev/null +++ b/scripts/stl/hlt/hlt_vlan_default.py @@ -0,0 +1,23 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Default Eth/802.1Q/IP/TCP stream without VM + ''' + + def create_streams (self, direction = 0): + + return STLHltStream(l2_encap = 'ethernet_ii_vlan', + l3_protocol = 'ipv4', l4_protocol = 'tcp', + direction = direction) + + def get_streams (self, direction = 0): + return self.create_streams(direction = direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/hlt/hlt_vlans_vm.py b/scripts/stl/hlt/hlt_vlans_vm.py new file mode 100755 index 00000000..aa4881c6 --- /dev/null +++ b/scripts/stl/hlt/hlt_vlans_vm.py @@ -0,0 +1,30 @@ +from trex_stl_lib.trex_stl_hltapi import STLHltStream + + +class STLS1(object): + ''' + Eth/802.1Q/802.1Q/802.1Q/802.1Q/802.1Q/IPv4/UDP stream with complex VM on vlan_id's + Missing values will be filled with defaults + ''' + + def create_streams (self, direction = 0): + + return STLHltStream(frame_size = 100, + vlan_id = '1 2 1000 4 5', # 5 vlans + vlan_id_mode = 'increment fixed decrement random', # 5th vlan will be default fixed + vlan_id_step = 2, # 1st vlan step will be 2, others - default 1 + vlan_id_count = [4, 1, 10], # 4th independent on count, 5th will be fixed + l3_protocol = 'ipv4', + l4_protocol = 'udp', + direction = direction, + ) + + def get_streams (self, direction = 0): + return self.create_streams(direction = direction) + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + -- cgit 1.2.3-korg