Quiz Entry - updated: 2026.10.15
What do the YANG building blocks module, namespace, container, list, leaf and type mean?
- module: names the model.
- namespace: its unique URL identifier.
- container: groups related data.
- list: allows several entries of the same kind.
- leaf: a single data field.
- type: the field's data type.
* The same model as a tree: containers group, the list repeats per interface, and the leaves hold typed values. *
module router-interface {
namespace "http://example.com/router-interface";
prefix ri;
container interfaces {
list interface {
key "name";
leaf name { type string; }
leaf enabled { type boolean; default "true"; }
container ipv4 {
leaf address { type string; }
leaf netmask { type string; }
}
}
}
}
- module
router-interface: the name of the model. - namespace: a unique URL identifying the model, so its elements can't clash with another model's.
- container
interfaces,ipv4: groups related configuration data. - list
interface: allows many entries (many interfaces). The keynametells them apart. - leaf
name,enabled,address: a single data field. - type
string,boolean: the data type of a leaf. A default applies when nothing is set.
Read top-down, the model gives the path interfaces/interface[name]/ipv4/address, which is exactly how NETCONF and RESTCONF address the data.
Go deeper:
RFC 7950 — The YANG 1.1 Data Modeling Language — the language specification with every statement defined.