Skip to content

Commit

Permalink
[m0] Add support for m0 in test_dhcp_pkt_fwd (#6725)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
Add support for m0 in test_dhcp_pkt_fwd
  • Loading branch information
yaqiangz authored Nov 4, 2022
1 parent f617cfb commit 5990a18
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/dhcp_relay/test_dhcp_pkt_fwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from socket import INADDR_ANY

pytestmark = [
pytest.mark.topology("t1")
pytest.mark.topology("t1", "m0")
]

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -103,18 +103,19 @@ def dutPorts(self, duthosts, rand_one_dut_hostname, tbinfo):
dict: contains downstream/upstream ports information
"""
duthost = duthosts[rand_one_dut_hostname]
if "t1" not in tbinfo["topo"]["name"]:
pytest.skip("Unsupported topology")
topo_name = tbinfo["topo"]["name"]
if "t1" not in topo_name and topo_name != "m0":
pytest.skip("Unsupported topology: {}".format(topo_name))

downstreamPorts = []
upstreamPorts = []

mgFacts = duthost.get_extended_minigraph_facts(tbinfo)

for dutPort, neigh in mgFacts["minigraph_neighbors"].items():
if "T0" in neigh["name"]:
if "t1" in topo_name and "T0" in neigh["name"] or topo_name == "m0" and "MX" in neigh["name"]:
downstreamPorts.append(dutPort)
elif "T2" in neigh["name"]:
elif "t1" in topo_name and "T2" in neigh["name"] or topo_name == "m0" and "M1" in neigh["name"]:
upstreamPorts.append(dutPort)

yield {"upstreamPorts": upstreamPorts, "downstreamPorts": downstreamPorts}
Expand Down

0 comments on commit 5990a18

Please sign in to comment.