Skip to content

Commit 9bc7fc7

Browse files
lguohandaall
authored andcommitted
[test_interface]: verify the interface mac equal to the router mac (sonic-net#3387)
Signed-off-by: Guohan Lu <lguohan@gmail.com> Co-authored-by: Danny Allen <daall@microsoft.com>
1 parent bead329 commit 9bc7fc7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/test_interfaces.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,25 @@ def test_interfaces(duthosts, enum_frontend_dut_hostname, tbinfo, enum_asic_inde
3636
verify_ip_address(host_facts, mg_facts['minigraph_vlan_interfaces'])
3737
verify_ip_address(host_facts, mg_facts['minigraph_lo_interfaces'])
3838

39+
router_mac = duthost.facts['router_mac']
40+
verify_mac_address(host_facts, mg_facts['minigraph_portchannel_interfaces'], router_mac)
41+
verify_mac_address(host_facts, mg_facts['minigraph_vlan_interfaces'], router_mac)
42+
verify_mac_address(host_facts, mg_facts['minigraph_interfaces'], router_mac)
43+
3944
def verify_port(host_facts, ports):
4045
for port in ports:
4146
pytest_assert(host_facts[port]['active'], "interface {} is not active".format(port))
4247

48+
def verify_mac_address(host_facts, intfs, router_mac):
49+
for intf in intfs:
50+
if 'attachto' in intf:
51+
ifname = intf['attachto']
52+
else:
53+
ifname = intf['name']
54+
55+
pytest_assert(host_facts[ifname]['macaddress'] == router_mac, \
56+
"interface {} mac address {} does not match router mac {}".format(ifname, host_facts[ifname]['macaddress'], router_mac))
57+
4358
def verify_ip_address(host_facts, intfs):
4459
for intf in intfs:
4560
if intf.has_key('attachto'):

0 commit comments

Comments
 (0)