Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Data Types · YANG

Direct answer

YANG data types define allowed values for leafs, such as string, uint32, boolean, enumeration, ip-address and typedefs with ranges and patterns, so devices can validate input.

When to use this

Use this when YANG types constrain values.

First 30 seconds

1. YANG types: integers, string, boolean, enumeration, identityref, union, inet types.

2. Constraints: range, length, pattern.

3. Identityrefs need module prefixes.

4. Validate before sending.

5. Typedefs for reuse.

Operational verification

value → YANG type check → accepted/rejected

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 YANG types constrain 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 built-in scalar types, typedef, union, enumeration/bits, leafref/identityref and range/length/pattern restrictions.

Step 2 Common mistakes Narrow the fault
  • Ignoring range/pattern restrictions, causing rejects.
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
  • Types include string, uint32, enumeration and ip-address.
  • Ranges and patterns restrict values.
  • Devices reject invalid values.
Key checks
  • Type definitions (typedef, enumeration, union, identityref) — types
  • Patterns and ranges — constraints
  • Identityref prefixes in JSON — module:identity
ReferenceWhy it matters1 section · depth on demand

What it is

YANG types include built-ins (string, int, boolean, enumeration, union) and typedefs such as inet:ipv4-address, with ranges and patterns that devices validate.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

YANG data types define what values a leaf may hold, and devices validate every change against them. Knowing the type of a field explains most rejected payloads.

TypeExample
Integers (uint8…int64)VLAN ID, MTU
string with length/patternNames, descriptions
booleanenabled
enumerationup, down, testing
identityrefiana-if-type:ethernetCsmacd
unionIPv4 or IPv6 address
leafrefMust match an existing value elsewhere (e.g. an interface name)
decimal64, binary, emptyNumbers with fractions, binary data, presence flags

In JSON encoding, 64-bit integers and decimal64 are sent as strings; identityrefs carry a module prefix. Common types are defined in ietf-inet-types and ietf-yang-types.

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 > Data Types. 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 built-in scalar types, typedef, union, enumeration/bits, leafref/identityref and range/length/pattern restrictions, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?