From f803e5b2b997e02f30bf747ce799f42b7aa61c13 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 16 Mar 2016 11:30:40 +0200 Subject: FIX: direction for profile --- .../stl/trex_stl_lib/trex_stl_client.py | 7 ++++--- .../trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py | 11 +++++++++-- .../stl/trex_stl_lib/trex_stl_streams.py | 16 +++++++++------- scripts/stl/burst_3st_1000pkt.py | 2 +- scripts/stl/burst_3st_600pkt.py | 2 +- scripts/stl/burst_3st_loop_x_times.py | 2 +- scripts/stl/burst_split.py | 2 +- scripts/stl/flow_stats.py | 2 +- scripts/stl/hlt/hlt_4vlans.py | 2 +- scripts/stl/hlt/hlt_david1.py | 2 +- scripts/stl/hlt/hlt_david2.py | 2 +- scripts/stl/hlt/hlt_david3.py | 2 +- scripts/stl/hlt/hlt_david4.py | 2 +- scripts/stl/hlt/hlt_framesize_vm.py | 2 +- scripts/stl/hlt/hlt_imix_4rates.py | 2 +- scripts/stl/hlt/hlt_imix_default.py | 2 +- scripts/stl/hlt/hlt_ip_ranges.py | 2 +- scripts/stl/hlt/hlt_ipv6_default.py | 2 +- scripts/stl/hlt/hlt_ipv6_ranges.py | 2 +- scripts/stl/hlt/hlt_l3_length_vm.py | 2 +- scripts/stl/hlt/hlt_mac_ranges.py | 2 +- scripts/stl/hlt/hlt_tcp_ranges.py | 2 +- scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py | 2 +- scripts/stl/hlt/hlt_udp_ports.py | 2 +- scripts/stl/hlt/hlt_udp_random_ports.py | 2 +- scripts/stl/hlt/hlt_vlan_default.py | 2 +- scripts/stl/hlt/hlt_vlans_vm.py | 2 +- scripts/stl/hlt/hlt_wentong1.py | 2 +- scripts/stl/hlt/hlt_wentong2.py | 2 +- scripts/stl/imix.py | 2 +- scripts/stl/multi_burst_2st_1000pkt.py | 2 +- scripts/stl/pcap.py | 6 ++---- scripts/stl/pcap_with_vm.py | 15 +++++++++------ scripts/stl/simple_3st.py | 2 +- scripts/stl/syn_attack.py | 2 +- scripts/stl/udp_1pkt.py | 2 +- scripts/stl/udp_1pkt_1mac.py | 2 +- scripts/stl/udp_1pkt_1mac_override.py | 2 +- scripts/stl/udp_1pkt_1mac_step.py | 2 +- scripts/stl/udp_1pkt_dns.py | 2 +- scripts/stl/udp_1pkt_ipv6_in_ipv4.py | 2 +- scripts/stl/udp_1pkt_mac.py | 2 +- scripts/stl/udp_1pkt_mac_mask1.py | 2 +- scripts/stl/udp_1pkt_mac_mask2.py | 2 +- scripts/stl/udp_1pkt_mac_mask3.py | 2 +- scripts/stl/udp_1pkt_mac_mask5.py | 2 +- scripts/stl/udp_1pkt_mac_step.py | 2 +- scripts/stl/udp_1pkt_mpls.py | 2 +- scripts/stl/udp_1pkt_mpls_vm.py | 2 +- scripts/stl/udp_1pkt_pcap.py | 2 +- scripts/stl/udp_1pkt_pcap_relative_path.py | 2 +- scripts/stl/udp_1pkt_range_clients.py | 2 +- scripts/stl/udp_1pkt_range_clients_split.py | 2 +- scripts/stl/udp_1pkt_range_clients_split_garp.py | 2 +- scripts/stl/udp_1pkt_simple.py | 2 +- scripts/stl/udp_1pkt_simple_bdir.py | 12 ++---------- scripts/stl/udp_1pkt_simple_mac_dst.py | 2 +- scripts/stl/udp_1pkt_simple_mac_dst_src.py | 2 +- scripts/stl/udp_1pkt_simple_mac_src.py | 2 +- scripts/stl/udp_1pkt_simple_test.py | 2 +- scripts/stl/udp_1pkt_simple_test2.py | 2 +- scripts/stl/udp_1pkt_tuple_gen.py | 2 +- scripts/stl/udp_1pkt_tuple_gen_split.py | 2 +- scripts/stl/udp_1pkt_vxlan.py | 2 +- scripts/stl/udp_3pkt_pcap.py | 2 +- scripts/stl/udp_inc_len_9k.py | 2 +- scripts/stl/udp_rand_len_9k.py | 2 +- 67 files changed, 96 insertions(+), 93 deletions(-) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py index f7e63ccf..6202e126 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py @@ -1956,15 +1956,16 @@ class STLClient(object): # pack the profile try: - profile = STLProfile.load(opts.file[0]) + for port in opts.ports: + profile = STLProfile.load(opts.file[0], direction = (port % 2), port = port) + self.add_streams(profile.get_streams(), ports = port) + except STLError as e: self.logger.log(format_text("\nError while loading profile '{0}'\n".format(opts.file[0]), 'bold')) self.logger.log(e.brief() + "\n") return - self.add_streams(profile.get_streams(), ports = opts.ports) - if opts.dry: self.validate(opts.ports, opts.mult, opts.duration, opts.total) else: diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py index 614d8b77..42c37e63 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py @@ -141,7 +141,7 @@ class STLSim(object): # handle YAMLs for input_file in input_files: try: - profile = STLProfile.load(input_file) + profile = STLProfile.load(input_file, direction = (self.port_id % 2), port = self.port_id) except STLError as e: s = format_text("\nError while loading profile '{0}'\n".format(input_file), 'bold') s += "\n" + e.brief() @@ -360,6 +360,13 @@ def setParserOptions(): default = None, type = int) + parser.add_argument("-i", "--port", + help = "Simulate a specific port ID [default is 0]", + dest = "port_id", + default = 0, + type = int) + + parser.add_argument("-r", "--release", help = "runs on release image instead of debug [default is False]", action = "store_true", @@ -465,7 +472,7 @@ def main (args = None): mode = 'none' try: - r = STLSim(bp_sim_path = options.bp_sim_path) + r = STLSim(bp_sim_path = options.bp_sim_path, port_id = options.port_id) r.run(input_list = options.input_file, outfile = options.output_file, 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 2baa645c..d4b817cc 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 @@ -835,7 +835,7 @@ class STLProfile(object): @staticmethod - def load_py (python_file): + def load_py (python_file, direction = 0, **kwargs): """ load from Python profile """ # check filename @@ -850,13 +850,13 @@ class STLProfile(object): module = __import__(file, globals(), locals(), [], -1) reload(module) # reload the update - streams = module.register().get_streams() + streams = module.register().get_streams(direction = direction, **kwargs) return STLProfile(streams) except Exception as e: a, b, tb = sys.exc_info() - x =''.join(traceback.format_list(traceback.extract_tb(tb)[1:])) + a.__name__ + ": " + str(b) + "\n" + x =''.join(traceback.format_list(traceback.extract_tb(tb)[0:])) + a.__name__ + ": " + str(b) + "\n" summary = "\nPython Traceback follows:\n\n" + x raise STLError(summary) @@ -940,14 +940,16 @@ class STLProfile(object): @staticmethod - def load (filename): + def load (filename, direction = 0, **kwargs): """ load a profile by its type supported type are * py * yaml * pcap file that converted to profile automaticly :parameters: - filename : string as filename + filename : string as filename + direction : profile's direction (if supported by the profile) + kwargs : forward those key-value pairs to the profile """ @@ -955,7 +957,7 @@ class STLProfile(object): suffix = x[1] if (len(x) == 2) else None if suffix == 'py': - profile = STLProfile.load_py(filename) + profile = STLProfile.load_py(filename, direction, **kwargs) elif suffix == 'yaml': profile = STLProfile.load_yaml(filename) @@ -996,7 +998,7 @@ class STLProfile(object): from trex_stl_lib.api import * class STLS1(object): - def get_streams(self): + def get_streams(self, direction = 0, **kwargs): streams = [] ''' for stream in self.streams: diff --git a/scripts/stl/burst_3st_1000pkt.py b/scripts/stl/burst_3st_1000pkt.py index 849bbd1f..8fcdca57 100644 --- a/scripts/stl/burst_3st_1000pkt.py +++ b/scripts/stl/burst_3st_1000pkt.py @@ -38,7 +38,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/burst_3st_600pkt.py b/scripts/stl/burst_3st_600pkt.py index 817b6777..978c8920 100644 --- a/scripts/stl/burst_3st_600pkt.py +++ b/scripts/stl/burst_3st_600pkt.py @@ -37,7 +37,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/burst_3st_loop_x_times.py b/scripts/stl/burst_3st_loop_x_times.py index 2604124b..175b8315 100644 --- a/scripts/stl/burst_3st_loop_x_times.py +++ b/scripts/stl/burst_3st_loop_x_times.py @@ -39,7 +39,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/burst_split.py b/scripts/stl/burst_split.py index 393ea70e..e1a8f88d 100644 --- a/scripts/stl/burst_split.py +++ b/scripts/stl/burst_split.py @@ -32,7 +32,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/flow_stats.py b/scripts/stl/flow_stats.py index e2701d23..69e1166c 100644 --- a/scripts/stl/flow_stats.py +++ b/scripts/stl/flow_stats.py @@ -4,7 +4,7 @@ from trex_stl_lib.api import * class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLStream(packet = STLPktBuilder(pkt ="stl/yaml/udp_64B_no_crc.pcap"), # path relative to pwd mode = STLTXCont(pps=1000), flow_stats = STLFlowStats(pg_id = 7)), diff --git a/scripts/stl/hlt/hlt_4vlans.py b/scripts/stl/hlt/hlt_4vlans.py index f93ffc23..be612e55 100755 --- a/scripts/stl/hlt/hlt_4vlans.py +++ b/scripts/stl/hlt/hlt_4vlans.py @@ -7,7 +7,7 @@ class STLS1(object): Missing values will be filled with defaults ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): 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' diff --git a/scripts/stl/hlt/hlt_david1.py b/scripts/stl/hlt/hlt_david1.py index 312c8971..bac8a09e 100755 --- a/scripts/stl/hlt/hlt_david1.py +++ b/scripts/stl/hlt/hlt_david1.py @@ -7,7 +7,7 @@ class STLS1(object): Creates 3 streams (imix) Eth/802.1Q/IP/TCP without VM ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): #''' return STLHltStream( #enable_auto_detect_instrumentation = '1', # not supported yet diff --git a/scripts/stl/hlt/hlt_david2.py b/scripts/stl/hlt/hlt_david2.py index af40c2ae..1fc7b84d 100755 --- a/scripts/stl/hlt/hlt_david2.py +++ b/scripts/stl/hlt/hlt_david2.py @@ -7,7 +7,7 @@ class STLS1(object): Creates 3 streams (imix) Eth/802.1Q/IP/TCP without VM ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream( #enable_auto_detect_instrumentation = '1', # not supported yet ip_dst_addr = '192.168.3.3', diff --git a/scripts/stl/hlt/hlt_david3.py b/scripts/stl/hlt/hlt_david3.py index 7b5442a3..6192a7df 100755 --- a/scripts/stl/hlt/hlt_david3.py +++ b/scripts/stl/hlt/hlt_david3.py @@ -7,7 +7,7 @@ class STLS1(object): Creates Eth/802.1Q/802.1Q/IP/TCP stream ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream( l3_protocol = 'ipv4', ip_src_addr = '100.1.1.1', diff --git a/scripts/stl/hlt/hlt_david4.py b/scripts/stl/hlt/hlt_david4.py index 2f88b329..9e5d3eab 100755 --- a/scripts/stl/hlt/hlt_david4.py +++ b/scripts/stl/hlt/hlt_david4.py @@ -10,7 +10,7 @@ class STLS1(object): MAC dst will have number of incremental values ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): mac_dst_count = 10 mac_src_count = 10 pkts_per_burst = 10 diff --git a/scripts/stl/hlt/hlt_framesize_vm.py b/scripts/stl/hlt/hlt_framesize_vm.py index 5653e435..54ac41a0 100755 --- a/scripts/stl/hlt/hlt_framesize_vm.py +++ b/scripts/stl/hlt/hlt_framesize_vm.py @@ -6,7 +6,7 @@ class STLS1(object): Two Eth/IP/UDP streams with VM to get different size of packet by frame_size ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLHltStream(length_mode = 'increment', frame_size_min = 100, frame_size_max = 3000, diff --git a/scripts/stl/hlt/hlt_imix_4rates.py b/scripts/stl/hlt/hlt_imix_4rates.py index 5b55d641..2764866b 100755 --- a/scripts/stl/hlt/hlt_imix_4rates.py +++ b/scripts/stl/hlt/hlt_imix_4rates.py @@ -7,7 +7,7 @@ class STLS1(object): Each stream will get rate_pps * his ratio / sum of ratios ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(length_mode = 'imix', rate_pps = 2, l3_imix1_size = 60, l3_imix1_ratio = 4, l3_imix2_size = 400, l3_imix2_ratio = 3, diff --git a/scripts/stl/hlt/hlt_imix_default.py b/scripts/stl/hlt/hlt_imix_default.py index 3871924b..607077b5 100755 --- a/scripts/stl/hlt/hlt_imix_default.py +++ b/scripts/stl/hlt/hlt_imix_default.py @@ -3,7 +3,7 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(length_mode = 'imix', rate_pps = 2, l3_protocol = 'ipv4', l4_protocol = 'udp') diff --git a/scripts/stl/hlt/hlt_ip_ranges.py b/scripts/stl/hlt/hlt_ip_ranges.py index 3b6a0407..7679e09e 100755 --- a/scripts/stl/hlt/hlt_ip_ranges.py +++ b/scripts/stl/hlt/hlt_ip_ranges.py @@ -6,7 +6,7 @@ class STLS1(object): Eth/IP/TCP stream with VM to get different ip addresses ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(split_by_cores = 'duplicate', l3_protocol = 'ipv4', ip_src_addr = '192.168.1.1', diff --git a/scripts/stl/hlt/hlt_ipv6_default.py b/scripts/stl/hlt/hlt_ipv6_default.py index f90e7157..2f6264d9 100755 --- a/scripts/stl/hlt/hlt_ipv6_default.py +++ b/scripts/stl/hlt/hlt_ipv6_default.py @@ -6,7 +6,7 @@ class STLS1(object): Eth/IPv6/UDP stream without VM, default values ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLHltStream(l3_protocol = 'ipv6', l3_length = 150, l4_protocol = 'udp', diff --git a/scripts/stl/hlt/hlt_ipv6_ranges.py b/scripts/stl/hlt/hlt_ipv6_ranges.py index f9a83b55..b50cc481 100755 --- a/scripts/stl/hlt/hlt_ipv6_ranges.py +++ b/scripts/stl/hlt/hlt_ipv6_ranges.py @@ -6,7 +6,7 @@ class STLS1(object): Eth/IPv6/UDP stream with VM, to change the ipv6 addr (only 32 lsb) ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): 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', diff --git a/scripts/stl/hlt/hlt_l3_length_vm.py b/scripts/stl/hlt/hlt_l3_length_vm.py index 7b04fbec..bf22f120 100755 --- a/scripts/stl/hlt/hlt_l3_length_vm.py +++ b/scripts/stl/hlt/hlt_l3_length_vm.py @@ -6,7 +6,7 @@ class STLS1(object): Two Eth/IP/UDP streams with VM to get different size of packet by l3_length ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLHltStream(length_mode = 'increment', l3_length_min = 100, l3_length_max = 3000, diff --git a/scripts/stl/hlt/hlt_mac_ranges.py b/scripts/stl/hlt/hlt_mac_ranges.py index e6c4f0a4..2ede1c48 100755 --- a/scripts/stl/hlt/hlt_mac_ranges.py +++ b/scripts/stl/hlt/hlt_mac_ranges.py @@ -6,7 +6,7 @@ class STLS1(object): Eth/IP/UDP stream with VM, to change the MAC addr (only 32 lsb) ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(l3_protocol = 'ipv4', l4_protocol = 'udp', mac_src = '10:00:00:00:00:01', mac_dst = '10:00:00:00:01:00', mac_src2 = '11:11:00:00:00:01', mac_dst2 = '11:11:00:00:01:00', diff --git a/scripts/stl/hlt/hlt_tcp_ranges.py b/scripts/stl/hlt/hlt_tcp_ranges.py index c29b707d..e2045333 100755 --- a/scripts/stl/hlt/hlt_tcp_ranges.py +++ b/scripts/stl/hlt/hlt_tcp_ranges.py @@ -6,7 +6,7 @@ class STLS1(object): Eth/IP/TCP stream with VM to get 10 different TCP ports ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(l3_protocol = 'ipv4', l4_protocol = 'tcp', tcp_src_port_mode = 'decrement', 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 10c778e1..711ced3d 100755 --- a/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py +++ b/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py @@ -8,7 +8,7 @@ class STLS1(object): Seconds stream will decrease the packet size in reverse way ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): max_size = 9*1024 return [STLHltStream(length_mode = 'increment', frame_size_max = max_size, diff --git a/scripts/stl/hlt/hlt_udp_ports.py b/scripts/stl/hlt/hlt_udp_ports.py index 9e551b94..52b49ad3 100755 --- a/scripts/stl/hlt/hlt_udp_ports.py +++ b/scripts/stl/hlt/hlt_udp_ports.py @@ -7,7 +7,7 @@ class STLS1(object): The ports overlap the max and min at very first packets ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(l3_protocol = 'ipv4', l4_protocol = 'udp', udp_src_port_mode = 'decrement', diff --git a/scripts/stl/hlt/hlt_udp_random_ports.py b/scripts/stl/hlt/hlt_udp_random_ports.py index 1ba0227d..8fdde418 100755 --- a/scripts/stl/hlt/hlt_udp_random_ports.py +++ b/scripts/stl/hlt/hlt_udp_random_ports.py @@ -7,7 +7,7 @@ class STLS1(object): Using "consistent_random = True" to have same random ports each test ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLHltStream(l3_protocol = 'ipv4', l4_protocol = 'udp', udp_src_port_mode = 'random', diff --git a/scripts/stl/hlt/hlt_vlan_default.py b/scripts/stl/hlt/hlt_vlan_default.py index ea5c66d1..86851c99 100755 --- a/scripts/stl/hlt/hlt_vlan_default.py +++ b/scripts/stl/hlt/hlt_vlan_default.py @@ -6,7 +6,7 @@ class STLS1(object): Default Eth/802.1Q/IP/TCP stream without VM ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return STLHltStream(l2_encap = 'ethernet_ii_vlan', l3_protocol = 'ipv4', l4_protocol = 'tcp', direction = direction) diff --git a/scripts/stl/hlt/hlt_vlans_vm.py b/scripts/stl/hlt/hlt_vlans_vm.py index a2ad1023..70bf1aad 100755 --- a/scripts/stl/hlt/hlt_vlans_vm.py +++ b/scripts/stl/hlt/hlt_vlans_vm.py @@ -7,7 +7,7 @@ class STLS1(object): Missing values will be filled with defaults ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): 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 diff --git a/scripts/stl/hlt/hlt_wentong1.py b/scripts/stl/hlt/hlt_wentong1.py index 6016c73a..4cf949ca 100755 --- a/scripts/stl/hlt/hlt_wentong1.py +++ b/scripts/stl/hlt/hlt_wentong1.py @@ -7,7 +7,7 @@ class STLS1(object): Creates Eth/802.1Q/IP/UDP stream with VM on src IP ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): ipv4_address_step = '0.0.1.0' num_of_sessions_per_spoke = 1000 ip_tgen_hub = '190.1.0.1' diff --git a/scripts/stl/hlt/hlt_wentong2.py b/scripts/stl/hlt/hlt_wentong2.py index 82503343..137e57b9 100755 --- a/scripts/stl/hlt/hlt_wentong2.py +++ b/scripts/stl/hlt/hlt_wentong2.py @@ -7,7 +7,7 @@ class STLS1(object): Creates Eth/802.1Q/IPv6/UDP stream without VM (if num_of_sessions_per_spoke is 1) ''' - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): ipv6_tgen_rtr = '2005:0:1::1' num_of_sessions_per_spoke = 1 # in given example is not passed forward, taking default ipv6_address_step = '0:0:0:1:0:0:0:0' diff --git a/scripts/stl/imix.py b/scripts/stl/imix.py index 54208af7..65e35108 100644 --- a/scripts/stl/imix.py +++ b/scripts/stl/imix.py @@ -30,7 +30,7 @@ class STLImix(object): mode = STLTXCont(pps = pps)) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): if direction == 0: src = self.ip_range['src'] diff --git a/scripts/stl/multi_burst_2st_1000pkt.py b/scripts/stl/multi_burst_2st_1000pkt.py index 9922458e..1a43ae96 100644 --- a/scripts/stl/multi_burst_2st_1000pkt.py +++ b/scripts/stl/multi_burst_2st_1000pkt.py @@ -32,7 +32,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/pcap.py b/scripts/stl/pcap.py index d4b88a53..bcf2257f 100644 --- a/scripts/stl/pcap.py +++ b/scripts/stl/pcap.py @@ -7,11 +7,9 @@ class STLPcap(object): def __init__ (self, pcap_file): self.pcap_file = pcap_file - def get_streams (self, - ipg_usec = 10.0, - loop_count = 1): + def get_streams (self, direction = 0, **kwargs): - profile = STLProfile.load_pcap(self.pcap_file, ipg_usec = ipg_usec, loop_count = loop_count) + profile = STLProfile.load_pcap(self.pcap_file, ipg_usec = kwargs.get('ipg_usec', 10.0), loop_count = kwargs.get('loop_count', 1)) return profile.get_streams() diff --git a/scripts/stl/pcap_with_vm.py b/scripts/stl/pcap_with_vm.py index a073f959..6531a129 100644 --- a/scripts/stl/pcap_with_vm.py +++ b/scripts/stl/pcap_with_vm.py @@ -29,14 +29,17 @@ class STLPcap(object): return vm - def get_streams (self, - ipg_usec = 10.0, - loop_count = 5, - ip_src_range = None, - ip_dst_range = {'start' : '10.0.0.1', 'end': '10.0.0.254'}): + def get_streams (self, direction = 0, **kwargs): + + ip_src_range = kwargs.get('ip_src_range', None) + ip_dst_range = kwargs.get('up_dst_range', {'start' : '10.0.0.1', 'end': '10.0.0.254'}) vm = self.create_vm(ip_src_range, ip_dst_range) - profile = STLProfile.load_pcap(self.pcap_file, ipg_usec = ipg_usec, loop_count = loop_count, vm = vm) + + profile = STLProfile.load_pcap(self.pcap_file, + ipg_usec = kwargs.get('ipg_usec', 10.0), + loop_count = kwargs.get('loop_count', 5), + vm = vm) return profile.get_streams() diff --git a/scripts/stl/simple_3st.py b/scripts/stl/simple_3st.py index e47d6e52..8979057c 100644 --- a/scripts/stl/simple_3st.py +++ b/scripts/stl/simple_3st.py @@ -34,7 +34,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/syn_attack.py b/scripts/stl/syn_attack.py index f6edcdd2..b01a0c07 100644 --- a/scripts/stl/syn_attack.py +++ b/scripts/stl/syn_attack.py @@ -43,7 +43,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt.py b/scripts/stl/udp_1pkt.py index 6b86a037..13516ecd 100644 --- a/scripts/stl/udp_1pkt.py +++ b/scripts/stl/udp_1pkt.py @@ -33,7 +33,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_1mac.py b/scripts/stl/udp_1pkt_1mac.py index 0eeb2147..4adffd7a 100644 --- a/scripts/stl/udp_1pkt_1mac.py +++ b/scripts/stl/udp_1pkt_1mac.py @@ -21,7 +21,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_1mac_override.py b/scripts/stl/udp_1pkt_1mac_override.py index 00d7a97e..04700420 100644 --- a/scripts/stl/udp_1pkt_1mac_override.py +++ b/scripts/stl/udp_1pkt_1mac_override.py @@ -25,7 +25,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_1mac_step.py b/scripts/stl/udp_1pkt_1mac_step.py index 1dc001c5..1e5e4bd8 100644 --- a/scripts/stl/udp_1pkt_1mac_step.py +++ b/scripts/stl/udp_1pkt_1mac_step.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_dns.py b/scripts/stl/udp_1pkt_dns.py index 6b36ca0b..b9fac9b2 100644 --- a/scripts/stl/udp_1pkt_dns.py +++ b/scripts/stl/udp_1pkt_dns.py @@ -16,7 +16,7 @@ class STLS1(object): mode = STLTXSingleBurst( pps = 1, total_pkts = 17) ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_ipv6_in_ipv4.py b/scripts/stl/udp_1pkt_ipv6_in_ipv4.py index fd862394..d53416ba 100644 --- a/scripts/stl/udp_1pkt_ipv6_in_ipv4.py +++ b/scripts/stl/udp_1pkt_ipv6_in_ipv4.py @@ -23,7 +23,7 @@ class STLS1(object): mode = STLTXSingleBurst( pps = 1, total_pkts = 17) ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac.py b/scripts/stl/udp_1pkt_mac.py index 94c92117..598e2074 100644 --- a/scripts/stl/udp_1pkt_mac.py +++ b/scripts/stl/udp_1pkt_mac.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac_mask1.py b/scripts/stl/udp_1pkt_mac_mask1.py index cc8dd407..efb45da7 100644 --- a/scripts/stl/udp_1pkt_mac_mask1.py +++ b/scripts/stl/udp_1pkt_mac_mask1.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac_mask2.py b/scripts/stl/udp_1pkt_mac_mask2.py index c3b242e9..b95a32e3 100644 --- a/scripts/stl/udp_1pkt_mac_mask2.py +++ b/scripts/stl/udp_1pkt_mac_mask2.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac_mask3.py b/scripts/stl/udp_1pkt_mac_mask3.py index 47b8a63d..7a5d2864 100644 --- a/scripts/stl/udp_1pkt_mac_mask3.py +++ b/scripts/stl/udp_1pkt_mac_mask3.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac_mask5.py b/scripts/stl/udp_1pkt_mac_mask5.py index ed09cbae..75f9bbf1 100644 --- a/scripts/stl/udp_1pkt_mac_mask5.py +++ b/scripts/stl/udp_1pkt_mac_mask5.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mac_step.py b/scripts/stl/udp_1pkt_mac_step.py index 5e46b8ad..0ebd035d 100644 --- a/scripts/stl/udp_1pkt_mac_step.py +++ b/scripts/stl/udp_1pkt_mac_step.py @@ -22,7 +22,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mpls.py b/scripts/stl/udp_1pkt_mpls.py index 83093dbd..bd98416e 100644 --- a/scripts/stl/udp_1pkt_mpls.py +++ b/scripts/stl/udp_1pkt_mpls.py @@ -16,7 +16,7 @@ class STLS1(object): mode = STLTXSingleBurst( pps = 1, total_pkts = 17) ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_mpls_vm.py b/scripts/stl/udp_1pkt_mpls_vm.py index 01ad5fec..366344b8 100644 --- a/scripts/stl/udp_1pkt_mpls_vm.py +++ b/scripts/stl/udp_1pkt_mpls_vm.py @@ -21,7 +21,7 @@ class STLS1(object): mode = STLTXSingleBurst( pps = 1, total_pkts = 100) ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_pcap.py b/scripts/stl/udp_1pkt_pcap.py index a0d2ee49..9fb0e269 100644 --- a/scripts/stl/udp_1pkt_pcap.py +++ b/scripts/stl/udp_1pkt_pcap.py @@ -4,7 +4,7 @@ from trex_stl_lib.api import * class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLStream(packet = STLPktBuilder(pkt ="stl/yaml/udp_64B_no_crc.pcap"), # path relative to pwd mode = STLTXCont(pps=10)) ] #rate continues, could be STLTXSingleBurst,STLTXMultiBurst diff --git a/scripts/stl/udp_1pkt_pcap_relative_path.py b/scripts/stl/udp_1pkt_pcap_relative_path.py index 91b32d0f..00b5e5df 100644 --- a/scripts/stl/udp_1pkt_pcap_relative_path.py +++ b/scripts/stl/udp_1pkt_pcap_relative_path.py @@ -5,7 +5,7 @@ from trex_stl_lib.api import * class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): return [STLStream(packet = STLPktBuilder(pkt ="yaml/udp_64B_no_crc.pcap", path_relative_to_profile = True), # path relative to profile and not to loader path mode = STLTXCont(pps=10)) ] #rate continues, could be STLTXSingleBurst,STLTXMultiBurst diff --git a/scripts/stl/udp_1pkt_range_clients.py b/scripts/stl/udp_1pkt_range_clients.py index 2754b3aa..9bd3c335 100644 --- a/scripts/stl/udp_1pkt_range_clients.py +++ b/scripts/stl/udp_1pkt_range_clients.py @@ -32,7 +32,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_range_clients_split.py b/scripts/stl/udp_1pkt_range_clients_split.py index 69c2dfcb..a8c71c0a 100644 --- a/scripts/stl/udp_1pkt_range_clients_split.py +++ b/scripts/stl/udp_1pkt_range_clients_split.py @@ -32,7 +32,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm), mode = STLTXCont( pps=10 )) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_range_clients_split_garp.py b/scripts/stl/udp_1pkt_range_clients_split_garp.py index 6e20edea..d7f48ed7 100644 --- a/scripts/stl/udp_1pkt_range_clients_split_garp.py +++ b/scripts/stl/udp_1pkt_range_clients_split_garp.py @@ -26,7 +26,7 @@ class STLS1(object): return STLStream(packet = STLPktBuilder(pkt = base_pkt,vm = vm), mode = STLTXSingleBurst( pps=10, total_pkts = self.num_clients )) # single burst of G-ARP - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple.py b/scripts/stl/udp_1pkt_simple.py index 09643fe9..0407f9c9 100644 --- a/scripts/stl/udp_1pkt_simple.py +++ b/scripts/stl/udp_1pkt_simple.py @@ -11,7 +11,7 @@ class STLS1(object): ), mode = STLTXCont()) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple_bdir.py b/scripts/stl/udp_1pkt_simple_bdir.py index c3371974..8ec8d97c 100644 --- a/scripts/stl/udp_1pkt_simple_bdir.py +++ b/scripts/stl/udp_1pkt_simple_bdir.py @@ -2,16 +2,8 @@ from trex_stl_lib.api import * class STLS1(object): - def create_stream (self): - return STLStream( - packet = - STLPktBuilder( - pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/ - UDP(dport=12,sport=1025)/(10*'x') - ), - mode = STLTXCont()) - - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): + # create 1 stream if direction==0: src_ip="16.0.0.1" diff --git a/scripts/stl/udp_1pkt_simple_mac_dst.py b/scripts/stl/udp_1pkt_simple_mac_dst.py index 6b728881..20b87cd3 100644 --- a/scripts/stl/udp_1pkt_simple_mac_dst.py +++ b/scripts/stl/udp_1pkt_simple_mac_dst.py @@ -9,7 +9,7 @@ class STLS1(object): #mac_dst_override_mode=STLStreamDstMAC_PKT # another way to explictly take it ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple_mac_dst_src.py b/scripts/stl/udp_1pkt_simple_mac_dst_src.py index e3df0d0d..9bdd4edd 100644 --- a/scripts/stl/udp_1pkt_simple_mac_dst_src.py +++ b/scripts/stl/udp_1pkt_simple_mac_dst_src.py @@ -9,7 +9,7 @@ class STLS1(object): #mac_dst_override_mode=STLStreamDstMAC_PKT # another way to explictly take it ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple_mac_src.py b/scripts/stl/udp_1pkt_simple_mac_src.py index fe5a2a80..ec930fe5 100644 --- a/scripts/stl/udp_1pkt_simple_mac_src.py +++ b/scripts/stl/udp_1pkt_simple_mac_src.py @@ -9,7 +9,7 @@ class STLS1(object): #mac_src_override_by_pkt=True # another way to explictly take it ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple_test.py b/scripts/stl/udp_1pkt_simple_test.py index 843d9bcf..b2f80233 100644 --- a/scripts/stl/udp_1pkt_simple_test.py +++ b/scripts/stl/udp_1pkt_simple_test.py @@ -30,7 +30,7 @@ class STLS1(object): return STLStream( packet = pkt_a , mode = STLTXCont() ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_simple_test2.py b/scripts/stl/udp_1pkt_simple_test2.py index 52c93a7c..c261d3f8 100644 --- a/scripts/stl/udp_1pkt_simple_test2.py +++ b/scripts/stl/udp_1pkt_simple_test2.py @@ -30,7 +30,7 @@ class STLS1(object): return STLStream( packet = pkt_a , mode = STLTXCont() ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_tuple_gen.py b/scripts/stl/udp_1pkt_tuple_gen.py index a278e4bf..be8620c8 100644 --- a/scripts/stl/udp_1pkt_tuple_gen.py +++ b/scripts/stl/udp_1pkt_tuple_gen.py @@ -31,7 +31,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_tuple_gen_split.py b/scripts/stl/udp_1pkt_tuple_gen_split.py index c7a98942..304ed9c0 100644 --- a/scripts/stl/udp_1pkt_tuple_gen_split.py +++ b/scripts/stl/udp_1pkt_tuple_gen_split.py @@ -35,7 +35,7 @@ class STLS1(object): return stream - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_1pkt_vxlan.py b/scripts/stl/udp_1pkt_vxlan.py index 9d56fe36..eaebb9a6 100644 --- a/scripts/stl/udp_1pkt_vxlan.py +++ b/scripts/stl/udp_1pkt_vxlan.py @@ -38,7 +38,7 @@ class STLS1(object): mode = STLTXSingleBurst( pps = 1, total_pkts = 17) ) - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_3pkt_pcap.py b/scripts/stl/udp_3pkt_pcap.py index 633c4b64..fd2c609e 100644 --- a/scripts/stl/udp_3pkt_pcap.py +++ b/scripts/stl/udp_3pkt_pcap.py @@ -26,7 +26,7 @@ class STLS1(object): ]).get_streams() - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return self.create_stream() diff --git a/scripts/stl/udp_inc_len_9k.py b/scripts/stl/udp_inc_len_9k.py index b76b9fb7..3628a07f 100644 --- a/scripts/stl/udp_inc_len_9k.py +++ b/scripts/stl/udp_inc_len_9k.py @@ -34,7 +34,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] diff --git a/scripts/stl/udp_rand_len_9k.py b/scripts/stl/udp_rand_len_9k.py index c9339d2d..c24101cb 100644 --- a/scripts/stl/udp_rand_len_9k.py +++ b/scripts/stl/udp_rand_len_9k.py @@ -35,7 +35,7 @@ class STLS1(object): - def get_streams (self, direction = 0): + def get_streams (self, direction = 0, **kwargs): # create 1 stream return [ self.create_stream() ] -- cgit 1.2.3-korg