Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding the Junos DDL Extensions YANG Module

The Junos Data Definition Language (DDL) extensions YANG module contains YANG extensions for Junos devices. 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.

cli-feature

Identify certain CLI properties associated with some command options and configuration statements. See cli-feature Supported Properties.

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.

cli-feature Supported Properties

The cli-feature YANG extension identifies certain CLI properties associated with some command options and configuration statements. This extension is beneficial when a client consumes YANG data models, but for certain workflows, the client needs to generate CLI-based tools. Supported properties include:

  • homogenous—Text-formatted configuration data groups list objects into a single set of braces under the object keyword.

  • nokeyword—The CLI does not require explicitly specifying the leaf name in the input syntax.

  • oneliner/oneliner-plus—Text-formatted configuration data places an object's attributes on a single line. The oneliner flag does so without exception; the oneliner-plus flag does so only when zero or one value occurs for an attribute.

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.

Release
Description
22.3R1 and 22.3R1-EVO
Starting in Junos OS Release 23.1R1 and Junos OS Evolved Release 23.1R1, YANG modules that define the configuration or RPCs include the cli-feature extension statements, where applicable, in schemas emitted with extensions.
17.4R1
Starting in Junos OS Release 17.4, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace.