Files
nixos/modules/services/switches/es-48-500w.agent.age
JakeHillion a84cb6d2ff
commit-validation / validate-single-commit (pull_request) Successful in 8s
buildbot/nix-eval Build done. (690 warnings)
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
switches: manage es-48-500w from the network registry
The VLANs and port settings of es-48-500w are configured by hand in its
web UI, and the VLAN each host's port carries is agreed with the host's
own config only by convention.

Added a switches service, on stinger, that applies the registry to the
managed switches. A device with a kind is a managed switch and has a
port table in network/ports: a port either names the registered device
cabled to it, and then carries that device's networks, or states its own
native and tagged networks. Each switch gets an activate-switch-NAME
oneshot unit that is handed the switch's desired state, so a deploy
re-runs the units of the switches whose state changed. edgeswitch.py
drives the switch over its SSH CLI: it diffs the desired state against
the running config, sends the commands that close the gap, and saves
the config only once the switch and the gateway are still reachable.

Registered es-48-500w as an edgeswitch with its full port table, taken
from the switch's current config except that ports 11 and 12 move from
the DMZ to the LAN, and marked the networks stinger and warlock carry as
tagged. warlock carries the DMZ without an address, so
a membership's address is now optional and the router only reserves
addresses for memberships that have one. The mtu9000 and cellular VLANs
are now networks in the registry, and cyclone reads the cellular VLAN ID
from it. The switch's SSH host key is in the fleet's known hosts, and
its password is an agent-tier secret.

Test plan:
- CI
- A dry run from maverick against the switch only moves ports 11 and 12
  to the LAN
- Applied and saved three test configurations to spare port 17 from
  maverick, covering joining, retagging and leaving VLANs, then restored
  the port
- Deployed to stinger with a tagged-only test configuration on port 12:
  the unit applied and saved it along with the port descriptions
- With an unreachable gateway the script applies, then exits without
  saving
- maverick's toplevel only gains the switch in its SSH known hosts; the
  router snapshot is unchanged
2026-11-19 23:39:23 +00:00

315 B