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 --- 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 ++++++++++++++++++++++++++ 14 files changed, 244 insertions(+), 4 deletions(-) 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 (limited to 'scripts/stl') 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