YANG Fundamentals
1. YANG fundamentals: module defines namespace and data nodes.
2. Containers group nodes; lists have keys; leafs hold values.
3. config false = operational state.
4. Augment/deviation adapt models.
5. Revisions version modules.
module → schema tree → instance data
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Record module, namespace, revision and absolute/relative schema path with list keys; inspect the runtime/control-plane result; then query the schema contract and the instantiated configuration/operational data tree through an independent read path and compare it with the versioned intent. The negative fixture should deliberately exercise risks such as revision mismatch, namespace ambiguity, wrong list keys, typedef/union coercion, ignoring must/when constraints and confusing schema existence with instance existence, choosing the cases most relevant to module/revision/namespace, containers/lists/leafs, types, keys and must/when constraints as the contract between client and server. For YANG → YANG Fundamentals, the evidence must connect the control-plane result to the schema contract and the instantiated configuration/operational data tree and explain any gap between desired, controller-reported and consumer-visible state.
Step 2 Common mistakes Narrow the fault
- Learning YANG from tree output only without reading constraints.
Step 3 Where it fails Narrow the fault
Failure analysis for YANG → YANG Fundamentals should follow the path through the components: module source → schema load/compile → capability exposure → protocol encoding → server validation → instantiated data tree. Common failure classes include revision mismatch, namespace ambiguity, wrong list keys, typedef/union coercion, ignoring must/when constraints and confusing schema existence with instance existence. Before retrying a mutating operation, read current target state using the stable identity module, namespace, revision and absolute/relative schema path with list keys; if state is unknown, stop broad retries.
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.
pyang -f tree ietf-interfaces.yang— tree view- config true/false nodes — config vs state
- Namespaces and prefixes — identification
ReferenceWhy it matters1 section · depth on demand
In depth
YANG fundamentals: a module declares a namespace and prefix, imports types from other modules, and builds a tree of containers, lists and leaves. Each node has a type and may carry constraints (range, pattern, must, when).
module example-vlans {
namespace "urn:example:vlans";
prefix ev;
container vlans {
list vlan {
key "id";
leaf id { type uint16 { range "1..4094"; } }
leaf name { type string { length "1..32"; } }
}
}
}
The tree view (pyang -f tree) is the quickest way to see paths for NETCONF filters and RESTCONF URLs.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
YANG → YANG Fundamentals is owned at runtime by the YANG schema plus the server/tooling that validates and instantiates the modeled data tree. Its durable intent is versioned YANG module/revision with namespaces, node definitions, types and constraints; the stable identity contract is module, namespace, revision and absolute/relative schema path with list keys. The consumer-visible target is the schema contract and the instantiated configuration/operational data tree. The operating invariants are that module revision is known, node kinds and data types are respected, must/when/range/length constraints are preserved, and client encoding maps to the same schema identity. Follow the chain of components module source → schema load/compile → capability exposure → protocol encoding → server validation → instantiated data tree and record which layer currently owns truth. The linked authority for bounded mechanics is RFC 7950 — The YANG 1.1 Data Modeling Language; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in YANG > YANG Fundamentals. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc7950 · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture at minimum module, namespace, revision, schema path, node kind, type/typedef, constraints, keys, validation error path and instantiated values. For module/revision/namespace, containers/lists/leafs, types, keys and must/when constraints as the contract between client and server, prefer typed fields and stable IDs over human presentation text.