diff --git a/tests/dhcp_relay/test_dhcpv6_relay.py b/tests/dhcp_relay/test_dhcpv6_relay.py index 7a00ba994e7..5b83c25fc48 100644 --- a/tests/dhcp_relay/test_dhcpv6_relay.py +++ b/tests/dhcp_relay/test_dhcpv6_relay.py @@ -107,11 +107,16 @@ def dut_dhcp_relay_data(duthosts, rand_one_dut_hostname, ptfhost, tbinfo): # Obtain uplink port indicies for this DHCP relay agent uplink_interfaces = [] uplink_port_indices = [] + topo_type = tbinfo['topo']['type'] for iface_name, neighbor_info_dict in mg_facts['minigraph_neighbors'].items(): if neighbor_info_dict['name'] in mg_facts['minigraph_devices']: neighbor_device_info_dict = mg_facts['minigraph_devices'][neighbor_info_dict['name']] - if 'type' in neighbor_device_info_dict and \ - neighbor_device_info_dict['type'] in ['LeafRouter', 'MgmtLeafRouter']: + if 'type' not in neighbor_device_info_dict: + continue + nei_type = neighbor_device_info_dict['type'] + if topo_type == 't0' and nei_type == 'LeafRouter' or \ + topo_type == 'm0' and nei_type == 'MgmtLeafRouter' or \ + topo_type == 'mx' and nei_type == 'MgmtToRRouter': # If this uplink's physical interface is a member of a portchannel interface, # we record the name of the portchannel interface here, as this is the actual # interface the DHCP relay will listen on.