Use this when YANG lists hold keyed entries.
Lists
A YANG list holds multiple entries identified by a key, such as interfaces keyed by name, each entry with the same set of child nodes.
1. Lists are collections keyed by one or more leafs.
2. Key required in each entry.
3. RESTCONF addresses entries with =key.
4. ordered-by user lists keep order.
5. Replace vs merge affects entries.
list[key] → entries
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 Common mistakes Narrow the fault
- Omitting the key when creating entries.
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.
- Lists hold entries identified by keys.
- All entries share the same children.
- Keys appear in RESTCONF URIs.
pyang -f tree <module>.yang | grep '\['— lists with keys- List key in RESTCONF URL (=key) — addressing
- ordered-by user — ordering
ReferenceWhy it matters1 section · depth on demand
What it is
A YANG list is a set of entries identified by key leaves (e.g. interface name).
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
Each list entry is identified by its key leaf (or leaves). Clients address one entry with the key in the path, and devices reject entries with duplicate keys. Unkeyed lists exist only in operational (config false) data.
Example
list interface {
key "name";
leaf name { type string; }
leaf enabled { type boolean; default true; }
}
In RESTCONF the key appears in the URL: /interface=GigabitEthernet1.
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 > Lists. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc7950 · confidence 94%