Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -164,7 +164,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 @@ -440,10 +440,15 @@ def _setup_interfaces_t1_or_t2(mg_facts, peer_count):
peer_count = getattr(request.module, "PEER_COUNT", 1)
if "dualtor" in tbinfo["topo"]["name"]:
setup_func = _setup_interfaces_dualtor
elif tbinfo["topo"]["type"] in ["t0", "m0"]:
elif tbinfo["topo"]["type"] in ["t0"]:
setup_func = _setup_interfaces_t0
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
else:
raise TypeError("Unsupported topology: %s" % tbinfo["topo"]["type"])

Expand Down
9 changes: 8 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,8 +1214,8 @@ def pytest_generate_tests(metafunc):
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]]

if "enum_asic_index" in metafunc.fixturenames:
Expand Down Expand Up @@ -1288,6 +1288,13 @@ def pytest_generate_tests(metafunc):
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')


### Override enum fixtures for duts and asics to ensure that parametrization happens once per module.
@pytest.fixture(scope="module")
def enum_dut_hostname(request):
Expand Down