Manage YANG Packages, Modules, and Scripts on Junos Devices
SUMMARY Load custom YANG packages on Junos devices to add your own remote procedure calls (RPCs) and data models to the device.
You can load custom YANG modules on Junos devices to add RPCs and data models that are not natively supported by the OS but can be supported by translation. When you load nonnative YANG data models onto the device, you must also load any translation scripts, action scripts, and deviation modules required by those data models.
Starting in Junos OS Release 17.3R1, when you load custom YANG data models onto the device, you do not need to explicitly load any required Junos OS extension modules. In earlier releases, you must load the Junos OS extension modules for any packages that use the modules.
Junos devices use packages to identify a collection of related YANG modules, translation scripts, and action scripts. Each package has a unique identifier. When you add YANG modules and scripts to the device, you must associate them with a new or existing package. This topic discusses how to create, update, and delete YANG packages and add or update their associated modules and scripts.
To prevent CLI-related or configuration database errors, we recommend that you do not perform any CLI operations, change the configuration, or terminate the operation while a device is in the process of adding, updating, or deleting a YANG package and modifying the schema.
Creating a YANG Package and Adding Modules and Scripts
To validate YANG modules and scripts and add them to a new package:
When you create a new package, the device stores copies of the module and script files in a new location. The device also stores copies of the action script and translation script files under the /var/db/scripts/action and /var/db/scripts/translation directories, respectively. After the modules and scripts are validated and added to the device, Junos OS rebuilds its schema to include the new data models and then validates the active configuration against this schema. Newly added RPCs and configuration hierarchies are immediately available for use.
Devices that use the ephemeral configuration database will delete all ephemeral configuration data in the process of rebuilding the schema.
Junos OS does not support using configure private
mode to configure statements corresponding to third-party YANG data
models, for example, OpenConfig or custom YANG data models.
Updating a YANG Package with New or Modified Modules and Scripts
You create a new YANG package by executing the request
system yang add
command. To update an existing package to either
add new modules and scripts to the package or update existing modules
and scripts in the package, you must use the request system yang
update
command.
To update a YANG package with new or modified modules and scripts:
When you update a package, the device stores copies of the new and modified module and script files. Junos OS then rebuilds its schema to include any changes to the data models associated with that package and validates the active configuration against this schema.
Devices that use the ephemeral configuration database will delete all ephemeral configuration data in the process of rebuilding the schema.
Deleting a YANG Package
Before you delete a YANG package from a Junos device, ensure that the active configuration does not contain configuration data that has dependencies on the data models added by that package.
To delete a YANG package and all modules and scripts associated with that package from a Junos device:
When you delete a package, Junos OS rebuilds its schema to remove the data models associated with that package and then validates the active configuration against this schema. The device removes the copies of the module and script files that were generated when the package was created. The device also removes the copies of the package’s action script and translation script files that are stored under the /var/db/scripts/action and /var/db/scripts/translation directories. If you downloaded the original module and script files to a different location, the original files remain unchanged.
Devices that use the ephemeral configuration database will delete all ephemeral configuration data in the process of rebuilding the schema.
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.
run
command is not
supported.