Understanding the YANG Modules That Define the Junos OS Configuration
Overview of the Configuration YANG Modules
Juniper Networks publishes the Junos OS configuration schema using YANG models. 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 import only the modules required for their tasks.
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. These modules contain the schema for the configuration statement hierarchy level that is indicated by the module’s name, filename, and namespace.
The following example shows a portion of the YANG module that defines the schema for the
[edit interfaces] statement hierarchy:
/*
* Copyright (c) 2025 Juniper Networks, Inc.
* All rights reserved.
*/
module junos-conf-interfaces {
namespace "http://yang.juniper.net/junos/conf/interfaces";
prefix jc-interfaces;
import junos-common-types {
prefix jt;
revision-date 2024-01-01;
}
import junos-conf-root {
prefix jc;
revision-date 2024-01-01;
}
organization "Juniper Networks, Inc.";
contact "yang-support@juniper.net";
description "Junos interfaces configuration module";
revision 2024-01-01 {
description "Junos: 24.4R1.11";
}
augment /jc:configuration {
uses interfaces-group;
}
augment /jc:configuration/jc:groups {
uses interfaces-group;
}
...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@2024-01-01.yang
module.
user@host# show protocols ospf | display detail
##
## ospf: OSPF configuration
## YANG module: junos-conf-protocols@2024-01-01.yang
## package: junos-routing-ospf-advanced junos-routing-ospf-basic
##
##
## Area ID
## package: junos-routing-ospf-basic
##
area 0.0.0.0 {
...How to Obtain the Configuration YANG Modules
You can download the Junos native YANG modules from the Juniper Networks download site or the Juniper/yang GitHub repository. You can also 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. Specify an
individual module name to return a single configuration module, or specify
all-conf to return all configuration modules.
user@host> show system schema format yang module all-conf output-directory /var/tmp/yang
If you specify 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.2R1, the show system schema command must
include the output-directory command option and specify the directory in
which to generate the files. In earlier releases, you can omit the
output-directory option when requesting a single module to display the
module in standard output.
The native YANG modules generated on a local device 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.
To generate YANG modules from a remote session, execute the
<get-yang-schema> Junos OS RPC or the
<get-schema> NETCONF operation with the appropriate options.
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.
junos device family identifier instead of
junos-qfx.show system
schema command must include the output-directory command
option and specify the directory in which to generate the file or files.