From 55fe8b28f93f4bb4c56a9be183ddd0d52acf421f Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Mon, 22 Jun 2026 23:40:44 +0200 Subject: [PATCH] fix: search all lines for HP banner, not just first line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old ProCurve show version starts with "Image stamp:" — the HP product banner (e.g. "HP J9298A Switch 2520G-8-PoE") appears on a later line. Scan all lines and use the first HP/HPE/Aruba banner found. Co-Authored-By: Claude Sonnet 4.6 --- napalm_procurve/parsers.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/napalm_procurve/parsers.py b/napalm_procurve/parsers.py index 01a15a2..ac9b835 100644 --- a/napalm_procurve/parsers.py +++ b/napalm_procurve/parsers.py @@ -199,13 +199,16 @@ def parse_model_from_version(output: str) -> tuple[str, str]: Returns ("", "") when the first line is not an HP/Aruba device banner (e.g. when show version starts with "Image stamp:" on newer Aruba). """ - first = output.strip().splitlines()[0] if output.strip() else "" - if not first: - return "", "" - - # Only process lines that start with an HP/Aruba product banner - if not re.match(r"\s*(?:HP|HPE|Aruba)\b", first, re.I): + # Find the HP/Aruba product banner line — may not be the first line + # (older ProCurve shows "Image stamp:" first, banner follows later) + banner = "" + for line in output.splitlines(): + if re.match(r"\s*(?:HP|HPE|Aruba)\b", line, re.I): + banner = line.strip() + break + if not banner: return "", "" + first = banner # Extract J-code part number _PN_RE_V = re.compile(r"\b(J\d{4}[A-Z]{1,2})\b")