feat: include remote chassis MAC in LLDP neighbor entries
Enables MAC-based topology matching against devices that report their own MAC but not a usable system name.
This commit is contained in:
@@ -257,10 +257,15 @@ class LinuxDriver(OSDriver):
|
||||
entries.setdefault(iface, {})[subkey] = value
|
||||
|
||||
for iface, data in entries.items():
|
||||
neighbors.setdefault(iface, []).append({
|
||||
entry = {
|
||||
"hostname": data.get("chassis.name", ""),
|
||||
"port": data.get("port.ifname", data.get("port.id.value", "")),
|
||||
})
|
||||
}
|
||||
if data.get("chassis.id.subtype") == "mac":
|
||||
mac = data.get("chassis.id.value", "")
|
||||
if re.match(r"^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$", mac):
|
||||
entry["mac"] = mac.lower()
|
||||
neighbors.setdefault(iface, []).append(entry)
|
||||
|
||||
return neighbors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user