diff --git a/tests/bgp/conftest.py b/tests/bgp/conftest.py index 217837ad395..6d384610a52 100644 --- a/tests/bgp/conftest.py +++ b/tests/bgp/conftest.py @@ -145,7 +145,7 @@ def restore_nbr_gr(node=None, results=None): @pytest.fixture(scope="module") -def setup_interfaces(duthosts, enum_rand_one_per_hwsku_frontend_hostname, ptfhost, request, tbinfo): +def setup_interfaces(duthosts, enum_rand_one_per_hwsku_frontend_hostname, ptfhost, request, tbinfo, topo_scenario): """Setup interfaces for the new BGP peers on PTF.""" def _is_ipv4_address(ip_addr): @@ -449,8 +449,13 @@ def _get_namespace(minigraph_config, intf): setup_func = _setup_interfaces_dualtor elif tbinfo["topo"]["type"] in ["t0", "mx"]: setup_func = _setup_interfaces_t0_or_mx - elif tbinfo["topo"]["type"] in set(["t1", "t2", "m0"]): + elif tbinfo["topo"]["type"] in set(["t1", "t2"]): setup_func = _setup_interfaces_t1_or_t2 + elif tbinfo["topo"]["type"] == "m0": + if topo_scenario == "m0_t1_scenario": + setup_func = _setup_interfaces_t1_or_t2 + else: + setup_func = _setup_interfaces_t0_or_mx else: raise TypeError("Unsupported topology: %s" % tbinfo["topo"]["type"]) diff --git a/tests/conftest.py b/tests/conftest.py index c8ade94eb94..a32a3f05489 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1310,8 +1310,8 @@ def pytest_generate_tests(metafunc): # noqa E302 asics_selected = None asic_fixture_name = None + tbname, tbinfo = get_tbinfo(metafunc) if duts_selected is None: - tbname, tbinfo = get_tbinfo(metafunc) duts_selected = [tbinfo["duts"][0]] possible_asic_enums = ["enum_asic_index", "enum_frontend_asic_index", "enum_backend_asic_index", @@ -1417,6 +1417,12 @@ def format_portautoneg_test_id(param): if 'enum_pfc_pause_delay_test_params' in metafunc.fixturenames: metafunc.parametrize("enum_pfc_pause_delay_test_params", pfc_pause_delay_test_params(metafunc)) + if 'topo_scenario' in metafunc.fixturenames: + if tbinfo['topo']['type'] == 'm0' and 'topo_scenario' in metafunc.fixturenames: + metafunc.parametrize('topo_scenario', ['m0_t0_scenario', 'm0_t1_scenario'], scope='module') + else: + metafunc.parametrize('topo_scenario', ['default'], scope='module') + def get_autoneg_tests_data(): folder = 'metadata'