YANG Models and Model-Driven Management
Every explanation of streaming telemetry eventually points at a box labeled YANG and says "the data model lives here." Then it hurries on to the exciting streaming part. This guide stops and opens the box — because the model layer is quietly the most important one in the stack. Transports and protocols move bytes; the model is what makes the bytes mean something. It is the dictionary layer: the formal agreement about what a device's facts are called, what type they have, and how they fit together.
It is also the layer whose importance outlives any one protocol. Telemetry was merely the first place most admins meet YANG. The same models describe device configuration. "Model-driven management" — the phrase on every modern network OS datasheet — means running a device through its models rather than through hand-typed commands. Understanding why the industry went this direction is worth an hour of anyone's time, even an admin whose network will poll SNMP for years to come.
By the end of this guide you will know what a data model actually is and how to read one and the paths into it. You will know the honest state of standard-versus-vendor models and why configuration people care even more than monitoring people. And — importantly — you will know how much of this you personally need at your shop's stage. That is probably less than you fear.
In this guide
- What a data model actually is
- The family resemblance: YANG and MIBs
- The shape of a model: containers, lists, leaves
- Reading a YANG path
- Config and state, one tree
- Standard models vs. vendor models
- Beyond monitoring: why model-driven matters
- Exploring models in practice
- How much YANG do you actually need?
- The MIB-to-YANG phrasebook
What a data model actually is
Picture a blank form — the kind with labeled fields, where each field tells you what goes in it: Name (text), Date (DD/MM/YYYY), Amount (number, no negatives). The blank form is not information about anyone; it is a definition of what information can exist and what shape it must take. A data model is exactly that: a formal definition of a device's data. It defines every fact's name, its type, its units, where it sits in a tree of related facts, and the constraints on its values. The device's live data is the filled-in form; the model is the blank one.
YANG is the language these blank forms are written in for network devices. A YANG file (a module) is plain, structured text that both a human and a program can read. The machine-readable part is the load-bearing property. So let it sink in. Before ever connecting to a device, software can read a model and know that this platform exposes a fact called in-octets. It can know that this is an unsigned 64-bit counter, that its units are octets, and precisely where it lives in the tree. No screen-scraping, no guessing, no parsing prose documentation. Every capability described in the rest of this guide grows from that one property.
The family resemblance: YANG and MIBs
If you have worked with SNMP, this should feel familiar, because SNMP had the same idea decades earlier. MIB files are also formal, machine-readable catalogs of device facts, with names, types, and a tree structure. The OIDs and MIBs guide covers that world in depth. YANG is not a rejection of the MIB idea; it is the same idea rebuilt with the lessons learned. Most of your MIB intuition transfers directly: there is still a tree, still standard branches and vendor branches, still a dictionary file you load into tools.
What did the rebuild add? Three things worth naming. Richer types: YANG has proper enumerations with readable names, typed IP addresses and prefixes, string patterns, numeric ranges, and a units annotation. So the model itself says a value is in octets or celsius rather than leaving it to documentation. Explicit, name-based hierarchy: the tree is addressed by human-readable path segments rather than dotted numbers. That changes daily life more than it sounds like it should — more on that shortly. And the big one: configuration and state live in one tree. MIBs could in principle be written to, but in practice the SNMP world was overwhelmingly read-only, and "intended settings" were never really modeled at all. YANG models describe both what a device is doing and what it was told to do, side by side. That design decision has consequences we will meet twice below.
The shape of a model: containers, lists, leaves
Open any YANG module and, past the boilerplate, you find a tree built from three kinds of node. Here is a simplified excerpt in the spirit of the standard interfaces model — abbreviated, but honest about the shape:
container interfaces {
list interface {
key "name";
leaf name { type string; }
container state {
leaf oper-status {
type enumeration { enum UP; enum DOWN; enum LOWER_LAYER_DOWN; }
}
container counters {
leaf in-octets { type yang:counter64; units "octets"; }
leaf out-octets { type yang:counter64; units "octets"; }
leaf in-errors { type yang:counter64; }
}
}
}
}
The three node kinds, one plain sentence each. A container is a folder: it groups related facts and holds no value of its own — interfaces, state, and counters above are containers. A list is a table: it repeats once per real-world thing, and each entry is addressed by its key — here, one interface entry per port, keyed by the port's name. A leaf is one actual fact with a type and a value — oper-status and in-octets are leaves, and only leaves carry data.
Read the excerpt again with those three words and it becomes prose. "There is a folder of interfaces, containing a table of interface entries keyed by name. Each entry has a state folder holding its operational status, and a counters folder holding its traffic totals." Notice also the small print paying rent. The enumeration means oper-status can only ever be one of those named values. And units "octets" means no tool has to guess bytes versus bits. The blank form is strict on purpose.
Reading a YANG path
A model is a tree, so any single fact can be addressed by the path from the root down to it. And these paths are what you actually type into telemetry subscriptions and management tools. Anatomy of a realistic one:
/interfaces/interface[name=Ethernet1]/state/counters/in-octets | | | | | | folder table which row folder folder the fact
Left to right: enter the interfaces container and step into the interface list. Select one row with the bracketed key — the entry whose name is Ethernet1. Then descend through state and counters to the in-octets leaf. Leave the bracket out and the path means every row: subscribe to /interfaces/interface/state/counters and you get counters for all ports in one subscription. A path can also stop early — address a container and you mean everything beneath it.
Now the payoff, best seen by comparison. The same fact in SNMP is 1.3.6.1.2.1.2.2.1.10 plus an interface index. That is a numeric address you decode with a MIB and an index you had to go look up. On some platforms, the index is not even guaranteed to survive a reboot. The YANG path is self-describing: it names the port by its actual name. It reads aloud as a sentence. And a colleague reviewing your collector config can see what is monitored without a decoder ring. Addressing by name instead of number is a small mercy repeated ten thousand times — which is to say, a large mercy.
Config and state, one tree
Look back at the excerpt and you will see the interface entry holds a state container. In the full models it has a sibling: config. Same tree, two aspects of each object. The config container holds what the device was told (the intended settings you or an automation tool wrote). The state container holds what is true (what the device is actually doing right now, counters included).
Keeping intent and reality side by side, in identical shapes, sounds like tidy bookkeeping until you realize what it enables: the two can be compared mechanically. An interface whose config/enabled says true while state/oper-status says DOWN is a device disagreeing with its instructions. Think of a broken cable, a dead transceiver, an unhappy peer. A tool can find every such disagreement across the whole tree without understanding anything about your network in particular. The old world made you correlate intent (in a config backup somewhere) with reality (in a poller somewhere else) by hand, during an outage, at 2 AM. The model does the join for you.
Standard models vs. vendor models
Who writes the models? Two families, and the honest answer about living with them takes a paragraph each.
Standard and open models come from standards bodies and industry groups. The IETF publishes one family. A well-known operator-led consortium publishes the openconfig models you saw echoed in this guide's examples. They cover the common ground every device shares: interfaces and their counters, basic system facts, routing fundamentals. The promise is real and genuinely delivered on that ground. The interfaces path used above works, identically, on gear from different vendors, which is something the vendor-MIB world never quite gave you. Write your subscriptions against standard models wherever they suffice, and they travel with you across platforms.
Vendor-native models cover everything else — and everything else is a lot. Think of the platform's clever queueing, its stacking, its security features, the thousand knobs that made you buy that particular box. That depth lives in the vendor's own model tree, richer and stranger than any standard will ever be. So the working reality for a multi-vendor shop is juggling both families. Standard paths cover the common ground, native paths each platform's depths. A device's capabilities list (next section) always shows a mix. One more idea rounds out the picture: augmentation. YANG lets a vendor graft extra leaves onto someone else's model at defined points. So a standard interface entry can sprout a vendor's additional facts without forking the standard. Extensions live in the shared tree rather than beside it. That is politer than the old world where vendor MIBs were entirely separate islands.
Beyond monitoring: why model-driven matters
Here is where the box-labeled-YANG becomes bigger than telemetry. The same tree that describes state describes configuration — which means configuration changes can be expressed as data: "set this leaf, in this list entry, to this value." And because every leaf has a declared type, range, and constraints, a management protocol can validate a change against the model before applying it. A string where an address belongs or an MTU outside the legal range is rejected up front, atomically, before anything touches the running device. So is an enum value that does not exist or a reference to an interface the box does not have.
Contrast the traditional alternative, which every admin knows in their scar tissue: hand-typed CLI. The device cheerfully accepts a transposed digit in a subnet mask. An entire class of outages is typos discovered in production. Model-driven configuration deletes much of that class. Honesty requires the limit stated plainly: validation catches malformed, not misguided — the model will happily let you correctly, validly shut the wrong interface. Machines check the form; you still supply the judgment.
The second consequence is automation. Because models are machine-readable, tools can generate from them. They can generate configuration interfaces, validation code, documentation, and the plumbing that would otherwise be written by hand per platform and per release. This — more than dashboards — is why the industry invested so heavily in the model layer. It turns "integrate with this device" from an archaeology project into something a program derives from published files. For a small shop, the honest framing is that you will most likely meet all of this through tools. Network automation software reads models under the hood and hands you a sane interface. You will most likely use that rather than work with raw YANG files yourself. Knowing the layer exists, and what it guarantees, is what keeps those tools from being magic boxes. The protocols that carry the reads and writes are decoded in the gNMI, gRPC, and YANG guide.
Exploring models in practice
How do you find out what models — and therefore what facts — a given device offers? Three layers of exploration, in the order that saves the most time:
- Ask the device. Modern management protocols have a capabilities verb: the device answers with the list of models it implements, versions included. This list is ground truth — the streaming equivalent of walking a device to see what it will really admit to.
- Browse the published files. Public repositories collect the model files published by standards bodies and vendors, and vendors ship theirs with documentation. You rarely read these raw; instead…
- Use a model browser. Model browsers are the ecosystem's cousins of the classic MIB browser. Point one at a set of model files and it renders the tree for clicking and searching. Find a leaf by name, see its type, units, and description, copy its full path straight into a subscription.
Tip: trust the device's capabilities list over the public repository. Implementations lag published models, support subsets of them, and pin particular versions. The repository tells you what a model can contain. The box tells you what this box contains. When they disagree, the box wins; the final word is always a test read of the subtree against the real device.
How much YANG do you actually need?
A dictionary layer invites over-studying, so here is an honest syllabus by shop, with permission to stop at your row.
If you run an SNMP-only shop: concepts, nothing more. Know what a model is, what a path looks like, and that config and state share one tree. That is enough to read a datasheet without being bluffed, follow a vendor roadmap, and ask sharp questions when a rep says "model-driven." Zero tooling required; this article was the whole assignment.
If you are piloting telemetry: path literacy. Read and write paths confidently, use bracketed keys and their wildcard omission, run a capabilities check, and locate a leaf in a model browser. This is an afternoon's practice, most of it inside the first telemetry lab, where paths stop being theory the moment one starts printing counters.
If you are heading toward automation: model reading. Open an actual module file and follow it. Read the containers, lists and keys, leaf types, and how an augmentation grafts onto a standard tree. When an automation tool misbehaves, the model is where the answer is written. Note the ceiling, though: even here the skill is reading. Writing YANG is a job for vendors and toolmakers; an admin career can be complete and happy without ever authoring a module.
The MIB-to-YANG phrasebook
Everything in this guide, compressed into the mapping your SNMP experience has been silently building. Keep it; it converts years of MIB intuition into the new vocabulary at a glance:
| SNMP world | Model-driven world | What changed |
|---|---|---|
| MIB file (module) | YANG module | Same dictionary idea, richer language |
OID: 1.3.6.1.2.1.2.2.1.10 | /interfaces/interface/state/counters/in-octets | Numbers became names; paths read as sentences |
| Table + numeric index | List + named key: [name=Ethernet1] | Rows addressed by real-world name |
| SMI types: Counter64, Gauge32 | YANG types: counter64, gauges, enums, plus units | Same ideas, stricter and self-documenting |
Standard MIB-2 vs. vendor MIBs under enterprises | Standard/open models vs. vendor-native models | Same split; augmentation lets them interleave |
| Walking a subtree to explore | Capabilities, then a get on a subtree | Same ritual, ask-the-box ground truth |
| Polling a counter | Sampled subscription to its path | Push replaces repeated pull |
| Trap on a state change | On-change subscription | Eventing with reliable delivery |
| Mostly read-only in practice | Config and state in one validated tree | The genuinely new part |
And the one-sentence takeaway, if you keep nothing else: a model is the dictionary that lets machines talk about devices precisely — and telemetry was merely its first payoff. The same dictionary is steadily becoming how devices are configured, validated, and automated, which is why it outranks any single protocol built on top of it. For the rest of the stack and the decisions around it, the Streaming Telemetry pillar has the map. It covers the explainer, the acronym decoder, the honest SNMP comparison, the readiness audit, and the lab.
Put this into practice with SysPeep Monitor
Whichever dictionary your gear speaks, someone still has to watch it today. SysPeep Monitor minds the classic side of the house. It auto-discovers your devices and collects health and performance over SNMP, WMI, and SSH. It raises quiet, meaningful alerts from a single web console. Let it keep watch while you build your model literacy — the free trial installs on one Windows machine in minutes.
Download Free TrialLearn About SysPeep