Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Understanding the YANG Module for Junos OS Extensions

 

The Junos OS DDL extensions YANG module contains YANG extensions for devices running Junos OS. These extensions include statements that can define constraints on configuration data and the valid values for strings. There are also statements that you include in custom RPCs to define a CLI command for the RPC and to specify details about the action script to invoke when the RPC is executed. In addition, there are statements that you can use to define helper action scripts for individual command options and configuration statements, for example, to display a list of acceptable values for options or statements.

Note

Starting in Junos OS Release 17.4, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace. The module’s name and filename include the device family and Junos OS release, and the filename also includes a revision date.

Table 1 outlines the statements in the DDL extensions module and provides a brief description of each statement.

Table 1: Statements in the junos-extension Module

Statement Keyword

Argument Description

action-execute

Define the actions taken when you execute a custom RPC. Use the script substatement to define the RPC’s action script, which is invoked when you execute the RPC.

Starting in Junos OS Release 17.3, the action-execute statement is a substatement to command.

action-expand

Define the script that calculates and displays the possible values for a given command option or configuration statement in a custom YANG data model when a user requests context-sensitive help in the CLI.

Use the script substatement to define the Python script that implements the logic.

command

String defining the operational command that is used to execute the corresponding RPC in the Junos OS CLI.

Starting in Junos OS Release 17.3, the command statement includes the substatement action-execute, which defines the actions taken when you execute the RPC.

must

String that identifies a constraint on the configuration data.

Whereas the argument for the YANG must statement is a string containing an XPath expression, the argument for the junos:must extension statement is a string containing special Junos OS syntax required for the expression of the configuration statement path. This might include special keywords such as any, all, and unique.

must-message

String that defines the warning message that is emitted when the constraint defined by the corresponding junos:must statement evaluates to false.

pattern-message

String that defines the error message emitted when the constraint defined by the corresponding posix-pattern statement evaluates to false.

posix-pattern

Restrict the values accepted for nodes of type string to those that match the POSIX regular expression defined in this string.

script

String specifying the name of an action script. This is a substatement of the action-execute or action-expand statement.

Release History Table
Release
Description
Starting in Junos OS Release 17.4, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace.