Use Juniper Networks YANG Modules
Learn how to obtain Juniper Networks YANG modules and how to import a module into another module.
Juniper Networks publishes YANG modules that define the configuration hierarchies, RPCs, state data, and YANG extensions for Junos devices. This topic details how to download the YANG modules or generate them on a device as well as how to import a module into another module.
Obtain Juniper Networks YANG Data Models
You can retrieve the Juniper Networks YANG data models by:
-
Downloading the modules from the Juniper Networks website at https://www.juniper.net/support/downloads
-
Downloading the modules from the Juniper/yang GitHub repository
-
Generating the modules on a Junos device either through a local or remote session
Junos OS YANG modules are specific to a device family. For a given OS and release, the YANG modules download file and GitHub repository include a separate directory for each device family as well as a common directory. Each family-specific directory contains the modules that are supported on the platforms in that family. The common directory contains the modules that are common to all device families. For more information about the device families, see Understanding Junos YANG Modules.
When you generate YANG modules on a local device, the modules include both native Junos modules as well as any standard or custom modules that have been added to the device. The native YANG modules generated on a local device, by default, contain family-specific schemas. The family-specific schemas are identical across all devices in the given device family.
Starting in Junos OS Release 23.4R1 and Junos OS Evolved Release 23.4R1, we provide all YANG data models for a given OS and release in a single download package and GitHub repository folder. The package and repository include:
-
Native configuration, state, and RPC data models
-
OpenConfig configuration and state models supported by that OS
-
IETF models supported by that OS
Download YANG Modules from Juniper Networks
To download the YANG modules from the Juniper Networks site:
- Access the downloads page at https://support.juniper.net/support/downloads.
- Select your product.
- In the drop-down menus, select the appropriate OS and version.
- Expand the Tools section to display the available downloads.
- In the Downloads column, click the link for the YANG modules package you want to download.
- Review and accept the End User License Agreement.
- Follow the instructions on the download page to download the file.
If your particular product page does not have the YANG modules available for download, you can download the modules from the Juniper/yang GitHub repository or generate the modules on the Junos device.
Generate YANG Modules on Junos Devices
To generate the YANG modules from the Junos OS or Junos OS Evolved CLI:
The device generates the YANG modules in the specified output directory.
Generate YANG Modules from a Remote Session
To generate the YANG modules from a remote session:
The device generates the YANG modules in the specified output directory.
You can also use the <get-schema> Network Configuration
Protocol (NETCONF) operation to retrieve a YANG module from the device. For
additional information, see Retrieve Schemas.
Importing Juniper Networks YANG Modules
You can use YANG-based tools to leverage the Juniper Networks YANG modules. If you are developing custom YANG modules, you can reference definitions in the Juniper Networks YANG modules by importing the modules into your custom module.
To import a Juniper Networks YANG module into an existing module:
Platform-Specific YANG Module Behavior
Use Feature Explorer to confirm platform and release support for specific features.
Use the following table to review platform-specific behaviors for your platform:
|
Platform |
Difference |
|---|---|
|
QFX Series |
|
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.
show system
schema command and get-yang-schema RPC must include the
output-directory option to specify the directory in which to
generate the output files. In earlier releases, you can omit the
output-directory option when requesting a single module to
display the module in standard output.