Switch State Diagram
This document describes the Finite State Machine (FSM) for Switches in NICo: lifecycle from creation through configuration, validation, ready, optional rack-level reprovisioning, operator maintenance, decommissioning, and deletion.
High-Level Overview
The main flow shows the primary states and transitions:
States
Transitions (by trigger)
Rack-Level Re-Provisioning
Rack maintenance drives switch reprovisioning by setting switch_reprovisioning_requested with an initiator prefixed rack-. The switch controller then walks these sub-states in order when continue_after_firmware_upgrade is true (the default):
The rack state machine updates per-switch firmware_upgrade_status, nvos_update_status, and fabric_manager_status while the switch waits in each sub-state. If the parent rack enters Error, the switch aborts reprovisioning and returns to Ready.
On-Demand Maintenance Operations
The Maintenance state is entered when switch_maintenance_requested is posted (from Ready or Error). Supported operations:
- PowerOn — powers the switch on via the component manager.
- PowerOff — powers the switch off.
- Reset — force-restarts the switch.
- ReconfigureCertificate — reinstalls or rotates NVOS mTLS certificates via component manager / RMS. Uses the same async certificate flow as bring-up; see Switch Certificate Configuration.
Decommissioning
Managed-switch decommissioning requires the RMS switch backend and starts only
from Ready. After Site Explorer acknowledges suppression, the controller
submits the NVOS factory reset, persists the returned job ID, and polls that
job until RMS reports Completed. It then suppresses NVOS DHCP, requests a
switch reboot through Redfish, and completes the NVOS DHCP wait before
suppressing BMC DHCP and resetting the BMC. It then completes the BMC DHCP wait
before deleting managed credentials. Either endpoint can complete its wait
without acknowledgement. Refer to
DHCP Suppression Acknowledgement
for the shared rule.
Transient handler errors leave the switch in its current sub-state for a
later retry. A failed RMS reset job reports ManualInterventionRequired
while retaining the job ID in WaitingForNvosFactoryReset. An ambiguous
submission outcome enters NvosFactoryResetOutcomeUnknown, which requires
operator recovery and does not automatically resubmit the reset.
Refer to Decommission Managed Switches for the operator procedure and intended post-reset state.
Implementation
- State type:
SwitchControllerStateincrates/api-model/src/switch/mod.rs. - Handlers:
crates/switch-controller/src/— one module per top-level state (created,initializing,configuring,fetch_info,validating,bom_validating,ready,decommissioning,maintenance,reprovisioning,error_state,deleting). - Certificate configuration design: switch_configure_certificate.md.
- Orchestration:
SwitchStateHandlerinhandler.rsdelegates to the handler for the currentcontroller_state.