Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Containers

Direct answer

A YANG container groups related nodes under one name, such as an interfaces container holding all interface entries, without holding a value itself.

When to use this

Use this when YANG groups related nodes.

First 30 seconds

1. Containers group related nodes (no value themselves).

2. Presence containers mean something by existing.

3. Map to JSON objects / XML elements.

4. Nested hierarchy.

5. Follow model paths.

Operational verification

container → child nodes

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 groups related nodes.
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.

3 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 primary procedure is: Inspect the module/revision and container schema, read the exact subtree from a supporting server, apply one valid and one constraint-violating fixture, and compare protocol errors/read-back. Exercise failure-oriented cases such as wrong module revision, confusing presence container with organizational node, creating empty containers with unintended meaning, ignoring must/when constraints and ambiguous namespace prefixes so the test covers failure cases, not only the happy path.

Step 2 Common mistakes Narrow the fault
  • Confusing containers with lists.
Step 3 Where it fails Narrow the fault

Tests should include edge cases such as wrong module revision, confusing presence container with organizational node, creating empty containers with unintended meaning, ignoring must/when constraints and ambiguous namespace prefixes. Recovery should capture schema/module revision and protocol error-path/error-tag, fix the schema path/value or client encoding, then reread the exact subtree from the target datastore.

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
  • Containers group related child nodes.
  • They hold no value themselves.
  • Presence containers mean something by existing.
Key checks
  • pyang -f tree <module>.yang | grep '+--rw' — containers
  • Presence containers — meaning
  • JSON/XML representation — payload
ReferenceWhy it matters1 section · depth on demand

In depth

A YANG container is a node that groups related child nodes without a value of its own, like a folder. A presence container additionally means something just by existing (e.g. enabling a feature).

container ntp {
  presence "NTP enabled";
  leaf-list server { type inet:host; }
}
Container typeMeaning
Non-presencePure grouping; exists if it has children
PresenceIts existence carries meaning

In RESTCONF URLs and JSON payloads, containers appear as nested objects ("ntp": {"server": [...]}).

ReferenceImportant terms & boundaries1 section · depth on demand

Mechanics

Containers in YANG is owned at runtime by the YANG schema defining an interior container node and the server implementation instantiating that schema in configuration/operational datastores. The durable intent is module/revision with container definition, child nodes, presence semantics, constraints and namespace. Reliable automation must carry stable identity across the path: module name/revision/namespace plus schema path and list keys beneath the container where applicable. The consumer-visible target is the modeled data-tree subtree, not an arbitrary JSON/XML object that happens to have the same label. The key invariants are presence versus non-presence container semantics are respected, child constraints/types are validated, namespace/revision is explicit and clients do not infer instance existence from schema existence.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Lifecycle

Store and review module/revision with container definition, child nodes, presence semantics, constraints and namespace; pin or at least record implementation/model versions and keep environment-specific identity outside reusable logic where possible. The stable identity contract is module name/revision/namespace plus schema path and list keys beneath the container where applicable.

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 RFC 7950

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

Basis: https://www.rfc-editor.org/info/rfc7950/ · confidence 94%
Embedded reference data

Quick lookup tables

YANG → Containers · operational reference

Context-specific ownership, verification, output and failure-boundary lookup for YANG → Containers.

LayerYANG → Containers operational reference
Runtime/ownershipYANG 1.1 data modeling · the YANG schema defining an interior container node and the server implementation instantiating that schema in configuration/operational datastores
Persistent intentmodule/revision with container definition, child nodes, presence semantics, constraints and namespace
VerificationInspect the module/revision and container schema, read the exact subtree from a supporting server, apply one valid and one constraint-violating fixture, and compare protocol errors/read-back.
Expected interpretationThe client addresses the correct module/schema path, presence semantics and child constraints behave as modeled, invalid data is rejected explicitly, and valid data reads back under the expected container.
Recovery boundarycapture schema/module revision and protocol error-path/error-tag, fix the schema path/value or client encoding, then reread the exact subtree from the target datastore
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

At minimum retain server/device, module/revision/namespace, schema path, presence semantics, child node values, RPC/request ID, error-tag/path for invalid data and datastore read-back. The useful output makes ambiguity visible, links to the target identity from module name/revision/namespace plus schema path and list keys beneath the container where applicable, and provides enough context to safely decide whether a retry is permitted.

Confirmation

Confirm action

Continue?