Understanding Junos OS YANG Modules

 

Juniper Networks publishes the schema for devices running Junos OS using YANG models for the configuration hierarchies, operational commands, and Junos OS extensions. The following sections discuss the native Junos OS YANG modules:

Junos OS YANG Modules Overview

Juniper Networks provides YANG modules that define the configuration hierarchies and operational commands, as well as YANG extensions and types, for devices running Junos OS. Starting in Junos OS Release 17.2, Junos OS YANG modules are specific to a device family. Table 1 outlines the identifiers for the different Junos OS device families and indicates which platforms are included in each family.

Table 1: Junos OS Device Families

Device Family Identifier

Supported Platforms

junos

ACX Series, EX Series (certain platforms), MX Series, PTX Series

junos-es

J Series, LN Series, SRX Series

junos-ex

EX Series (certain platforms)

junos-qfx

QFX Series

Note

Different platforms within the same series might be categorized under different device families. You can verify the family for a specific device by executing the show system information operational mode command or the <get-system-information/> RPC on the device. The value of the Family field in the command output or the <os-name> element in the RPC reply indicates the device family.

Starting in Junos OS Release 17.4R1, the configuration YANG module is split into a root module that is augmented by multiple smaller modules, and the native Junos OS YANG modules use a new naming convention for the module's name, filename, and namespace. The module name and filename include the device family and the area of the configuration or command hierarchy to which the schema in the module belongs. In addition, the module filename includes a revision date. Table 2 summarizes the YANG modules that are native to devices running Junos OS and identifies the Junos OS releases in which the different module names are used.

Table 2: Juniper Networks Native YANG Modules

Junos OS Module

Description

Module Name

Junos OS Releases

Configuration modules

Defines the schema for the Junos OS configuration hierarchy.

Starting in Junos OS Release 17.4R1, the configuration YANG module is split into a root module that is augmented by multiple smaller modules.

configuration

14.2 through 17.3

family-conf-hierarchy

17.4R1 and later

Operational command modules

Represents the operational command hierarchy and the collective group of modules that define the remote procedure calls (RPCs) for Junos OS operational mode commands. There are separate modules for the different areas of the command hierarchy.

juniper-command

16.1 through 17.3

family-rpc-hierarchy

17.4R1 and later

DDL extensions module

Contains Junos OS Data Definition Language (DDL) statements for devices running Junos OS.

This module includes the must and must-message keywords, which identify configuration hierarchy constraints that use special keywords. The module also includes statements that are required in custom RPCs.

junos-extension

15.1 through 17.3

junos-common-ddl-extensions

17.4R1 and later

ODL extensions module

Contains Junos OS Output Definition Language (ODL) statements that can be used to create and customize formatted ASCII output for RPCs executed on devices running Junos OS.

junos-extension-odl

16.1 through 17.3

junos-common-odl-extensions

17.4R1 and later

Types module

Contains definitions for Junos OS YANG types

junos-common-types

17.4R1 and later

To support YANG modules for different device families in different releases, the downloaded modules are organized by device family, and each module’s name, filename, and namespace reflects the device family to which the schema in the module belongs. For information about obtaining the modules, see Downloading and Generating Junos OS YANG modules . For information about the module namespaces, seeUnderstanding Junos OS YANG Module Namespaces and Prefixes.

Downloading and Generating Junos OS YANG modules

You can download the Junos OS YANG modules from the Juniper Networks website at https://www.juniper.net/support/downloads or from the Juniper Networks GitHub repository for YANG at https://github.com/Juniper/yang. You can also generate the modules on a device running Junos OS.

In Junos OS Release 17.1 and earlier, the YANG modules for the Junos OS configuration and command hierarchies that are posted on the Juniper Networks website and in GitHub define the schema for all devices running that Junos OS release. By contrast, the YANG modules generated on the local device define the schema specific to that device, including nodes both from native modules and from any standard or custom modules that have been added to the device.

Starting in Junos OS Release 17.2, Junos OS YANG modules are specific to a device family and each module’s namespace reflects the device family to which the schema in the module belongs. As a result, the tar archive that is posted on the Juniper Networks website and that contains the YANG modules for a given release includes a separate directory for each device family’s modules and a common directory for the modules that are common to all device families. Each family-specific directory uses its device family identifier as the directory name and contains the configuration and operational command modules that are supported on the platforms in that family. The device family identifiers are defined in Table 1. The YANG modules generated on a local device running Junos OS Release 17.2 still define the schema specific to that device.

Starting in Junos OS Release 17.4R1, the YANG modules generated on a local device, by default, contain family-specific schemas, which are identical across all devices in the given device family. To generate device-specific modules, configure the device-specific configuration statement at the [edit system services netconf yang-modules] hierarchy level.

Table 3 summarizes the scope of the schema in the downloaded and generated YANG modules for different Junos OS releases.

Table 3: Scope of Junos OS YANG Schema

Junos OS Release

Scope of Schema in Downloaded Modules

Scope of Schema in Generated Modules

17.1 and earlier

