Apply SwOS Config
apply_swos_configApply a SwOS switch config safely: plan every change first, default to dry run, snapshot endpoints for rollback, and block risky management or lockout changes unless explicitly allowed.
Instructions
Apply a switch config document (the format get_swos_config exports) to a SwOS switch. Plans every change against the switch first; dryRun defaults to true. Writes only the endpoints that change: the VLAN table grows first (new VLANs and members), then the per-port settings (VLAN, isolation, storm and flood control), port names/negotiation/enabled, LAG and SNMP, then the table shrinks (removed VLANs and members), then system — so no port loses its VLAN mid-apply. Refuses management changes (address, allow-from) unless includeManagement is true, and any plan that would cut a linked port off (its untagged VLAN moved or dropped, a trunk losing tagged VLANs or becoming an access port, a forced VLAN, a port that starts filtering VLANs, the port disabled, renegotiating, isolated from another linked port or moved in or out of a LAG, every linked port dropped from allow_from_ports; only risks the plan introduces) unless acceptLockoutRisk is true. All six endpoints are snapshotted before a real apply, so rollback_change restores the previous state; the result names any endpoint whose snapshot failed, and says so when none was recorded. A document that moves management to another VLAN (allow_from_vlan) and changes a port's VLAN settings or the VLAN table's membership at the same time is refused, because that cannot be written in a safe order (sys.b goes last and cuts the session): apply the VLAN changes first, then the move. snmp.community may reference only the secrets bound to the switch (its secrets list in routers.yaml); a switch without a list may reference none.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | Yes | The switch config: a YAML document (as text) or the same structure as an object. `version: 1`, then any of `system`, `ports`, `vlans`, `snmp`; only the settings it names are changed. `snmp.community` may be `${NAME}`, replaced by the server's MIKROMCP_SECRET_<NAME> value; no other field may reference a secret. | |
| dryRun | No | Plan and show every change without writing to the switch. | |
| routerId | No | Router ID; omit to use the default router. | |
| pruneVlans | No | When the config has a `vlans` list, remove VLANs the switch has but the list does not. | |
| acceptLockoutRisk | No | Apply a plan whose warnings show a linked port being cut off (its VLAN, untagged traffic, link, isolation or LAG changing). Refused unless this is true; a dry run shows the warnings without it. | |
| confirmationToken | No | Token from a prior APPROVAL_REQUIRED response. Re-submit the identical call with this token to confirm the destructive action. | |
| includeManagement | No | Allow changes to how the switch is reached: address acquisition, static IP and the allow-from settings. Refused unless this is true. |