fix: normalize MAC address format in get_mac_address_table()
Raw MAC addresses from the ArubaOS-Switch API use a non-standard format; normalize via napalm.base.helpers.mac() for consistency. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
576752da23
commit
f3f70cbf74
@@ -13,6 +13,7 @@ from typing import Any, Dict, Optional, Tuple
|
||||
import requests
|
||||
import urllib3
|
||||
|
||||
from napalm.base import helpers as napalm_helpers
|
||||
from napalm.base.exceptions import ConnectionException, ConnectAuthError
|
||||
|
||||
logger = logging.getLogger("napalm_procurve.api")
|
||||
@@ -366,9 +367,14 @@ class ProcurveApiClient:
|
||||
mac_data = self.get("mac-table")
|
||||
table = []
|
||||
for entry in mac_data.get("mac_table_entry_element", []):
|
||||
raw_mac = entry.get("mac_address", "")
|
||||
try:
|
||||
mac = napalm_helpers.mac(raw_mac)
|
||||
except Exception:
|
||||
mac = raw_mac
|
||||
table.append(
|
||||
{
|
||||
"mac": entry.get("mac_address", ""),
|
||||
"mac": mac,
|
||||
"interface": entry.get("port_id", ""),
|
||||
"vlan": int(entry.get("vlan_id", 0)),
|
||||
"static": entry.get("mac_addr_type", "").lower() == "static",
|
||||
|
||||
Reference in New Issue
Block a user