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:
Christian Manivong
2026-06-12 21:08:26 +02:00
parent 96ae50551b
commit aef5eb1487
+5 -3
View File
@@ -1014,9 +1014,11 @@ class NetgearSmartDriver(SwitchDriver):
""" """
neighbors: Dict[str, List[Dict]] = {} neighbors: Dict[str, List[Dict]] = {}
for row in self._get_lldp_table(): for row in self._get_lldp_table():
neighbors.setdefault(row["local_port"], []).append( entry = {"hostname": row["system_name"], "port": row["port_id"]}
{"hostname": row["system_name"], "port": row["port_id"]} chassis_id = row.get("remote_chassis_id", "")
) if re.match(r"^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$", chassis_id):
entry["mac"] = chassis_id.lower()
neighbors.setdefault(row["local_port"], []).append(entry)
return neighbors return neighbors
def _get_lldp_table(self) -> List[Dict]: def _get_lldp_table(self) -> List[Dict]: