From 042a2b6d2ea076bdc6820ae823f43ab081fd8312 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Mon, 22 Jun 2026 22:37:25 +0200 Subject: [PATCH] fix: get_facts() reads hardware vendor from /tmp/sysinfo/board_name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit board_name format is "vendor,model" (e.g. "sophos,ap100"). The prefix before the comma is title-cased to give the manufacturer name (e.g. "Sophos"). Falls back to "OpenWrt" when board_name is unavailable. The model is already read from /tmp/sysinfo/model which gives the full human-readable name (e.g. "Sophos AP100") — no change needed there. Co-Authored-By: Claude Sonnet 4.6 --- napalm_openwrt/openwrt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/napalm_openwrt/openwrt.py b/napalm_openwrt/openwrt.py index 87a60ee..dbc11f5 100644 --- a/napalm_openwrt/openwrt.py +++ b/napalm_openwrt/openwrt.py @@ -189,7 +189,13 @@ class OpenWrtDriver( release_out = self._send_command("cat /etc/openwrt_release") release = self._parse_openwrt_release(release_out) - facts["vendor"] = "OpenWrt" + # Hardware vendor from board_name (e.g. "sophos,ap100" → "Sophos") + # Fall back to "OpenWrt" when board_name is unavailable or has no comma. + board_name_raw = self._send_command("cat /tmp/sysinfo/board_name 2>/dev/null").strip() + if board_name_raw and "," in board_name_raw and not board_name_raw.startswith("cat:"): + facts["vendor"] = board_name_raw.split(",")[0].strip().title() + else: + facts["vendor"] = "OpenWrt" # Prefer the device-tree model (e.g. "Sophos AP100") over the SoC target model_raw = self._send_command("cat /tmp/sysinfo/model 2>/dev/null")