Pcornel
Networking · Automation and Artificial Intelligence

YANG Models

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

Back to the Topic

Answer

YANG is the modelling language that describes network configuration and state data as a tree of containers, lists, leaves and types with constraints. NETCONF, RESTCONF and gNMI all use YANG models.

Remember

Models are native (Cisco-IOS-XE-*), IETF (ietf-interfaces) or OpenConfig. A list is indexed by its key leaf (e.g. interface name). config false nodes are read-only state. Use pyang or the YANG Suite to browse a model: pyang -f tree <model>.yang.

First checks

  • pyang -f tree <model>.yang — the model as a readable tree.
  • Cisco YANG Suite — browse models from the device and build requests.
  • NETCONF capabilities / RESTCONF /restconf/data/ietf-yang-library:modules-state — models and revisions the device supports.
  • GitHub YangModels/yang — published models per release.

Commands

show ip route

Verify in this order

model chosen → path through containers and lists → keys and types respected → device supports the model → request accepted → data reads back

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

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

Confirmation

Confirm action

Continue?