Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Leaf Lists

Direct answer

A YANG leaf-list holds several values of the same type, such as a list of DNS servers or permitted VLANs, without keys.

When to use this

Use this when a YANG node holds several values.

First 30 seconds

1. Leaf-lists are arrays of simple values (e.g. DNS servers).

2. Order may or may not matter.

3. Represented as JSON arrays.

4. Replace vs merge behaviour.

5. Validate entries.

Operational verification

leaf-list → array of values

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
YANG 1.1 data modeling
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.

PlatformYANG 1.1 data modeling · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when a YANG node holds several values.
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.

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

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

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 ordered-by semantics, uniqueness, element type constraints, min/max-elements and encoding repeated scalar values correctly.

Step 2 Common mistakes Narrow the fault
  • Replacing the whole leaf-list when adding one item.
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
Key points
  • A leaf-list holds several values of one type.
  • It has no keys.
  • ordered-by user keeps order.
Key checks
  • pyang -f tree <module>.yang | grep '\*' — leaf-lists
  • Leaf-list ordering — semantics
  • JSON array representation — payload
ReferenceWhy it matters1 section · depth on demand

What it is

A leaf-list is a list of simple values of one type (e.g. DNS servers).

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

A leaf-list is a list of simple values of the same type — DNS servers, allowed VLANs, NTP server addresses — without the key-based entries of a full list.

leaf-list dns-server {
  type inet:ip-address;
  ordered-by user;
}
{ "dns-server": ["10.0.0.53", "10.0.0.54"] }

Ordering matters: ordered-by system lets the device sort entries; ordered-by user keeps the order you give, which matters for things like resolver preference. A merge operation adds values to the existing leaf-list; replace the leaf-list when you want it to contain exactly your values.

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 docYANG 1.1 data modeling current

Authoritative/upstream documentation reviewed for bounded claims in YANG > Leaf Lists. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc7950 · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For ordered-by semantics, uniqueness, element type constraints, min/max-elements and encoding repeated scalar values correctly, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?