Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/bgp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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"])

Expand Down
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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', [None], scope='module')


def get_autoneg_tests_data():
folder = 'metadata'
Expand Down