Pcornel
Automation · Network Automation

Network State Collection

Cheat sheet · https://pcornel.dk/topic.php?topic=5601

Back to the Topic

Answer

Network state collection gathers operational facts — interfaces, neighbours, routes, sessions, counters — from devices on a schedule or around a change, turns the output into structured data, and stores it with a timestamp.

Remember

Structured data beats screen text: use APIs, NETCONF or a parser rather than matching lines. Collect the same things the same way each time, or comparisons mislead. Timestamps must come from synchronised clocks.

First checks

  • ansible <dev> -m cisco.ios.ios_facts -a 'gather_subset=all' — facts
  • pyats learn ospf --testbed-file tb.yaml --output out/ — learn state
  • Streaming telemetry (gNMI) — continuous state

Verify in this order

devices → state collection → structured snapshots

Where it usually breaks

Collected network state proves observations from specific sources at specific times; it does not alone prove topology-wide causation or current end-to-end reachability.

Configuration/input → graph/state refresh → plan → provider API request → provider terminal result → resource read-back → effective service state → workload.

Network State Collection Network Automation proof-boundary map

BoundaryHealthy evidenceSuspicious evidence
Intent / scopeSource revision and exact targets are explicitStale inventory, hidden selector or wrong variables change scope
Management operationTransport/model/payload and per-device response are traceableAuth/capability/parser differences hide partial or wrong execution
Device stateEffective and persistent state are read backAccepted config/API result is mistaken for convergence
Network proofOriginal control/data-plane or service test passesAutomation summary substitutes for actual network acceptance

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5601

Confirmation

Confirm action

Continue?