← Interview Prep

Source of Truth & NetBox

What a Source of Truth is and why the device isn't it: modeling with NetBox (site→device→interface→IP), data validation (pydantic/JSON Schema), config drift & the device-vs-SoT conflict, and the SoT→intended→diff→deploy closed loop.

Automation is only as good as the data it renders from. A Source of Truth (SoT) is the authoritative, machine-readable definition of the network's intended state — devices, interfaces, IPs, VLANs, cabling, circuits. Config is generated from the SoT; the device is not the truth. Getting this right is what separates "we have scripts" from "we have automation."

The mental flip: stop treating the running-config as reality. The SoT is the intent; the device's config is a rendering of it. Anything on the box that the SoT didn't put there is drift — to be reverted or reconciled, never silently accepted.

What counts as "truth"

NetBox as the SoT (DCIM + IPAM)

NetBox is the de-facto network SoT: a data model + REST/GraphQL API + webhooks. It models the network as a hierarchy you traverse to render config:

LayerModels
WhereRegion → Site → Location → Rack
WhatDevice (role, type, platform) → Interface → IP address
L2/L3VLAN, VLAN group, VRF, Prefix, IP range, aggregate
ConnectivityCables / connections, circuits & providers
Org & extensionTenancy, tags, custom fields, config contexts (structured data attached to devices)

Generators pull this via the API (a device's interfaces, their IPs/VLANs, its neighbors) and render config — exactly how Annet and Ansible/Nornir use NetBox as inventory + intent. Alternatives: Nautobot (adds jobs + Golden Config), Infrahub, or Git-as-SoT (versioned YAML) for smaller setups.

Modeling: site → device → interface → IP

Model the real relationships, not flat lists, so the data is queryable and consistent:

Site "LHR1"
 └─ Device "lhr1-leaf01"  (role=leaf, platform=cisco_ios)
     ├─ Interface "Gi0/1"  →  IP 10.1.0.1/31   (VRF: default)
     │                        cable → lhr1-spine01 Gi0/1
     └─ Interface "Vlan10" →  IP 10.1.10.1/24  (VLAN 10 "users")
Prefix 10.1.0.0/16  (container, site=LHR1)  → child prefixes per role

Now "give me every interface + IP on lhr1-leaf01" is one API query, and IP/VLAN uniqueness is enforced by the model — no more overlapping subnets in a spreadsheet.

Data validation — trust the truth

A SoT that's wrong is worse than none (you automate the mistake at scale). Validate inputs:

Drift & the device-vs-SoT conflict

The pattern: SoT → intended → diff → deploy

The closed loop every mature stack runs:

  1. SoT — declare intent (NetBox / YAML in Git).
  2. Intended — render target config from it (generators/templates).
  3. Diff — fetch running-config, compare to intended (idempotent: no diff = no change).
  4. Deploy — push only the delta, with pre/post-checks and rollback.

Run it continuously and drift can't survive: every cycle re-asserts the truth.

Likely interview questions

Related: Testing & CI/CD · Annet · Frameworks Compared.