diff --git a/napalm_procurve/api_client.py b/napalm_procurve/api_client.py index 63211f6..be7a921 100644 --- a/napalm_procurve/api_client.py +++ b/napalm_procurve/api_client.py @@ -226,9 +226,24 @@ class ProcurveApiClient: for port in blade.get("data_ports", []): iface_list.append(port.get("port_name", "")) + model_raw = system.get("product_model", "") + # Extract J-code part numbers (e.g. J9777A) from the model string + import re as _re + _PN_RE = _re.compile(r"\b(J\d{4}[A-Z]{1,2})\b") + pn_match = _PN_RE.search(model_raw) + part_number = pn_match.group(1) if pn_match else "" + if pn_match: + clean = _PN_RE.sub("", model_raw) + clean = _re.sub(r"\(\s*\)", "", clean) + clean = _re.sub(r"\s{2,}", " ", clean).strip(" -()") + model = clean if clean else model_raw + else: + model = model_raw + return { "vendor": "HPE Aruba", - "model": system.get("product_model", ""), + "model": model, + "part_number": part_number, "hostname": hostname, "fqdn": fqdn, "os_version": system.get("firmware_version", ""),