Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding the YANG Modules That Define the Junos OS Configuration

Juniper Networks publishes the Junos OS configuration schema using YANG models. In Junos OS Release 17.3 and earlier, the Junos OS configuration schema is published in a single YANG module. Starting in Junos OS Release 17.4R1, the Junos OS configuration schema is published using a root configuration module that is augmented by multiple, smaller modules. This enables consumers of the schema to only import the modules required for their tasks.

Note:

Starting in Junos OS Release 17.4R1, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace. For more information, see Understanding Junos YANG Modules.

The root configuration module comprises the top level configuration node and any nodes that are not emitted as separate modules. Separate, smaller modules augment the root configuration module for the different configuration statement hierarchies. The configuration modules that augment the root module contain the schema for the configuration statement hierarchy level that is indicated in the module’s name, filename, and namespace.

The following example shows a portion of the module containing the YANG model for the [edit interfaces] hierarchy:

YANG utilities need to import only those modules required for the specific configuration task at hand. As a result, tools that consume the configuration modules require less time to compile, validate, or perform other functions on the modules than when importing a single, large module.

To determine the configuration YANG module corresponding to a specific area of the configuration, issue the show | display detail configuration mode command. In the following example, the schema for the [edit protocols ospf] hierarchy level is included in the junos-conf-protocols@2017-01-01.yang module.

You can download the Junos native YANG modules from the Juniper Networks download site or the Juniper/yang GitHub repository, or you can generate the modules on the local device. To generate the configuration modules on the local device, issue the show system schema format yang module module command. The Junos OS release determines the available command options.

  • In Junos OS Release 17.3 and earlier, specify the configuration module.

  • In Junos OS Release 17.4 and later, specify an individual module name to return a single configuration module, or specify all-conf to return all configuration modules.

If you specify module configuration or module all-conf, the output files include both native Junos OS configuration modules as well as any standard or custom configuration modules that have been added to the device.

Starting in Junos OS Release 19.1R2 and 19.2R1, the show system schema command must include the output-directory command option and specify the directory in which to generate the file or files. In earlier releases, you can omit the output-directory option when requesting a single module to display the module in standard output.

Note:

To generate the modules from a remote session, execute the <get-yang-schema> Junos OS RPC or the <get-schema> Network Configuration Protocol (NETCONF) operation with the appropriate options.

Note:

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

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
23.4R1-EVO
Starting in Junos OS Evolved Release 23.4R1, native YANG modules for QFX Series devices use the junos device family identifier instead of junos-qfx.
22.4R1 and 22.4R1-EVO
Starting in Junos OS Release 22.4R1 and Junos OS Evolved Release 22.4R1, if a YANG leaf node is type identityref, Junos devices emit the namespace-qualified form of the identity in the JSON encoding of that node. Additionally, Junos devices accept the simple (no namespace) and the namespace-qualified form of an identity in JSON configuration data. In earlier releases, Junos devices only emit and accept the simple form of an identity.
19.2R1
Starting in Junos OS Release 19.1R2 and 19.2R1, the show system schema command must include the output-directory command option and specify the directory in which to generate the file or files.
17.4R1
Starting in Junos OS Release 17.4R1, the Junos OS configuration schema is published using a root configuration module that is augmented by multiple, smaller modules.
17.4R1
Starting in Junos OS Release 17.4R1, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace.