소스 검색

refactor(asuswrt): move support to external integration (#1580)

Closes #1579
Nacho 1 개월 전
부모
커밋
8c0d5fd51e

+ 6 - 0
CHANGELOG.md

@@ -5,6 +5,12 @@ Todos los cambios notables de NetPulse se documentan en este fichero.
 El formato se basa en [Keep a Changelog](https://keepachangelog.com/es/1.1.0/),
 y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/).
 
+## [Unreleased]
+
+### Changed
+
+- **Asuswrt/Merlin pasa a integración externa (#1579)**: el tipo nativo `asuswrt` se migra a `external` conservando el token, las sondas portables siguen compartidas y el nuevo `asuswrt-pusher` vive en `netpulse-integrations`. Desaparecen el alta como `asuswrt` y su actualización desde la UI. La instalación y actualización pasan a ser manuales, como en las demás integraciones externas.
+
 ## [2.47.0] - 2026-10-23
 
 ### Added

+ 14 - 29
README.es.md

@@ -103,7 +103,7 @@ de la plataforma:
 | Plataforma | Cómo corre el agente | Notas |
 |---|---|---|
 | OpenWrt (incl. GL.iNet) | Paquete nativo `netpulse-agent` (`.ipk`/`.apk`) | procd, config UCI, `luci-app-netpulse`, instalación y upgrade desde la app |
-| Asuswrt / Asuswrt-Merlin | Binario estático en `/jffs`, fichero de entorno | Sin `ubus`: recurre a `/proc`, `iw` y `lldpd`. Instalación y actualización manuales |
+| Asuswrt / Asuswrt-Merlin | `asuswrt-pusher` externo en [netpulse-integrations](https://github.com/gnacho/netpulse-integrations/tree/main/asuswrt) | Binario estático en `/jffs`, con `/proc`, `iw` y `lldpd`. Instalación y actualización manuales |
 | RouterOS | Pusher Go separado en [netpulse-integrations](https://github.com/gnacho/netpulse-integrations) | Sistema, puertos, DHCP, ARP, FDB, temperatura, firmware y tráfico WAN |
 | Otras familias de router | Pusher Go separado en [netpulse-integrations](https://github.com/gnacho/netpulse-integrations) | Ver la [guía de integraciones externas](docs/external-integrations.md) |
 | Switches gestionados | SNMP | Estado de bocas, velocidades y vecinos LLDP-MIB |
@@ -168,9 +168,9 @@ anterior se puede tocar en la **[demo en vivo](https://demo.netpulse.cloudless.c
 ## Empieza en unos cinco minutos
 
 Necesitas una caja Linux con systemd (x86_64, arm64 o armv7; un LXC o VM
-pequeña sobra) y routers OpenWrt/GL.iNet en tu LAN. Asuswrt/Merlin también
-está soportado, y cualquier cosa con SSH o SNMP se añade a mano (mira la
-sección plegada de más abajo).
+pequeña sobra) y routers OpenWrt/GL.iNet en tu LAN. Asuswrt/Merlin se soporta
+mediante una integración externa, y cualquier cosa con SSH o SNMP se añade a
+mano (mira la sección plegada de más abajo).
 
 **1. Instala el servidor** en la caja:
 
@@ -204,7 +204,7 @@ el agente, empuja el binario correcto para la arquitectura del router,
 escribe la config y arranca el servicio; aparece como conectado en segundos.
 Los routers a los que el servidor no llega por SSH usan el token de
 emparejamiento (**Ajustes → Adopción de agentes**, mira la sección plegada
-de abajo), y Asuswrt lleva un binario manual como se cuenta en esa sección.
+de abajo). Asuswrt/Merlin utiliza el pusher externo descrito en esa sección.
 
 **5. Llévatela contigo.** Instala la PWA desde el navegador (Añadir a
 pantalla de inicio / Instalar app) y activa Web Push en Ajustes: las alertas
@@ -248,31 +248,16 @@ SSH, Ajustes → Adopción de agentes muestra un token reutilizable:
 `install-agent.sh --pairing-token` (ejecutado desde cualquier máquina que
 alcance el router y el servidor) registra el agente en el primer contacto.
 
-**Asuswrt / Merlin.** El agente también corre en routers Asuswrt y
-Asuswrt-Merlin (probado en un GT-BE98 Pro con nodos mesh RT-AX92U). Allí no
-hay `opkg`: es un binario estático al uso. Coge
-`netpulse-agent_<versión>_linux_arm64.tar.gz` (o `armv7`, `mips`, `mipsle`
-para hardware más viejo) de la
-[última release](https://github.com/gnacho/netpulse/releases), cópialo a
-`/jffs/` (que sobrevive a los firmwares, a diferencia de `/tmp`) y apúntalo
-a tu servidor. El fichero de config por defecto es
-`/etc/netpulse-agent.env`, así que déjalo en `/jffs` y nómbralo explícito:
+**Asuswrt / Merlin.** El soporte vive en la integración externa
+[`asuswrt-pusher`](https://github.com/gnacho/netpulse-integrations/tree/main/asuswrt).
+Compila su binario estático, crea el router con tipo `external` y copia el
+binario y el fichero de entorno a `/jffs/`, que sobrevive a las
+actualizaciones de firmware. El README de la integración explica el arranque
+al boot y las actualizaciones manuales.
 
-```sh
-cat > /jffs/netpulse-agent.env <<'EOF'
-NETPULSE_SERVER=http://<ip-del-servidor-netpulse>:3000
-NETPULSE_SLUG=<slug>
-NETPULSE_TOKEN=<token de 64 hex>
-EOF
-NETPULSE_ENV_FILE=/jffs/netpulse-agent.env /jffs/netpulse-agent &
-```
-
-Para arrancarlo al boot, añade esa misma línea a `/jffs/scripts/init-start`
-(o `services-start`). No hay procd ni reinstall por SSH: las actualizaciones
-van por el comando `upgrade` del propio agente o copiando el binario nuevo.
-Todo lo que no necesita `ubus` funciona, incluida la topología (FDB del
-bridge, `iw`, `lldpd`); lo que depende de específicos de GL.iNet simplemente
-no está.
+El pusher usa las sondas portables para sistema, WiFi, DHCP, FDB del bridge,
+ARP y LLDP. Lo que necesita `ubus` o servicios de GL.iNet sigue ausente, y las
+acciones de upgrade y reinstall del agente nativo no están disponibles.
 
 **Sidecar de latencia.** Sondeos TCP de latencia por router a largo plazo,
 opcionales:

+ 13 - 29
README.md

@@ -101,7 +101,7 @@ the platform:
 | Platform | How the agent runs | Notes |
 |---|---|---|
 | OpenWrt (incl. GL.iNet) | Native `netpulse-agent` package (`.ipk`/`.apk`) | procd, UCI config, `luci-app-netpulse`, in-app install and upgrade |
-| Asuswrt / Asuswrt-Merlin | Static binary in `/jffs`, env file | No `ubus`: falls back to `/proc`, `iw` and `lldpd`. Manual install and update |
+| Asuswrt / Asuswrt-Merlin | External `asuswrt-pusher` in [netpulse-integrations](https://github.com/gnacho/netpulse-integrations/tree/main/asuswrt) | Static binary in `/jffs`, using `/proc`, `iw` and `lldpd`. Manual install and update |
 | RouterOS | Separate Go pusher in [netpulse-integrations](https://github.com/gnacho/netpulse-integrations) | System, ports, DHCP, ARP, FDB, temperature, firmware and WAN traffic |
 | External router families | Separate Go pusher in [netpulse-integrations](https://github.com/gnacho/netpulse-integrations) | See the [external integrations guide](docs/external-integrations.md) |
 | Managed switches | SNMP | Port states, speeds and LLDP-MIB neighbours |
@@ -161,8 +161,8 @@ one by one, and everything above is clickable in the **[live demo](https://demo.
 
 You need a Linux box with systemd (x86_64, arm64 or armv7; a small LXC or VM
 is plenty) and OpenWrt/GL.iNet routers on your LAN. Asuswrt/Merlin is
-supported too, and anything with SSH or SNMP can be added by hand (see the
-folded section below).
+supported through an external integration, and anything with SSH or SNMP can
+be added by hand (see the folded section below).
 
 **1. Install the server** on the box:
 
@@ -194,8 +194,8 @@ offer an **Install agent** button. One click and the server registers the
 agent, pushes the right binary for the router's architecture, writes the
 config and starts the service; it shows up as connected within seconds.
 Routers the server cannot SSH into use the pairing token instead
-(**Settings → Agent adoption**, see the folded section below), and Asuswrt
-takes a manual binary as described there.
+(**Settings → Agent adoption**, see the folded section below). Asuswrt/Merlin
+uses the external pusher described there.
 
 **5. Take it with you.** Install the PWA from your browser (Add to home
 screen / Install app) and enable Web Push in Settings: alerts reach your
@@ -239,31 +239,15 @@ Agent adoption shows a reusable pairing token:
 `install-agent.sh --pairing-token` (run from any machine that can reach both
 the router and the server) registers the agent on first contact.
 
-**Asuswrt / Merlin.** The agent also runs on Asuswrt and Asuswrt-Merlin
-routers (tested on a GT-BE98 Pro with RT-AX92U mesh nodes). There is no
-`opkg` there, so it is a plain static binary: pick
-`netpulse-agent_<version>_linux_arm64.tar.gz` (or `armv7`, `mips`,
-`mipsle` for older hardware) from the
-[latest release](https://github.com/gnacho/netpulse/releases), copy it to
-`/jffs/` (which survives firmware updates, unlike `/tmp`), and point it at
-your server. The config file defaults to `/etc/netpulse-agent.env`, so keep
-it in `/jffs` and name it explicitly:
+**Asuswrt / Merlin.** Support lives in the external
+[`asuswrt-pusher`](https://github.com/gnacho/netpulse-integrations/tree/main/asuswrt)
+integration. Build its static binary, create the router as type `external`
+and copy the binary and environment file to `/jffs/`, which survives firmware
+updates. The integration README covers boot startup and manual upgrades.
 
-```sh
-cat > /jffs/netpulse-agent.env <<'EOF'
-NETPULSE_SERVER=http://<netpulse-server-ip>:3000
-NETPULSE_SLUG=<slug>
-NETPULSE_TOKEN=<64-hex token>
-EOF
-NETPULSE_ENV_FILE=/jffs/netpulse-agent.env /jffs/netpulse-agent &
-```
-
-To start it at boot, add that same line to `/jffs/scripts/init-start` (or
-`services-start`). There is no procd and no SSH-based reinstall: updates go
-through the agent's own `upgrade` command, or by copying the new binary.
-Everything that does not need `ubus` works, including the topology (bridge
-FDB, `iw`, `lldpd`); features that depend on GL.iNet specifics are simply
-absent.
+The pusher uses the portable probes for system data, wireless, DHCP, bridge
+FDB, ARP and LLDP. Features that require `ubus` or GL.iNet services remain
+absent, and the native agent upgrade and reinstall actions are not available.
 
 **Latency sidecar.** Optional long-term TCP latency probes per router:
 

+ 1 - 2
app/src/components/routers/AgentBadge.tsx

@@ -19,8 +19,7 @@ interface AgentBadgeProps {
 
 function isOpenWrtDevice(t?: string): boolean {
   if (!t) return true
-  // #1481: asuswrt lleva agente nativo como openwrt/glinet.
-  return t === 'glinet' || t === 'openwrt' || t === 'asuswrt'
+  return t === 'glinet' || t === 'openwrt'
 }
 
 /**

+ 4 - 9
app/src/components/routers/AgentsSection.tsx

@@ -39,9 +39,7 @@ import { cn, copyToClipboard } from '@/lib/utils'
 
 function isOpenWrtType(t: string | undefined): boolean {
   if (!t) return true
-  // #1481: asuswrt es agent-driven como openwrt/glinet (badge, tabla de
-  // agentes y botón Actualizar); lo que NO tiene es SSH para install/reinstall.
-  return t === 'glinet' || t === 'openwrt' || t === 'asuswrt'
+  return t === 'glinet' || t === 'openwrt'
 }
 
 // copyText: alias del helper compartido con fallback para orígenes no
@@ -85,19 +83,16 @@ function AgentRow({ agent, router, nowSec }: { agent?: AgentInfo; router: Router
   // #483: sin agente = TOD router nativo OpenWrt sin agente (antes solo los
   // agent-only): la fila ofrece Instalar, que registra y despliega.
   const isMissing = agent === undefined
-  // #1481: en asuswrt no hay SSH/procd: ni install (copiar comando) ni
-  // reinstall ni uninstall; el agente se actualiza con el botón Actualizar.
-  const isAsuswrt = router?.type === 'asuswrt'
-  const canRecover = isOpenWrt && !isAsuswrt && (isStale || isMissing) && auth?.role === 'admin'
+  const canRecover = isOpenWrt && (isStale || isMissing) && auth?.role === 'admin'
   // #443: reinstall disponible SIEMPRE para admins en agentes nativos OpenWrt
   // (sanos o caídos): antes solo aparecía cuando estaba stale o faltaba, y el
   // duplicado vivía en la tarjeta Info del detalle.
-  const canReinstall = auth?.role === 'admin' && isOpenWrt && !isAsuswrt && (agent !== undefined || isMissing)
+  const canReinstall = auth?.role === 'admin' && isOpenWrt && (agent !== undefined || isMissing)
   // #624: desinstalar el agente vía SSH (liberar espacio en routers con poco
   // room, p. ej. UniFi 6 Lite). Solo agentes nativos OpenWrt con agente
   // presente: no tiene sentido desinstalar algo que no está, ni un NetGrip
   // (que se gestiona desde su propio panel) ni un scraper externo.
-  const canUninstall = auth?.role === 'admin' && isOpenWrt && !isAsuswrt && agent !== undefined && agent.kind !== 'external' && agent.kind !== 'netgrip'
+  const canUninstall = auth?.role === 'admin' && isOpenWrt && agent !== undefined && agent.kind !== 'external' && agent.kind !== 'netgrip'
   // #1382: retirar el agente de la flota (revoca token + olvida estado) solo
   // se ofrece con el agente SIN pulso (equipo apagado o quitado de la red):
   // retirar uno vivo deja un proceso empujando contra un token revocado.

+ 1 - 1
app/src/components/routers/FleetCard.tsx

@@ -92,7 +92,7 @@ export function FleetCard({ router, index = 0, refreshKey = 0 }: FleetCardProps)
   const inStartupGrace = (serverUptimeSec ?? Number.MAX_SAFE_INTEGER) < STARTUP_GRACE_SEC
   const extras = isDemo ? getRouterExtras(router.id) : EMPTY_EXTRAS
   const warn = router.status === 'warn'
-  const isOpenWrt = !router.type || router.type === 'glinet' || router.type === 'openwrt' || router.type === 'asuswrt'
+  const isOpenWrt = !router.type || router.type === 'glinet' || router.type === 'openwrt'
   const agentDown = isOpenWrt && agent !== undefined && !agent.fresh
   const agentMissing = isOpenWrt && agent === undefined && router.agentOnly
   const reduce = useReducedMotion()

+ 1 - 3
app/src/pages/Settings.tsx

@@ -357,7 +357,7 @@ function Confetti({ burstKey, reduce }: { burstKey: number; reduce: boolean }) {
 // Gestión de routers (modo live): CRUD contra /api/config/routers
 // ---------------------------------------------------------------------------
 
-type RouterType = 'glinet' | 'openwrt' | 'managed-switch' | 'external' | 'asuswrt'
+type RouterType = 'glinet' | 'openwrt' | 'managed-switch' | 'external'
 
 interface ConfigRouter {
   id: string
@@ -979,7 +979,6 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
             options={[
               { value: 'openwrt', label: 'OpenWrt' },
               { value: 'glinet', label: 'GL.iNet' },
-              { value: 'asuswrt', label: 'Asuswrt' },
               { value: 'managed-switch', label: t('settings.routers.typeManaged') },
               { value: 'external', label: t('settings.routers.typeExternal') },
             ]}
@@ -1149,7 +1148,6 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
                   options={[
                     { value: 'openwrt', label: 'OpenWrt' },
                     { value: 'glinet', label: 'GL.iNet' },
-              { value: 'asuswrt', label: 'Asuswrt' },
                     { value: 'managed-switch', label: t('settings.routers.typeManaged') },
                     { value: 'external', label: t('settings.routers.typeExternal') },
                   ]}

+ 3 - 1
docs/external-integrations.md

@@ -25,7 +25,7 @@ NetPulse POST /api/ingest/agent
 Normal fleet state, history and UI
 ```
 
-The external agent runs on any always-on host that can reach both the router and NetPulse. It can be a small static binary managed by systemd. Docker is optional, never a requirement.
+The external agent usually runs on any always-on host that can reach both the router and NetPulse. It can be a small static binary managed by systemd. The Asuswrt/Merlin pusher runs on the router itself. Docker is optional, never a requirement.
 
 The split of responsibility is deliberate:
 
@@ -123,6 +123,8 @@ Contract rules:
 
 The working RouterOS implementation in [`netpulse-integrations/routeros`](https://github.com/gnacho/netpulse-integrations/tree/main/routeros) shows configuration, token use, signing and pushing. RouterOS is supported only through this integration: the server has no RouterOS adapter or credentials. It is also a reference for the transport, not a template that requires copying the whole native agent.
 
+Asuswrt/Merlin follows the same external contract through [`netpulse-integrations/asuswrt`](https://github.com/gnacho/netpulse-integrations/tree/main/asuswrt). It reuses the portable probes from `agent/probe`, but not the native command, backup or upgrade runtime. Existing `asuswrt` router rows migrate to `external` with their agent tokens preserved.
+
 ## Preserve the meaning of the data
 
 The contract carries semantics, not just JSON names.

+ 1 - 5
server-go/internal/adapters/live.go

@@ -714,9 +714,7 @@ func (l *Live) SetRouters(list []RouterConfig) {
 	l.gatewayCfg = pickGateway(l.routers)
 	l.clients = map[string]*OpenWrtClient{}
 	for _, c := range l.routers {
-		// Asuswrt is not polled over SSH (it has no ubus): its only source is
-		// the agent (#1481), and without one the unit goes offline.
-		if !c.AgentOnly && c.Type != "asuswrt" {
+		if !c.AgentOnly {
 			l.clients[c.ID] = NewOpenWrtClient(c, l.pool, "root", "")
 		}
 	}
@@ -1694,8 +1692,6 @@ func (l *Live) offlineRouter(cfg RouterConfig) Router {
 		switch cfg.Type {
 		case "glinet":
 			model = "GL.iNet"
-		case "asuswrt":
-			model = "Asuswrt"
 		case "managed-switch":
 			model = "Managed Switch"
 		}

+ 46 - 0
server-go/internal/db/asuswrt_migration_test.go

@@ -0,0 +1,46 @@
+package db_test
+
+import (
+	"testing"
+
+	"github.com/gnacho/netpulse/server-go/internal/db"
+	"github.com/gnacho/netpulse/server-go/internal/rearmer"
+)
+
+func TestOpenMigratesAsuswrtRoutersToExternalAndPreservesToken(t *testing.T) {
+	dataDir := t.TempDir()
+	first, err := db.Open(dataDir)
+	if err != nil {
+		t.Fatalf("db.Open first: %v", err)
+	}
+	if _, err := first.Exec(`INSERT INTO routers (id, name, host, type, created_at) VALUES ('asus1', 'GT-BE98 Pro', '192.168.8.30', 'asuswrt', 1)`); err != nil {
+		t.Fatalf("insert asuswrt row: %v", err)
+	}
+	if _, err := first.Exec(`INSERT INTO kv (key, value) VALUES (?, ?)`, rearmer.TokenPrefix+"asus1", "existing-token-hash"); err != nil {
+		t.Fatalf("insert agent token: %v", err)
+	}
+	if err := first.Close(); err != nil {
+		t.Fatalf("close first: %v", err)
+	}
+
+	second, err := db.Open(dataDir)
+	if err != nil {
+		t.Fatalf("db.Open second: %v", err)
+	}
+	defer second.Close()
+
+	var typ, tokenHash string
+	var agentOnly int
+	if err := second.QueryRow(`SELECT type, agent_only FROM routers WHERE id = 'asus1'`).Scan(&typ, &agentOnly); err != nil {
+		t.Fatalf("read migrated router: %v", err)
+	}
+	if typ != "external" || agentOnly != 1 {
+		t.Fatalf("migrated router = type %q agent_only %d, want external/1", typ, agentOnly)
+	}
+	if err := second.QueryRow(`SELECT value FROM kv WHERE key = ?`, rearmer.TokenPrefix+"asus1").Scan(&tokenHash); err != nil {
+		t.Fatalf("read preserved token: %v", err)
+	}
+	if tokenHash != "existing-token-hash" {
+		t.Fatalf("token hash changed to %q", tokenHash)
+	}
+}

+ 5 - 5
server-go/internal/db/db.go

@@ -651,11 +651,11 @@ func Open(dataDir string, opts ...OpenOption) (*DB, error) {
 		}
 	}
 
-	// RouterOS moved out of the server (#1574). Keep existing units visible
-	// as external routers until their owner deploys the pusher. Their old
-	// credential columns are left in place as inert legacy schema.
-	if _, err := sqldb.Exec(`UPDATE routers SET type = 'external', agent_only = 1 WHERE type = 'routeros'`); err != nil {
-		log.Printf("[netpulse] aviso: no se pudieron migrar los routers RouterOS a external: %v", err)
+	// RouterOS and Asuswrt/Merlin moved to external integrations (#1574,
+	// #1579). Keep existing units visible until their owner deploys the
+	// pusher. Legacy credential columns remain in place as inert schema.
+	if _, err := sqldb.Exec(`UPDATE routers SET type = 'external', agent_only = 1 WHERE type IN ('routeros', 'asuswrt')`); err != nil {
+		log.Printf("[netpulse] aviso: no se pudieron migrar los routers RouterOS/Asuswrt a external: %v", err)
 	}
 
 	// #1129: las MACs de roam_events se ingirieron en minúsculas (así vienen

+ 5 - 18
server-go/internal/httpapi/agent.go

@@ -447,8 +447,7 @@ func (s *server) rotateTokenHot(slug, token string) string {
 			break
 		}
 	}
-	// #1481: asuswrt no tiene SSH para rotar el token en caliente.
-	if host == "" || !s.routerUpgradeable(slug) || s.routerTypeOf(slug) == "asuswrt" {
+	if host == "" || !s.routerUpgradeable(slug) {
 		return "no_router"
 	}
 	if _, err := s.pool.Run(host, reinstall.TokenPushScript(slug, token), 60*time.Second); err != nil {
@@ -582,10 +581,7 @@ type agentUpgradeInfo struct {
 // actualizable; los de type managed-switch/external NO (son scrapers que no
 // usan el agente nativo y no entienden el comando "upgrade").
 func agentUpgradeable(typ string) bool {
-	// #1481: asuswrt se actualiza con el comando "upgrade" del agente (baja el
-	// binario y se lo cambia él mismo, sin procd); el REINSTALL por SSH sigue
-	// prohibido (handleAgentReinstall lo excluye aparte).
-	return typ == "" || typ == "openwrt" || typ == "glinet" || typ == "asuswrt"
+	return typ == "" || typ == "openwrt" || typ == "glinet"
 }
 
 // routerTypeOf: tipo de la fila routers para el slug ("" si no existe).
@@ -895,15 +891,6 @@ func (s *server) handleAgentReinstall(w http.ResponseWriter, r *http.Request) {
 			"este dispositivo no usa el agente nativo OpenWrt (scraper); reinstálalo con su propio mecanismo")
 		return
 	}
-	// #1481: asuswrt no tiene SSH/procd para un reinstall por el servidor; el
-	// agente se actualiza con el comando "upgrade" (o copiando el binario a
-	// mano), no reinstalando.
-	if s.routerTypeOf(slug) == "asuswrt" {
-		writeError(w, http.StatusConflict, "no_reinstall_asuswrt",
-			"en Asuswrt el agente se actualiza con el botón Actualizar (o copiando el binario); el reinstall por SSH no aplica")
-		return
-	}
-
 	// #1204: el env del agente lleva la sonda de latencia ACTIVA (WAN en el
 	// gateway, ping al gateway en los APs): el server resuelve el rol desde
 	// la tabla routers.
@@ -1040,10 +1027,10 @@ func (s *server) handleAgentsReemit(w http.ResponseWriter, r *http.Request) {
 	}
 	log.Printf("[netpulse] reemit: env re-emitido a %d/%d agentes", reemitted, len(out))
 	writeJSON(w, http.StatusOK, map[string]any{
-		"agents":  out,
+		"agents":    out,
 		"reemitted": reemitted,
-		"total":   len(out),
-		"message": fmt.Sprintf("env re-emitido a %d de %d agentes", reemitted, len(out)),
+		"total":     len(out),
+		"message":   fmt.Sprintf("env re-emitido a %d de %d agentes", reemitted, len(out)),
 	})
 }
 

+ 4 - 4
server-go/internal/httpapi/config.go

@@ -194,8 +194,8 @@ func (s *server) handleAddConfigRouter(w http.ResponseWriter, r *http.Request) {
 	if typ == "" {
 		typ = "openwrt"
 	}
-	if typ != "glinet" && typ != "openwrt" && typ != "managed-switch" && typ != "external" && typ != "asuswrt" {
-		writeError(w, http.StatusBadRequest, "invalid_input", "Invalid enum value. Expected 'glinet' | 'openwrt' | 'managed-switch' | 'external' | 'asuswrt'")
+	if typ != "glinet" && typ != "openwrt" && typ != "managed-switch" && typ != "external" {
+		writeError(w, http.StatusBadRequest, "invalid_input", "Invalid enum value. Expected 'glinet' | 'openwrt' | 'managed-switch' | 'external'")
 		return
 	}
 	var firmwareTarget string
@@ -333,8 +333,8 @@ func (s *server) handleUpdateConfigRouter(w http.ResponseWriter, r *http.Request
 	var typ *string
 	if in.Type != "" {
 		t := in.Type
-		if t != "glinet" && t != "openwrt" && t != "managed-switch" && t != "external" && t != "asuswrt" {
-			writeError(w, http.StatusBadRequest, "invalid_input", "Invalid enum value. Expected 'glinet' | 'openwrt' | 'managed-switch' | 'external' | 'asuswrt'")
+		if t != "glinet" && t != "openwrt" && t != "managed-switch" && t != "external" {
+			writeError(w, http.StatusBadRequest, "invalid_input", "Invalid enum value. Expected 'glinet' | 'openwrt' | 'managed-switch' | 'external'")
 			return
 		}
 		typ = &t

+ 3 - 3
server-go/internal/httpapi/config_test.go

@@ -106,11 +106,11 @@ func TestConfigRoutersCRUD(t *testing.T) {
 		t.Fatalf("type inválido: %d", res.StatusCode)
 	}
 
-	// #1481: asuswrt es un type válido (unidad agent-only sin SSH/procd).
+	// #1579: Asuswrt/Merlin se registra como external desde el pusher.
 	res = doReq(t, "POST", srv.URL+"/api/config/routers", cookie,
 		`{"name":"GT-BE98 Pro","host":"192.168.8.30","type":"asuswrt","agent_only":true}`)
-	if res.StatusCode != 201 {
-		t.Fatalf("type asuswrt: %d, want 201", res.StatusCode)
+	if res.StatusCode != 400 {
+		t.Fatalf("type asuswrt: %d, want 400", res.StatusCode)
 	}
 
 	// POST JSON inválido → 400 invalid_json