All devices

Device

17.2 through 17.3

Device family

Device

17.4R1 and later

Device family

Device family

For more information about how to download or generate the Junos OS YANG modules, see Using Juniper Networks YANG Modules.

Understanding Junos OS YANG Module Namespaces and Prefixes

In Junos OS Release 17.1 and earlier, Junos OS YANG modules use a unique identifier to differentiate the namespace for each module.

Starting in Junos OS Release 17.2R1, the Junos OS YANG modules are specific to a device family. To support distinct YANG modules for different device families in a given Junos OS release, the YANG modules use a namespace that includes the module name, the device family, and the Junos OS release string, in addition to the identifier. For example:

Starting in Junos OS Release 17.4R1, the namespace is simplified to include the device family, the module type, and an identifier that is unique to each module and that differentiates the namespace of the module from that of other modules.

The following definitions apply to all versions of the namespace in which that variable appears:

device-familyIdentifier for the device family to which the schema in the module belongs, for example, junos, junos-es, junos-ex, or junos-qfx. The different device families are outlined in Table 1.

Modules with device-specific schemas and modules with family-specific schemas both use the same device family identifier in the namespace.

Note

The Junos OS common modules use the junos device family identifier in the namespace, but the modules are common to all device families.

identifierString that differentiates the namespace of the module from that of other modules.

Junos OS configuration and command modules include an identifier that indicates the area of the configuration or command hierarchy to which the schema in the module belongs. Common modules use the module name differentiator as an identifier, for example odl-extensions.

module-idUnique identifier specific to the module, for example, jc, jrpc, je, or jodl.
module-nameName of the YANG module included in that file, for example, configuration or junos-extension. Each of the individual juniper-command modules uses its own unique module name in the namespace, for example, show-class-of-service.
releaseJunos OS release in which the schema in that module is supported.
typeType of the module. Possible values include:
  • conf—Configuration YANG module that defines the schema for the indicated area of the configuration.

  • rpc—Operational command YANG module that defines the RPCs for operational commands in the indicated area of the command hierarchy.

  • common—Extension or type module that is common across all device families.

Table 4 outlines each module’s namespace URI and prefix (as defined by the module’s prefix statement) in the different Junos OS releases. Starting in Junos OS Release 17.2, the prefix for each operational command module reflects the command hierarchy area of the RPCs included in that module. Similarly, starting in Junos OS Release 17.4R1, the prefix for each configuration YANG module reflects the configuration statement hierarchy that is included in that module. The Junos OS YANG extension and type modules use the junos device family identifier in the namespace, but the modules are common to all device families.

Table 4: Namespaces and Prefixes for Junos OS YANG Modules

Junos OS Module

Junos OS Release

Namespace URI

Prefix

Configuration modules

17.1 and earlier

http://yang.juniper.net/yang/1.1/jc

jc

17.2 through 17.3

http://yang.juniper.net/yang/1.1/jc/configuration/device-family/release

jc

17.4R1 and later

http://yang.juniper.net/device-family/conf/hierarchy

jc (root module)

jc-hierarchy

Operational command modules

17.1 and earlier

http://yang.juniper.net/yang/1.1/jrpc

jrpc

17.2 through 17.3

http://yang.juniper.net/yang/1.1/jrpc/module-name/device-family/release

hierarchy

17.4R1 and later

http://yang.juniper.net/device-family/rpc/hierarchy

hierarchy

DDL extensions module

17.1 and earlier

http://yang.juniper.net/yang/1.1/je/

junos

17.2 and later

http://yang.juniper.net/yang/1.1/je/junos-extension/junos/release

junos

17.4R1 and later

http://yang.juniper.net/junos/common/ddl-extensions

junos

ODL extensions module

17.1 and earlier

http://yang.juniper.net/yang/1.1/jodl

junos-odl

17.2 through 17.3

http://yang.juniper.net/yang/1.1/jodl/junos-extension-odl/junos/release

junos-odl

17.4R1 and later

http://yang.juniper.net/junos/common/odl-extensions

junos-odl

Types module

17.4R1 and later

http://yang.juniper.net/junos/common/types

jt

Starting with Junos OS Release 17.2, when you configure the rfc-compliant statement at the [edit system services netconf] hierarchy level and request configuration data in a NETCONF session, the server sets the default namespace for the <configuration> element to the same namespace as in the corresponding YANG model. For example:

Release History Table
Release
Description
Starting in Junos OS Release 17.4R1, the configuration YANG module is split into a root module that is augmented by multiple smaller modules, and the native Junos OS YANG modules use a new naming convention for the module's name, filename, and namespace.
Starting in Junos OS Release 17.4R1, the YANG modules generated on a local device, by default, contain family-specific schemas, which are identical across all devices in the given device family.
Starting in Junos OS Release 17.2, Junos OS YANG modules are specific to a device family and each module’s namespace reflects the device family to which the schema in the module belongs.
Starting in Junos OS Release 17.2, the prefix for each operational command module reflects the command hierarchy area of the RPCs included in that module.