Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Leafs

Direct answer

A YANG leaf holds a single value of a defined type, such as an interface's mtu or description, and is the endpoint of the data tree.

When to use this

Use this when working with single YANG values.

First 30 seconds

1. Leafs hold single values with types.

2. Defaults and mandatory constraints.

3. Units and ranges.

4. Validate values.

5. JSON uses typed values (numbers, strings).

Operational verification

leaf → typed value

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 working with single YANG 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 scalar leaf identity, config/mandatory/default semantics, type/constraint validation and differentiating absent values from defaults.

Step 2 Common mistakes Narrow the fault
  • Sending numbers as strings or wrong enum values.
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 holds one typed value.
  • It may be mandatory or have a default.
  • It is the end of a branch.
Key checks
  • pyang -f tree <module>.yang | grep -E 'leaf|--rw' — leafs
  • Leaf types and defaults — values
  • mandatory leafs — required
ReferenceWhy it matters1 section · depth on demand

What it is

A leaf is a single value with a type (string, uint32, boolean, enumeration).

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

A leaf is a single value in a YANG model — an interface description, an MTU, an enabled flag. It has a type, and optionally a default, a range, a pattern, mandatory true or config false (state data).

leaf mtu {
  type uint16 { range "68..9216"; }
  default 1500;
  description "Interface MTU in bytes";
}

In JSON a leaf is a key/value pair ("mtu": 9000); in XML an element (<mtu>9000</mtu>). The type constraints are enforced by the device, so invalid values are rejected with an error naming the leaf — reading the model's tree view tells you the allowed values before trying.

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 > Leafs. 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 scalar leaf identity, config/mandatory/default semantics, type/constraint validation and differentiating absent values from defaults, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?