diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/automation/regression/functional_tests/stl_basic_tests.py | 81 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 6 | ||||
-rw-r--r-- | scripts/exp/hlt_ip_ranges.pcap | bin | 1544 -> 1544 bytes | |||
-rw-r--r-- | scripts/exp/hlt_udp_random_ports.pcap | bin | 1544 -> 1544 bytes | |||
-rw-r--r-- | scripts/exp/hlt_vlans_vm.pcap | bin | 2264 -> 2264 bytes | |||
-rw-r--r-- | scripts/exp/syn_attack.pcap | bin | 3824 -> 3824 bytes | |||
-rw-r--r-- | scripts/exp/udp_rand_len_9k.pcap | bin | 204608 -> 206396 bytes | |||
-rwxr-xr-x | scripts/stl/hlt/hlt_udp_rand_len_9k.py | 3 | ||||
-rwxr-xr-x | scripts/stl/hlt/hlt_vlans_vm.py | 4 |
9 files changed, 58 insertions, 36 deletions
diff --git a/scripts/automation/regression/functional_tests/stl_basic_tests.py b/scripts/automation/regression/functional_tests/stl_basic_tests.py index e03c0742..31d79318 100644 --- a/scripts/automation/regression/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/functional_tests/stl_basic_tests.py @@ -117,7 +117,7 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): raise AssertionError(errmsg) - def run_sim (self, yaml, output, options = "", silent = False, obj = None): + def run_sim (self, yaml, output, options = "", silent = False, obj = None, tunables = None): if output: user_cmd = "-f {0} -o {1} {2} -p {3}".format(yaml, output, options, self.scripts_path) else: @@ -126,6 +126,11 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): if silent: user_cmd += " --silent" + if tunables: + user_cmd += " -t" + for k, v in tunables.items(): + user_cmd += " {0}={1}".format(k, v) + rc = trex_stl_sim.main(args = shlex.split(user_cmd)) if obj: obj['rc'] = (rc == 0) @@ -134,7 +139,16 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): - def run_py_profile_path (self, profile, options,silent = False, do_no_remove=False,compare =True, test_generated=True, do_no_remove_generated = False): + def run_py_profile_path (self, + profile, + options, + silent = False, + do_no_remove = False, + compare = True, + test_generated = True, + do_no_remove_generated = False, + tunables = None): + print('Testing profile: %s' % profile) output_cap = "a.pcap" input_file = os.path.join('stl/', profile) @@ -142,7 +156,11 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): if os.path.exists(output_cap): os.unlink(output_cap) try: - rc = self.run_sim(input_file, output_cap, options, silent) + rc = self.run_sim(yaml = input_file, + output = output_cap, + options = options, + silent = silent, + tunables = tunables) assert_equal(rc, True, 'Simulation on profile %s failed.' % profile) #s='cp '+output_cap+' '+golden_file; #print s @@ -158,20 +176,21 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): try: generated_filename = input_file.replace('.py', '_GENERATED.py').replace('.yaml', '_GENERATED.py') if input_file.endswith('.py'): - profile = STLProfile.load_py(input_file) + profile = STLProfile.load_py(input_file, **(tunables if tunables else {})) elif input_file.endswith('.yaml'): profile = STLProfile.load_yaml(input_file) profile.dump_to_code(generated_filename) - rc = self.run_sim(generated_filename, output_cap, options, silent) + rc = self.run_sim(yaml = generated_filename, + output = output_cap, + options = options, + silent = silent) assert_equal(rc, True, 'Simulation on profile %s (generated) failed.' % profile) if compare: self.compare_caps(output_cap, golden_file) - except Exception as e: - print(e) finally: if not do_no_remove_generated: @@ -187,12 +206,12 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): p = [ ["udp_1pkt_1mac_override.py","-m 1 -l 50",True], - ["syn_attack.py","-m 1 -l 50",True], # can't compare random now + ["syn_attack.py","-m 1 -l 50",True], ["udp_1pkt_1mac.py","-m 1 -l 50",True], ["udp_1pkt_mac.py","-m 1 -l 50",True], ["udp_1pkt.py","-m 1 -l 50",True], ["udp_1pkt_tuple_gen.py","-m 1 -l 50",True], - ["udp_rand_len_9k.py","-m 1 -l 50",True], # can't do the compare + ["udp_rand_len_9k.py","-m 1 -l 50",True], ["udp_1pkt_mpls.py","-m 1 -l 50",True], ["udp_1pkt_mpls_vm.py","-m 1 ",True], ["imix.py","-m 1 -l 100",True], @@ -254,31 +273,31 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): def test_hlt_profiles (self): p = ( - ['hlt/hlt_udp_inc_dec_len_9k.py', '-m 1 -l 20', True], - ['hlt/hlt_imix_default.py', '-m 1 -l 20', True], - ['hlt/hlt_imix_4rates.py', '-m 1 -l 20', True], - ['hlt/hlt_david1.py', '-m 1 -l 20', True], - ['hlt/hlt_david2.py', '-m 1 -l 20', True], - ['hlt/hlt_david3.py', '-m 1 -l 20', True], - ['hlt/hlt_david4.py', '-m 1 -l 20', True], - ['hlt/hlt_wentong1.py', '-m 1 -l 20', True], - ['hlt/hlt_wentong2.py', '-m 1 -l 20', True], - ['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], - ['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], - ['hlt/hlt_mac_ranges.py', '-m 1 -l 20', True], + ['hlt/hlt_udp_inc_dec_len_9k.py', '-m 1 -l 20', True, None], + ['hlt/hlt_imix_default.py', '-m 1 -l 20', True, None], + ['hlt/hlt_imix_4rates.py', '-m 1 -l 20', True, None], + #['hlt/hlt_david1.py', '-m 1 -l 20', True, None], + #['hlt/hlt_david2.py', '-m 1 -l 20', True, None], + ['hlt/hlt_david3.py', '-m 1 -l 20', True, None], + ['hlt/hlt_david4.py', '-m 1 -l 20', True, None], + ['hlt/hlt_wentong1.py', '-m 1 -l 20', True, None], + ['hlt/hlt_wentong2.py', '-m 1 -l 20', True, None], + ['hlt/hlt_tcp_ranges.py', '-m 1 -l 20', True, None], + ['hlt/hlt_udp_ports.py', '-m 1 -l 20', True, None], + ['hlt/hlt_udp_random_ports.py', '-m 1 -l 20', True, None], + ['hlt/hlt_ip_ranges.py', '-m 1 -l 20', True, None], + ['hlt/hlt_framesize_vm.py', '-m 1 -l 20', True, None], + ['hlt/hlt_l3_length_vm.py', '-m 1 -l 20', True, None], + ['hlt/hlt_vlan_default.py', '-m 1 -l 20', True, None], + ['hlt/hlt_4vlans.py', '-m 1 -l 20', True, None], + ['hlt/hlt_vlans_vm.py', '-m 1 -l 20', True, {'random_seed': 1}], + ['hlt/hlt_ipv6_default.py', '-m 1 -l 20', True, None], + ['hlt/hlt_ipv6_ranges.py', '-m 1 -l 20', True, None], + ['hlt/hlt_mac_ranges.py', '-m 1 -l 20', True, None], ) for obj in p: - self.run_py_profile_path (obj[0], obj[1], compare =obj[2], do_no_remove=True, do_no_remove_generated = False) + self.run_py_profile_path (obj[0], obj[1], compare =obj[2], do_no_remove=True, do_no_remove_generated = True, tunables = obj[3]) # valgrind tests - this runs in multi thread as it safe (no output) def test_valgrind_various_profiles (self): 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 e9451940..fc0bc78c 100755 --- 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 @@ -918,9 +918,9 @@ class STLProfile(object): imp.reload(module) # reload the update t = STLProfile.get_module_tunables(module) - for arg in kwargs: - if not arg in t: - raise STLError("Profile {0} does not support tunable '{1}' - supported tunables are: '{2}'".format(python_file, arg, t)) + #for arg in kwargs: + # if not arg in t: + # raise STLError("Profile {0} does not support tunable '{1}' - supported tunables are: '{2}'".format(python_file, arg, t)) streams = module.register().get_streams(direction = direction, port_id = port_id, diff --git a/scripts/exp/hlt_ip_ranges.pcap b/scripts/exp/hlt_ip_ranges.pcap Binary files differindex 490e3355..e26288c5 100644 --- a/scripts/exp/hlt_ip_ranges.pcap +++ b/scripts/exp/hlt_ip_ranges.pcap diff --git a/scripts/exp/hlt_udp_random_ports.pcap b/scripts/exp/hlt_udp_random_ports.pcap Binary files differindex 5a9eb522..0a0510cf 100644 --- a/scripts/exp/hlt_udp_random_ports.pcap +++ b/scripts/exp/hlt_udp_random_ports.pcap diff --git a/scripts/exp/hlt_vlans_vm.pcap b/scripts/exp/hlt_vlans_vm.pcap Binary files differindex 609d8aa2..9dac4d44 100644 --- a/scripts/exp/hlt_vlans_vm.pcap +++ b/scripts/exp/hlt_vlans_vm.pcap diff --git a/scripts/exp/syn_attack.pcap b/scripts/exp/syn_attack.pcap Binary files differindex 84da36a7..19868e38 100644 --- a/scripts/exp/syn_attack.pcap +++ b/scripts/exp/syn_attack.pcap diff --git a/scripts/exp/udp_rand_len_9k.pcap b/scripts/exp/udp_rand_len_9k.pcap Binary files differindex 3f4c7c37..afd727d6 100644 --- a/scripts/exp/udp_rand_len_9k.pcap +++ b/scripts/exp/udp_rand_len_9k.pcap diff --git a/scripts/stl/hlt/hlt_udp_rand_len_9k.py b/scripts/stl/hlt/hlt_udp_rand_len_9k.py index 1966823c..38d7d565 100755 --- a/scripts/stl/hlt/hlt_udp_rand_len_9k.py +++ b/scripts/stl/hlt/hlt_udp_rand_len_9k.py @@ -6,7 +6,7 @@ class STLS1(object): Create Eth/IP/UDP steam with random packet size (L3 size from 50 to 9*1024) ''' - def get_streams (self, direction = 0, **kwargs): + def get_streams (self, direction = 0, random_seed = 0, **kwargs): min_size = 50 max_size = 9*1024 return [STLHltStream(length_mode = 'random', @@ -20,6 +20,7 @@ class STLS1(object): udp_dst_port = 12, rate_pps = 1000, ignore_macs = True, + consistent_random = (random_seed != 0) ) ] diff --git a/scripts/stl/hlt/hlt_vlans_vm.py b/scripts/stl/hlt/hlt_vlans_vm.py index 70bf1aad..aad0fc5e 100755 --- a/scripts/stl/hlt/hlt_vlans_vm.py +++ b/scripts/stl/hlt/hlt_vlans_vm.py @@ -7,7 +7,8 @@ class STLS1(object): Missing values will be filled with defaults ''' - def get_streams (self, direction = 0, **kwargs): + def get_streams (self, direction = 0, random_seed = 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 @@ -16,6 +17,7 @@ class STLS1(object): l3_protocol = 'ipv4', l4_protocol = 'udp', direction = direction, + consistent_random = (random_seed != 0) ) # dynamic load - used for trex console or simulator |