From 2cf444195c3d8a0215216e5f1899fded15bd7627 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 21 Sep 2016 18:12:46 +0300 Subject: Splitter - padding for non circular VMs --- .../regression/functional_tests/stl_basic_tests.py | 37 +++++++++++++++------- .../stl/trex_stl_lib/trex_stl_sim.py | 4 +-- .../stl/trex_stl_lib/utils/parsing_opts.py | 18 +++++++---- 3 files changed, 39 insertions(+), 20 deletions(-) (limited to 'scripts/automation') diff --git a/scripts/automation/regression/functional_tests/stl_basic_tests.py b/scripts/automation/regression/functional_tests/stl_basic_tests.py index e9409baf..28178324 100644 --- a/scripts/automation/regression/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/functional_tests/stl_basic_tests.py @@ -253,12 +253,12 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ["udp_3pkt_pcap.py","-m 1 -l 10",True, False], #["udp_1pkt_simple.py","-m 1 -l 3",True], ["udp_1pkt_pcap_relative_path.py","-m 1 -l 3",True, False], - ["udp_1pkt_tuple_gen_split.py","-m 1 -c 2 -l 100",True], - ["udp_1pkt_range_clients_split.py","-m 1 -c 2 -l 100",True], - ["udp_1pkt_vxlan.py","-m 1 -c 1 -l 17",True, False], # can't generate: no VXLAN in Scapy, only in profile - ["udp_1pkt_ipv6_in_ipv4.py","-m 1 -c 1 -l 17",True], - ["yaml/imix_3pkt.yaml","-m 50kpps --limit 20 --cores 2",True], - ["yaml/imix_3pkt_vm.yaml","-m 50kpps --limit 20 --cores 2",True], + ["udp_1pkt_tuple_gen_split.py","-m 1 -l 100",True], + ["udp_1pkt_range_clients_split.py","-m 1 -l 100",True], + ["udp_1pkt_vxlan.py","-m 1 -l 17",True, False], # can't generate: no VXLAN in Scapy, only in profile + ["udp_1pkt_ipv6_in_ipv4.py","-m 1 -l 17",True], + ["yaml/imix_3pkt.yaml","-m 50kpps --limit 20",True], + ["yaml/imix_3pkt_vm.yaml","-m 50kpps --limit 20",True], ["udp_1pkt_simple_mac_dst.py","-m 1 -l 1 ",True], ["udp_1pkt_simple_mac_src.py","-m 1 -l 1 ",True], ["udp_1pkt_simple_mac_dst_src.py","-m 1 -l 1 ",True], @@ -271,13 +271,12 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ["udp_1pkt_simple_test.py","-m 1 -l 10 ",True, False], ["udp_1pkt_mac_mask5.py","-m 1 -l 30 ",True], ["udp_1pkt_range_clients_split_garp.py","-m 1 -l 50",True], - ["udp_1pkt_src_ip_split.py","-m 1 -l 50 --cores 2",True], + ["udp_1pkt_src_ip_split.py","-m 1 -l 50",True], ["udp_1pkt_repeat_random.py","-m 1 -l 50",True], ]; p1 = [ ["udp_1pkt_repeat_random.py","-m 1 -l 50",True] ]; - for obj in p: try: test_generated = obj[3] @@ -337,13 +336,29 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): def test_multicore_scheduling (self): - mc_tests = ['stl/tests/single_cont.py', + + seed = time.time() + + # test with simple vars + rc = self.run_sim('stl/tests/multi_core_test.py', output = None, options = '--test_multi_core --limit=840 -t test_type=plain#seed={0} -m 27kpps'.format(seed), silent = True) + assert_equal(rc, True) + + + # test with tuple + rc = self.run_sim('stl/tests/multi_core_test.py', output = None, options = '--test_multi_core --limit=840 -t test_type=tuple#seed={0} -m 27kpps'.format(seed), silent = True) + assert_equal(rc, True) + + # some tests + mc_tests = [ + 'stl/tests/single_cont.py', 'stl/tests/single_burst.py', 'stl/tests/multi_burst.py', - 'stl/tests/many_streams.py', ] for mc_test in mc_tests: - rc = self.run_sim(mc_test, output = None, options = '--test_multi_core --limit=3840 -m 27kpps', silent = True) + rc = self.run_sim(mc_test, output = None, options = '--test_multi_core --limit=840 -m 27kpps', silent = True) assert_equal(rc, True) + return + + 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 0394cf43..63a1232b 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 @@ -111,8 +111,6 @@ class STLSim(object): # handle YAMLs if tunables == None: tunables = {} - else: - tunables = tunables[0] for input_file in input_files: try: @@ -556,7 +554,7 @@ def test_multi_core (r, options): duration = options.duration, mode = 'none', silent = True, - tunables = [{'seed': 5}]) + tunables = options.tunables) print("") diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py index e1de6b55..65333e0f 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py @@ -213,19 +213,25 @@ def is_valid_file(filename): return filename -def decode_tunables_to_dict (**kwargs): - return kwargs def decode_tunables (tunable_str): - try: - tunables = [eval('decode_tunables_to_dict({0})'.format(t)) for t in tunable_str.split('#')] + tunables = {} - except (SyntaxError, NameError): - raise argparse.ArgumentTypeError("bad syntax for tunables: {0}".format(tunable_str)) + # split by diaz to tokens + tokens = tunable_str.split('#') + + # each token is of form X=Y + for token in tokens: + print(token) + m = re.search('(.*)=(.*)', token) + if not m: + raise argparse.ArgumentTypeError("bad syntax for tunables: {0}".format(token)) + tunables[m.group(1)] = m.group(2) return tunables + OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'], {'help': match_multiplier_help, 'dest': "mult", -- cgit 1.2.3-korg