Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding the Management of Nonnative YANG Modules on Devices Running Junos OS

YANG is a standards-based, extensible data modeling language that is used to model the configuration and operational state data, remote procedure calls (RPCs), and server event notifications of network devices. You can load standard or custom YANG models onto Junos devices to add data models that are not natively supported by Junos OS. Adding YANG models enables you to create device-agnostic and vendor-neutral operational and configuration models for managing devices from multiple vendors.

When you add custom YANG data models to Junos devices, you must supply a script that handles the translation logic between the YANG data model and Junos OS on that device. There are two types of scripts:

  • Action scripts are Stylesheet Language Alternative SyntaX (SLAX) or Python scripts that act as handlers for your custom YANG RPCs. The YANG RPC definition uses a Junos OS YANG extension to reference the appropriate action script, which is invoked when you execute the RPC.

  • Translation scripts are SLAX or Python scripts that map your custom configuration syntax (defined by your YANG model) to Junos OS syntax and then load the translated data into the configuration as a transient change during the commit operation. When you load and commit configuration data in the nonnative hierarchies, Junos OS invokes the script to perform the translation and emit the transient change.

To use custom YANG data models on Junos devices, you must add the YANG modules and associated scripts to the device by issuing the request system yang add command. Junos OS validates the syntax of the modules and scripts, rebuilds its schema to include the new data models, and then validates the active configuration against this schema. The device validates the modules and scripts as you add them. However, we recommend that you use the request system yang validate command first to validate the syntax before adding the modules.

Note:

In multichassis systems, you must download and add the modules and scripts to each node in the system.

Note:

To install OpenConfig modules that are packaged as a compressed tar file, use the request system software add command.

When you add YANG modules and scripts to Junos devices, you must associate them with a package. Packages have a unique identifier and represent a collection of related modules, translation scripts, and action scripts. You reference the package identifier if you later update modules and scripts in that package, enable or disable translation scripts associated with the package, or delete that group of modules and scripts from the device.

When you add, update, or remove YANG modules and scripts on the device by issuing the appropriate operational commands, you do not need to reboot the device in order for the changes to take effect. Newly added RPCs and configuration hierarchies are immediately available for use, and installed translation scripts are enabled by default. You can disable translation scripts in a package at any time without removing the package and associated files from the device, which can be useful for troubleshooting translation issues. When you disable translation for a package, you can still configure and commit the statements and hierarchies added by the YANG modules in that package. However, the device does not translate and commit the corresponding Junos OS configuration as a transient configuration change during the commit operation.

Before installing software on a device that has one or more custom YANG data models added to it, you must remove all configuration data corresponding to the custom YANG data models from the active configuration. After the software installation is complete, add the YANG packages and corresponding configuration data back to the device, if appropriate. For more information see Managing YANG Packages and Configurations During a Software Upgrade or Downgrade.