diff --git a/tests/conftest.py b/tests/conftest.py index 5df8e812e37..2fc0dab3033 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1518,7 +1518,7 @@ def generate_dut_backend_asics(request, duts_selected): return dut_asic_list -def generate_priority_lists(request, prio_scope, with_completeness_level=False): +def generate_priority_lists(request, prio_scope, with_completeness_level=False, one_dut_only=False): empty = [] tbname = request.config.getoption("--testbed") @@ -1544,6 +1544,9 @@ def generate_priority_lists(request, prio_scope, with_completeness_level=False): for p in priorities: ret.append('{}|{}'.format(dut, p)) + if one_dut_only: + break + if with_completeness_level: completeness_level = get_completeness_level_metadata(request) # if completeness_level in ["debug", "basic", "confident"], @@ -1560,6 +1563,9 @@ def generate_priority_lists(request, prio_scope, with_completeness_level=False): p = random.choice(priorities) ret.append('{}|{}'.format(dut, p)) + if one_dut_only: + break + return ret if ret else empty @@ -1753,14 +1759,28 @@ def format_portautoneg_test_id(param): metafunc.parametrize("enum_dut_all_prio", generate_priority_lists(metafunc, 'all')) if 'enum_dut_lossless_prio' in metafunc.fixturenames: metafunc.parametrize("enum_dut_lossless_prio", generate_priority_lists(metafunc, 'lossless')) + if 'enum_one_dut_lossless_prio' in metafunc.fixturenames: + metafunc.parametrize("enum_one_dut_lossless_prio", + generate_priority_lists(metafunc, 'lossless', one_dut_only=True)) if 'enum_dut_lossless_prio_with_completeness_level' in metafunc.fixturenames: metafunc.parametrize("enum_dut_lossless_prio_with_completeness_level", generate_priority_lists(metafunc, 'lossless', with_completeness_level=True)) + if 'enum_one_dut_lossless_prio_with_completeness_level' in metafunc.fixturenames: + metafunc.parametrize("enum_one_dut_lossless_prio_with_completeness_level", + generate_priority_lists(metafunc, 'lossless', with_completeness_level=True, + one_dut_only=True)) if 'enum_dut_lossy_prio' in metafunc.fixturenames: metafunc.parametrize("enum_dut_lossy_prio", generate_priority_lists(metafunc, 'lossy')) + if 'enum_one_dut_lossy_prio' in metafunc.fixturenames: + metafunc.parametrize("enum_one_dut_lossy_prio", generate_priority_lists(metafunc, 'lossy', + one_dut_only=True)) if 'enum_dut_lossy_prio_with_completeness_level' in metafunc.fixturenames: metafunc.parametrize("enum_dut_lossy_prio_with_completeness_level", generate_priority_lists(metafunc, 'lossy', with_completeness_level=True)) + if 'enum_one_dut_lossy_prio_with_completeness_level' in metafunc.fixturenames: + metafunc.parametrize("enum_one_dut_lossy_prio_with_completeness_level", + generate_priority_lists(metafunc, 'lossy', with_completeness_level=True, + one_dut_only=True)) if 'enum_pfc_pause_delay_test_params' in metafunc.fixturenames: metafunc.parametrize("enum_pfc_pause_delay_test_params", pfc_pause_delay_test_params(metafunc)) diff --git a/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py b/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py index f1346df8ba0..769ec5d42cf 100644 --- a/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py +++ b/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossless_with_snappi.py @@ -28,7 +28,7 @@ def test_pfc_pause_single_lossless_prio(snappi_api, # noqa: conn_graph_facts, # noqa: F811 fanout_graph_facts_multidut, # noqa: F811 duthosts, - enum_dut_lossless_prio, + enum_one_dut_lossless_prio, prio_dscp_map, # noqa: F811 lossless_prio_list, # noqa: F811 all_prio_list, # noqa: F811 @@ -58,7 +58,7 @@ def test_pfc_pause_single_lossless_prio(snappi_api, # noqa: testbed_config, port_config_list, snappi_ports = setup_ports_and_dut - _, lossless_prio = enum_dut_lossless_prio.split('|') + _, lossless_prio = enum_one_dut_lossless_prio.split('|') lossless_prio = int(lossless_prio) pause_prio_list = [lossless_prio] test_prio_list = [lossless_prio] @@ -142,7 +142,7 @@ def test_pfc_pause_single_lossless_prio_reboot(snappi_api, # n fanout_graph_facts_multidut, # noqa: F811 duthosts, localhost, - enum_dut_lossless_prio_with_completeness_level, # noqa: F811 + enum_one_dut_lossless_prio_with_completeness_level, # noqa: F811 prio_dscp_map, # noqa: F811 lossless_prio_list, # noqa: F811 all_prio_list, # noqa: F811 @@ -171,7 +171,7 @@ def test_pfc_pause_single_lossless_prio_reboot(snappi_api, # n """ testbed_config, port_config_list, snappi_ports = setup_ports_and_dut - _, lossless_prio = enum_dut_lossless_prio_with_completeness_level.split('|') + _, lossless_prio = enum_one_dut_lossless_prio_with_completeness_level.split('|') lossless_prio = int(lossless_prio) pause_prio_list = [lossless_prio] test_prio_list = [lossless_prio] diff --git a/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossy_with_snappi.py b/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossy_with_snappi.py index ac1e0458f9b..b65c87b5a89 100644 --- a/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossy_with_snappi.py +++ b/tests/snappi_tests/multidut/pfc/test_multidut_pfc_pause_lossy_with_snappi.py @@ -28,7 +28,7 @@ def test_pfc_pause_single_lossy_prio(snappi_api, # noqa: F811 conn_graph_facts, # noqa: F811 fanout_graph_facts_multidut, # noqa: F811 duthosts, - enum_dut_lossy_prio, + enum_one_dut_lossy_prio, prio_dscp_map, # noqa: F811 lossy_prio_list, # noqa: F811 all_prio_list, # noqa: F811 @@ -57,7 +57,7 @@ def test_pfc_pause_single_lossy_prio(snappi_api, # noqa: F811 """ testbed_config, port_config_list, snappi_ports = setup_ports_and_dut - _, lossy_prio = enum_dut_lossy_prio.split('|') + _, lossy_prio = enum_one_dut_lossy_prio.split('|') lossy_prio = int(lossy_prio) pause_prio_list = [lossy_prio] test_prio_list = [lossy_prio] @@ -150,7 +150,7 @@ def test_pfc_pause_single_lossy_prio_reboot(snappi_api, # noqa: F811 fanout_graph_facts_multidut, # noqa: F811 duthosts, localhost, - enum_dut_lossy_prio_with_completeness_level, + enum_one_dut_lossy_prio_with_completeness_level, prio_dscp_map, # noqa: F811 lossy_prio_list, # noqa: F811 all_prio_list, # noqa: F811 @@ -180,7 +180,7 @@ def test_pfc_pause_single_lossy_prio_reboot(snappi_api, # noqa: F811 """ testbed_config, port_config_list, snappi_ports = setup_ports_and_dut - _, lossy_prio = enum_dut_lossy_prio_with_completeness_level.split('|') + _, lossy_prio = enum_one_dut_lossy_prio_with_completeness_level.split('|') lossy_prio = int(lossy_prio) pause_prio_list = [lossy_prio] test_prio_list = [lossy_prio]