SWSS, Orchagents, syncd & ASIC_DB
SWSS orchestration agents consume desired state from the databases, resolve dependencies, and issue SAI calls; syncd carries those calls to the vendor SAI implementation and SDK, which programs the chip and reports back. ASIC_DB is the database representation in that synchronization path — a mirror of what has been asked of/acknowledged by SAI — NOT the silicon itself.
Prerequisites: Lesson 3.3 · Module 1 (the databases, syncd)
Learning objectives
- →Describe SWSS and the orchestration agents (orchagents) and what they consume/produce.
- →Explain dependency management: why objects must be created in reference order.
- →Explain syncd's role bridging SAI calls to the vendor implementation and SDK.
- →State precisely what ASIC_DB is — and is not.
- →Trace how notifications and counters flow back up from hardware.
This is the machinery that turns a database row into a programmed chip. When forwarding is broken but config is fine, the fault is almost always somewhere along this path.
Correctly understanding ASIC_DB prevents the most common conceptual error in SONiC: mistaking the sync-path database for the hardware.
What your CCNP already gives you
- • You understand the idea of programming a FIB from a RIB, and that it is asynchronous.
- • You know adjacency must resolve before a route can actually forward.
What is new in SONiC
- • The RIB→FIB machinery is explicit, observable processes (orchagents, syncd) and a database (ASIC_DB).
- • You can watch objects appear/disappear and see exactly where propagation stalls.
- • Notifications and counters flow back as data you can query.
| In the analogy | In SONiC |
|---|---|
| The production coordinator who reads work orders and sequences the build | Orchagents (in swss) |
| Insisting the frame exists before bolting on the wheels | Dependency management |
| Standardized instructions handed to the operator | SAI calls |
| The machine operator standing at the line's control panel | syncd |
| The panel's wiring and the machine's motors | Vendor SAI + SDK |
| The coordinator's logbook of instructions issued and acknowledged | ASIC_DB |
| The machine's status lights and production tallies reported back | Notifications/counters |
Where the analogy stops working
The logbook is not the machine. ASIC_DB records the objects in the SONiC↔SAI synchronization path; it is not a live readout of transistors. If you want to know the machine truly did the motion, you rely on syncd's acknowledgements, notifications, counters, and (on real hardware) vendor diagnostics — not on the belief that the logbook *is* the silicon.
SWSS and the orchagents
SWSS (Switch State Service) is the container that hosts the orchestration logic. Inside it, the orchagent process runs a set of feature-specific orchestration agents (orchagents) — for example port, interface, neighbor, route, FDB, VLAN, and ACL orchagents (routeorch, neighorch, intfsorch, portsorch, fdborch, vlanorch, aclorch, and others).
Each orchagent subscribes to the relevant application state (largely APPL_DB, populated from CONFIG_DB by the *Mgr daemons and from FRR by fpmsyncd for routes). It converts that desired state into SAI object operations. Crucially, it does this in dependency order and retries when references are not yet available.
Dependency management
SAI objects reference each other, so order matters. A route entry cannot be created before its next hop; a next hop needs its router interface; the router interface needs its port; a next hop's forwarding needs a resolved neighbor (MAC). Orchagents encode these dependencies: they hold pending work until references exist, then program it, and they react to changes (a neighbor resolving, a port coming up) by completing previously blocked operations.
This is why a change can 'stall halfway': the top-level object (a route) is waiting on a dependency (an unresolved neighbor) that never arrives. The route exists as intent but is not fully programmed to forward.
syncd, the vendor SAI, and the SDK
syncd is the process/container that owns the SAI interface to the chip. Orchagents do not call the vendor library directly; they hand object operations to syncd (over the databases/messaging), and syncd invokes the vendor SAI implementation, which calls the vendor SDK, which performs the actual hardware programming. On a vendor image these lower layers are vendor-provided binaries; on SONiC-VS they are a *virtual* SAI that emulates behavior and does not reproduce a real ASIC.
syncd also manages the OID mapping: SONiC uses virtual object IDs (VIDs) in ASIC_DB, while the SAI implementation uses real IDs (RIDs). syncd maintains the VID↔RID translation (visible as the VIDTORID/RIDTOVID maps in ASIC_DB) so the abstract graph in the database corresponds to real handles in the implementation.
ASIC_DB is the database representation of objects in the synchronization path between SONiC and the SAI implementation. It records the SAI objects SONiC has asked syncd to program (as ASIC_STATE:SAI_OBJECT_TYPE_* entries) plus the VID↔RID maps. It is the agreed picture between orchagents and syncd — not the transistors, not a live register dump, and not proof the packet forwards. Treat it as authoritative for *what was requested/acknowledged through SAI*, and confirm real forwarding with counters, traffic tests, and (on hardware) vendor diagnostics.
Illustrative: an ASIC_DB route object and its VID→RID map
# ASIC_DB is redis DB 1. Scan just the route entries:
redis-cli -n 1 SCAN 0 MATCH 'ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY*' COUNT 200
# 1) "ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY:{...\"dest\":\"10.20.0.0/24\"...}"
# Inspect that object's attributes (note it references a next hop by VID):
redis-cli -n 1 HGETALL 'ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY:{...10.20.0.0/24...}'
# SAI_ROUTE_ENTRY_ATTR_PACKET_ACTION -> SAI_PACKET_ACTION_FORWARD
# SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID -> oid:0x4000000000abc (a VID)
# Translate that virtual OID to the implementation's real OID:
redis-cli -n 1 HGET VIDTORID oid:0x4000000000abc
# -> oid:0x9a00000012 (the vendor SAI's real handle)Targeted SCAN, not KEYS *. Values are illustrative and abbreviated; real keys/attributes vary by version and ASIC.
Notifications and counters flowing back up
The path is not one-way. The SAI implementation raises notifications (port state up/down, FDB learn/age events, and others) that syncd surfaces so orchagents and STATE_DB reflect reality. Separately, a flex counter mechanism periodically polls SAI statistics (per port, queue, ACL entry, etc.) and writes them to COUNTERS_DB, which is what show interfaces counters and friends read.
So there are three distinct 'return' channels to keep straight: acknowledgements (did the SAI call succeed), notifications (asynchronous hardware events), and counters (periodic statistics). A forwarding problem shows up differently in each — a call can succeed, yet counters show drops, or a notification (port down) can invalidate an otherwise-programmed path.
Common misconceptions
Myth: ASIC_DB is the hardware.
Reality: ASIC_DB is the sync-path database mirroring SAI objects SONiC requested/acknowledged. It is essential and authoritative for the request path, but it is not the silicon and not a forwarding guarantee.
Myth: If swss is healthy, hardware is programmed.
Reality: Orchagents can be healthy and still blocked on an unresolved dependency (no neighbor), or syncd/SAI can reject a call. Health of the coordinator is not delivery to the machine.
Myth: The OIDs in ASIC_DB are the vendor's real object IDs.
Reality: ASIC_DB holds virtual IDs (VIDs). syncd maps them to real IDs (RIDs) via VIDTORID/RIDTOVID. The abstraction is deliberate.
- When config is right but forwarding is wrong, walk this path: APPL_DB present? object in ASIC_DB? next hop/neighbor resolved? counters moving? The stall point localizes the fault.
- A route object in ASIC_DB with an unresolved next hop/neighbor is 'programmed but inert' — check neighbor/adjacency, not the route.
- Restarting swss or syncd is high-impact: it reprograms the chip. Understand reconciliation before you do it on anything shared (see Lab 3.3).
Key takeaways
- ✓Orchagents (in swss) convert desired state into ordered SAI calls, managing object dependencies.
- ✓syncd bridges SAI calls to the vendor implementation and SDK, and maintains the VID↔RID mapping.
- ✓ASIC_DB is the sync-path database of SAI objects — not the hardware and not a forwarding guarantee.
- ✓Three return channels — acknowledgements, notifications, counters — report reality back up the stack.
- ✓'Config fine, forwarding broken' almost always localizes to a stall along this path.
Tested against: SONiC 202305 / 202311 lineage · Upstream; vendor syncd/SAI in vendor images · swss + syncd containers; VS uses a virtual SAI · last reviewed 2026-07. Exact commands and behavior can vary by SONiC release, image, hardware platform, and enterprise distribution.
Knowledge check
A colleague says 'if it's in ASIC_DB, it's in the hardware, so the packet must forward.'
ASIC_DB is best described as: