From 639f1ea16f07b810ddee807e5e885f45e57f2992 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Mar 2026 03:29:16 +0000 Subject: [PATCH] Fix SSH commands for BOSS v7.9.6 on ERS 59100GTS-PWR+ - Replace show poe-port-status with show poe-port status ALL - Replace show vlan members with show vlan - Replace show running-config with show config - Fix VLAN port format from 1/{p} to {p} (BOSS uses bare port numbers) - Fix interface naming from GigabitEthernet 1/{p} to GigabitEthernet {p} - Add terminal length 0 to push session setup to prevent pagination https://claude.ai/code/session_01JR2EMK7rwrZJowpstcaxQ6 --- switch_backend.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/switch_backend.py b/switch_backend.py index 14fbcd7..6e47c4b 100644 --- a/switch_backend.py +++ b/switch_backend.py @@ -368,7 +368,7 @@ def push_one_by_one(commands: list[str]) -> dict: if ch.recv_ready(): ch.recv(4096) # drain banner - for setup in ["enable", "configure terminal"]: + for setup in ["terminal length 0", "enable", "configure terminal"]: out, err = _run_one(ch, setup) if err: return {"success": False, "saved": False, @@ -476,8 +476,8 @@ def _poll_loop(): try: data = { "port_status": read_cmd("show interfaces"), - "poe_status": read_cmd("show poe-port-status"), - "vlan_members": read_cmd("show vlan members"), + "poe_status": read_cmd("show poe-port status ALL"), + "vlan_members": read_cmd("show vlan"), "sys_info": read_cmd("show sys-info"), } with _cache_lock: @@ -607,7 +607,7 @@ def build_port(cfg: PortConfig) -> list[str]: Returns a list of CLI command strings ready for push_one_by_one(). """ p = cfg.port - iface = f"GigabitEthernet 1/{p}" + iface = f"GigabitEthernet {p}" cmds = [] if cfg.description: cmds += [f"interface {iface}", f' name "{cfg.description}"'] @@ -615,14 +615,14 @@ def build_port(cfg: PortConfig) -> list[str]: cmds += [f"interface {iface}", " shutdown"] elif cfg.mode == "access": vid = san_vid(cfg.access_vlan, "access_vlan") - cmds += [f"vlan members add {vid} 1/{p}", f"vlan pvid 1/{p} {vid}"] + cmds += [f"vlan members add {vid} {p}", f"vlan pvid {p} {vid}"] elif cfg.mode == "trunk": native = san_vid(cfg.native_vlan, "native_vlan") tagged = [san_vid(v, f"tagged_{v}") for v in (cfg.tagged_vlans or [])] if tagged: ts = ",".join(str(v) for v in tagged) - cmds += [f"vlan members add {ts} 1/{p}", f"vlan tagging {ts} 1/{p}"] - cmds.append(f"vlan pvid 1/{p} {native}") + cmds += [f"vlan members add {ts} {p}", f"vlan tagging {ts} {p}"] + cmds.append(f"vlan pvid {p} {native}") if p <= 96: cmds += [f"interface {iface}", " poe enable" if cfg.poe else " no poe enable"] @@ -757,7 +757,7 @@ def live(): @app.get("/api/switch/config") def running_config(): """Fetch and return the full switch running config (read-only, no auth).""" - out = read_cmd("show running-config") + out = read_cmd("show config") return {"config": out, "lines": len(out.splitlines())} # ── Danger pre-flight (no auth — check before prompting TOTP) ─────────