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, 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.
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,maintenance,reprovisioning,error_state,deleting). - Certificate configuration design: /infra-controller/documentation/architecture/state-machines/switch-certificate-configuration.
- Orchestration:
SwitchStateHandlerinhandler.rsdelegates to the handler for the currentcontroller_state.