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
This commit is contained in:
+8
-8
@@ -368,7 +368,7 @@ def push_one_by_one(commands: list[str]) -> dict:
|
|||||||
if ch.recv_ready():
|
if ch.recv_ready():
|
||||||
ch.recv(4096) # drain banner
|
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)
|
out, err = _run_one(ch, setup)
|
||||||
if err:
|
if err:
|
||||||
return {"success": False, "saved": False,
|
return {"success": False, "saved": False,
|
||||||
@@ -476,8 +476,8 @@ def _poll_loop():
|
|||||||
try:
|
try:
|
||||||
data = {
|
data = {
|
||||||
"port_status": read_cmd("show interfaces"),
|
"port_status": read_cmd("show interfaces"),
|
||||||
"poe_status": read_cmd("show poe-port-status"),
|
"poe_status": read_cmd("show poe-port status ALL"),
|
||||||
"vlan_members": read_cmd("show vlan members"),
|
"vlan_members": read_cmd("show vlan"),
|
||||||
"sys_info": read_cmd("show sys-info"),
|
"sys_info": read_cmd("show sys-info"),
|
||||||
}
|
}
|
||||||
with _cache_lock:
|
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().
|
Returns a list of CLI command strings ready for push_one_by_one().
|
||||||
"""
|
"""
|
||||||
p = cfg.port
|
p = cfg.port
|
||||||
iface = f"GigabitEthernet 1/{p}"
|
iface = f"GigabitEthernet {p}"
|
||||||
cmds = []
|
cmds = []
|
||||||
if cfg.description:
|
if cfg.description:
|
||||||
cmds += [f"interface {iface}", f' name "{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"]
|
cmds += [f"interface {iface}", " shutdown"]
|
||||||
elif cfg.mode == "access":
|
elif cfg.mode == "access":
|
||||||
vid = san_vid(cfg.access_vlan, "access_vlan")
|
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":
|
elif cfg.mode == "trunk":
|
||||||
native = san_vid(cfg.native_vlan, "native_vlan")
|
native = san_vid(cfg.native_vlan, "native_vlan")
|
||||||
tagged = [san_vid(v, f"tagged_{v}") for v in (cfg.tagged_vlans or [])]
|
tagged = [san_vid(v, f"tagged_{v}") for v in (cfg.tagged_vlans or [])]
|
||||||
if tagged:
|
if tagged:
|
||||||
ts = ",".join(str(v) for v in tagged)
|
ts = ",".join(str(v) for v in tagged)
|
||||||
cmds += [f"vlan members add {ts} 1/{p}", f"vlan tagging {ts} 1/{p}"]
|
cmds += [f"vlan members add {ts} {p}", f"vlan tagging {ts} {p}"]
|
||||||
cmds.append(f"vlan pvid 1/{p} {native}")
|
cmds.append(f"vlan pvid {p} {native}")
|
||||||
if p <= 96:
|
if p <= 96:
|
||||||
cmds += [f"interface {iface}",
|
cmds += [f"interface {iface}",
|
||||||
" poe enable" if cfg.poe else " no poe enable"]
|
" poe enable" if cfg.poe else " no poe enable"]
|
||||||
@@ -757,7 +757,7 @@ def live():
|
|||||||
@app.get("/api/switch/config")
|
@app.get("/api/switch/config")
|
||||||
def running_config():
|
def running_config():
|
||||||
"""Fetch and return the full switch running config (read-only, no auth)."""
|
"""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())}
|
return {"config": out, "lines": len(out.splitlines())}
|
||||||
|
|
||||||
# ── Danger pre-flight (no auth — check before prompting TOTP) ─────────
|
# ── Danger pre-flight (no auth — check before prompting TOTP) ─────────
|
||||||
|
|||||||
Reference in New Issue
Block a user