How sonic-net/sonic-swss works
SONiC SWSS is the switch-state service: it connects network-control and configuration inputs to switch state and hardware through database-backed daemons. The principal path is route information from FPM/BGP into route tables, then orchestration into SAI. Other branches synchronize link, neighbor, FDB, and team state, manage switch features, and collect/report counters. The README describes SWSS’s database-interface role; edges for unsampled daemons are limited to that documented role and their tree-supported responsibilities.
Main entry points: orchdaemon.cpp Orchestration daemon · ipfix.rs IPFIX processing · main.cpp Team interface daemon · main.rs Counter sync service
Components 25
State synchronization
- FPM route sync
fpmsyncd/routesync.cpp - Neighbor sync
neighsyncd/neighsync.cpp - FDB sync
fdbsyncd/fdbsync.cpp - Port link sync
portsyncd/linksync.cpp
Switch orchestration
- Orchestration entry
orchagent/main.cpp - Orchestration daemon
orchagent/orchdaemon.cpp - Routes and neighbors
orchagent/routeorch.cpp - Ports and interfaces
orchagent/portsorch.cpp - Forwarding database
orchagent/fdborch.cpp - P4 object managers
orchagent/p4orch/p4orch.cpp
Feature configuration
- Feature config managers
cfgmgr
Counters and telemetry
- Counter sync service
crates/countersyncd/src/main.rs - IPFIX processing
crates/countersyncd/src/actor/ipfix.rs - Counter database writer
crates/countersyncd/src/actor/counter_db.rs - Stats reporter
crates/countersyncd/src/actor/stats_reporter.rs - Flex counter manager
orchagent/flex_counter/flex_counter_manager.cpp
Team interfaces
- Team interface daemon
tlm_teamd/main.cpp - Team control manager
tlm_teamd/teamdctl_mgr.cpp - Team values store
tlm_teamd/values_store.cpp
Other components
- BGP control plane
- Application database
- Configuration database
- SAI switch hardware
- Kernel netlink
- State database
Connections 28
- BGP control plane → FPM route sync: sends routes
- FPM route sync → Application database: publishes routes
- Neighbor sync → Application database: publishes state
- FDB sync → Application database: publishes state
- Port link sync → Application database: publishes links
- Orchestration entry → Orchestration daemon: starts
- Orchestration daemon → Application database: consumes state
- Orchestration daemon → Configuration database: reads configuration
- Orchestration daemon → Routes and neighbors: dispatches work
- Orchestration daemon → Ports and interfaces: dispatches work
- Orchestration daemon → Forwarding database: dispatches work
- Orchestration daemon → P4 object managers: dispatches work
- Routes and neighbors → SAI switch hardware: programs routes
- Ports and interfaces → SAI switch hardware: programs ports
- Forwarding database → SAI switch hardware: programs forwarding
- P4 object managers → SAI switch hardware: programs objects
- Feature config managers → Configuration database: handles configuration
- Counter sync service → Kernel netlink: subscribes
- Counter sync service → IPFIX processing: starts actor
- Kernel netlink → IPFIX processing: delivers records
- IPFIX processing → Counter database writer: forwards statistics
- Counter database writer → Application database: writes counters
- IPFIX processing → Stats reporter: forwards statistics
- Flex counter manager → Application database: configures counters
- Team interface daemon → State database: subscribes to LAG
- Team interface daemon → Team control manager: updates interfaces
- Team interface daemon → Team values store: stores dumps
- Team values store → State database: updates values