Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

YANG Models

Direct 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.

When to use this

Use it to find the exact path and data format for an API call, or when a device rejects a payload as invalid.

First 30 seconds

1. Which model covers the data (native, IETF, OpenConfig)?

2. pyang -f tree — the path from the top container to the leaf.

3. Device supports that model and revision?

4. Payload matches types and keys (e.g. interface name as list key)?

5. Read it back with GET / get-config.

Operational verification

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

Failure signaturePayload built from a YANG model is rejected

The device rejects data with an unknown element, wrong namespace or missing key.

Possible stored cause: The module, namespace or list key in the payload does not match the model the device implements.
Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes

The most important misconception is show ip route = forwarding works. A route can exist while recursive resolution, neighbor resolution or the outgoing adjacency remains unusable.

Local intent: Hierarchical containers, lists, leaves, types and constraints that describe network configuration/state data.

Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard
Scope / prerequisiteUse it to find the exact path and data format for an API call, or when a device rejects a payload as invalid.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

The device rejects data with an unknown element, wrong namespace or missing key.

Step 1 Verification & evidence Verify boundary

Trace a YANG path into JSON/XML representation and identify list keys/leaves.

Step 2 Common failure modes Narrow the fault

Wrong module/namespace/path, confusing schema with instance data or ignoring list keys/types.

Step 3 Troubleshooting workflow Narrow the fault

Focus for this topic: Wrong module/namespace/path, confusing schema with instance data or ignoring list keys/types.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

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.

Key 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.
ReferenceWhat it is1 section · depth on demand

Concept overview

Hierarchical containers, lists, leaves, types and constraints that describe network configuration/state data.

Key ideas: YANG defines schema: what data exists, its hierarchy/types/constraints and reusable structures. NETCONF/RESTCONF transport instances of modeled data.

ReferenceWhy it matters1 section · depth on demand

Why it matters

YANG defines schema: what data exists, its hierarchy/types/constraints and reusable structures. NETCONF/RESTCONF transport instances of modeled data.

ReferenceHow it works1 section · depth on demand

How it works

Routing protocols and static routes provide candidates to the RIB. The RIB selects the route used as routing intent; CEF/FIB then resolves recursive next hops and builds forwarding/adjacency information used by packets. Control-plane success can therefore coexist with data-plane failure.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

Reading and using YANG models

YANG describes what data a device accepts and reports. Being able to read a model is the key to writing NETCONF, RESTCONF or gNMI requests. RFC 7950 defines the building blocks:

  • Modules: each has a namespace, a prefix and revisions.
  • Containers: group child nodes; a container exists at most once.
  • Lists: have several instances, identified by key leafs.
  • Leafs and leaf-lists: hold a value, or a set of values.
  • Choice and case: alternatives, only one of which can be valid at a time.
  • Grouping, uses and augment: reuse groups of nodes and extend other models.
  • config false: marks state data, as opposed to configuration.
  • rpc, action and notification: operations and events.

Node types and their data form

YANGJSON representationExample
containerObject"interfaces": { ... }
list (key "name")Array of objects"interface": [ {"name": "Gi1/0/14", ...} ]
leafValue"enabled": true
leaf-listArray of values"vlans": [110, 120]
choice/caseOnly one branch appearsNever shown itself

Model families

FamilyScope
IETF (ietf-interfaces, ietf-ip)Vendor-neutral, limited feature coverage
OpenConfigOperator-driven, vendor-neutral, broader
Native (Cisco-IOS-XE-native)The full platform feature set
DeviationsWhat a platform doesn't implement as modelled

A tree view

dev$ pyang -f tree ietf-interfaces.yang | head -14
module: ietf-interfaces
  +--rw interfaces
  |  +--rw interface* [name]
  |     +--rw name                        string
  |     +--rw description?                string
  |     +--rw type                        identityref
  |     +--rw enabled?                    boolean
  |     +--ro oper-status                 enumeration
  |     +--ro statistics
  |        +--ro in-octets?               yang:counter64
dev$ curl -sk -u netadmin:'<password>' "https://10.255.1.21/restconf/data/ietf-yang-library:modules-state" | jq -r '.["ietf-yang-library:modules-state"].module[].name' | grep -c .

Reading the tree

SymbolMeaning
rw / roConfiguration / state (config false)
* after a nameList, with the key in brackets
?Optional leaf
No ? on an rw leafMandatory

Always check a platform's deviations before relying on a model. A leaf in the standard model may be marked "not supported" on the device.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 7950

Authoritative/upstream documentation reviewed for bounded claims in Automation and Artificial Intelligence → YANG Models. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc7950.html · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Depth when you need it

Deep reference

Design & tradeoffs

ENCOR design tradeoffs

Models enable consistent automation across tools, but vendor/platform augmentations still matter.

Confirmation

Confirm action

Continue?