Inferensys

Glossary

YANG

YANG is a data modeling language used to define configuration and state data, operations, and notifications for network devices, serving as the foundation for model-driven programmability.
MLOps engineer reviewing model serving infrastructure on laptop, container orchestration visible, technical workspace.
DATA MODELING LANGUAGE

What is YANG?

YANG is a data modeling language used to define the configuration and state data, operations, and notifications for network devices, serving as the foundation for model-driven programmability.

YANG (Yet Another Next Generation) is a data modeling language standardized in RFC 6020/7950 that defines the structure, semantics, and syntax of data exchanged between network management protocols. It models the hierarchical configuration, operational state, remote procedure calls (RPCs), and event notifications of a network device in a machine-readable, protocol-independent format.

As the cornerstone of model-driven programmability, YANG modules serve as the single source of truth for a device's API contract. Tools like pyang and yanglint validate these modules, while protocols such as NETCONF and RESTCONF use them to instantiate the MAPE-K loop for closed-loop automation, enabling true declarative configuration and drift remediation.

DATA MODELING LANGUAGE

Key Features of YANG

YANG is the foundational data modeling language for modern network programmability, defining the structure, constraints, and semantics of configuration and operational data.

01

Model-Driven Programmability

YANG enables model-driven programmability by providing a precise, machine-readable contract between network clients and servers. Unlike unstructured CLI scraping, YANG models define the exact syntax and semantics of every configurable element.

  • Structured Data: Models define a strict tree hierarchy of containers, lists, and leaf nodes.
  • Type Safety: Each leaf is bound to a specific data type (e.g., inet:ipv4-address, uint16), preventing invalid configurations.
  • Single Source of Truth: The YANG model serves as the definitive API specification, from which NETCONF, RESTCONF, and gRPC interfaces are derived.
RFC 7950
Core Specification
02

Configuration and Operational State

YANG cleanly separates configuration data from operational state data using the config true/false statement. This distinction is fundamental to declarative intent-based networking.

  • Config (config true): The writable, intended state of the device, such as interface IP addresses or BGP peer settings.
  • State (config false): Read-only data reflecting the device's actual running status, including interface counters, temperature sensors, and protocol adjacency tables.
  • Unified Tree: Both config and state are exposed in a single, coherent data tree, allowing operators to compare intended versus actual state for drift detection.
config true/false
Data Separation
03

Reusable Types and Groupings

YANG promotes modularity through typedefs and groupings, preventing duplication and ensuring consistency across large, multi-vendor data models.

  • Typedef: Defines a custom data type derived from a base type with added constraints. For example, a vlan-id typedef restricts a uint16 to the range 1–4094.
  • Grouping: A reusable block of schema nodes that can be referenced via the uses statement. Common structures like an IP prefix or a QoS policy can be defined once and instantiated in multiple places.
  • Augmentation: External modules can extend existing models without modifying the original, enabling vendor-specific extensions to standard models like ietf-interfaces.
typedef & grouping
Reusability Mechanisms
04

RPCs and Notifications

Beyond static data, YANG models define executable Remote Procedure Calls (RPCs) and asynchronous notifications for event-driven network management.

  • RPC: Defines a parameterized operation that a server exposes. For example, an activate-license RPC takes a license key as input and returns a success or error status.
  • Action: An operation bound to a specific data node instance, such as reset-counters on a particular interface.
  • Notification: Defines an event that the server can push to subscribed clients, such as a link-down alert with the interface name and timestamp.
  • YANG 1.1 introduced the action statement, clarifying the distinction between global operations and instance-specific operations.
RPC, action, notification
Operational Primitives
05

Constraints and Validation

YANG provides a rich constraint language that enforces data integrity at the model level, catching configuration errors before they are committed to a device.

  • must Statement: An XPath expression that must evaluate to true for the data to be valid. For example, a must constraint can enforce that an MTU value does not exceed the parent interface's maximum.
  • when Statement: Makes a node conditional on an XPath expression, dynamically hiding or disabling irrelevant configuration branches.
  • unique Statement: Enforces uniqueness across one or more descendant leafs within a list, such as ensuring no two VLANs share the same ID.
  • range and length: Restrict numeric and string values directly on type definitions.
XPath
Constraint Language
06

Versioning and Module Management

YANG supports robust module lifecycle management through semantic versioning, import dependencies, and submodules, enabling multi-vendor interoperability.

  • revision Statement: Tracks the version history of a module with a date stamp and description of changes.
  • import and include: import references definitions from an external module, while include pulls in a submodule that shares the same namespace.
  • Backward Compatibility: YANG 1.1 introduced the non-backwards-compatible extension to signal breaking changes, allowing clients to gracefully handle model updates.
  • YANG Catalog: A public registry maintained by the IETF and industry bodies that indexes standardized and vendor-specific YANG modules for discovery.
RFC 8525
YANG Library
YANG DATA MODELING

Frequently Asked Questions

Clear, technical answers to the most common questions about YANG, the data modeling language that underpins modern model-driven network programmability and automation.

YANG is a data modeling language specifically designed to define the configuration and operational state data, administrative actions, and asynchronous notifications for network devices. It works by creating a structured, machine-readable contract between a network element and a management system. A YANG model describes the hierarchical organization of data, constraints, and data types using modules and submodules. This model is then used by protocols like NETCONF and RESTCONF to instantiate, manipulate, and stream data from devices. Unlike a Management Information Base (MIB), which is a flat list of objects, YANG models the complex, nested relationships of modern network functions, enabling true model-driven programmability where the API is generated directly from the model.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.