Understanding the YANG Modules for Junos OS Operational Commands

 

Juniper Networks publishes YANG modules that define the remote procedure calls (RPCs) for Junos OS operational mode commands. Due to the large number of operational commands on devices running Junos OS, there are multiple operational command modules for each device family. There is a module for each top-level operational command group (clear, file, monitor, and so on) where there is at least one command within that hierarchy with an RPC equivalent. There is also a separate module for each area within the show command hierarchy.

Note

Starting in Junos OS Release 17.2, Junos OS YANG modules are specific to a device family and use a new convention for the module namespace. In addition, each of the individual operational command modules uses the command hierarchy area of the RPCs included in that module as its namespace prefix. Prior to Junos OS Release 17.2, the prefix for all operational command modules was jrpc.

Note

Starting in Junos OS Release 17.4R1, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace. For more information, see Understanding Junos OS YANG Modules.

The operational command modules define the RPCs corresponding to the operational commands in the command hierarchy area indicated in the filename. The following example shows a portion of the module containing the RPCs for commands in the clear command hierarchy:

user@host> file show /var/tmp/yang/junos-rpc-clear@2017-01-01.yang

You can download the Junos OS YANG modules from the Juniper Networks download site, or you can generate them on the local device. To generate the operational command YANG modules on the local device issue the show system schema format yang module module command. The Junos OS release determines the available command options.

  • In Junos OS Release 17.3 and earlier, specify the juniper-command module to generate all of the operational command modules.

    user@host> show system schema format yang module juniper-command
    Note

    Starting in Junos OS Release 17.1, when you generate the juniper-command module, the output files are placed in the current working directory, which defaults to the user’s home directory. In Junos OS Release 16.2 and earlier, the output files are placed in the /var/tmp directory.

  • In Junos OS Release 17.4R1 and later, specify an individual module name to display a single operational command module, or specify all-rpc to display all operational command modules. By default, a single module is displayed in standard output. When you request multiple modules, you must include the output-directory command option and specify the directory in which to generate the files.

    user@host> show system schema format yang module all-rpc output-directory /var/tmp/yang
Note

To generate the modules from a remote session, execute the <get-yang-schema> Junos OS RPC or the <get-schema> NETCONF operation with the appropriate options.

If you specify module juniper-command or module all-rpc, the output files include both native Junos OS operational command modules as well as any standard or custom operational command modules that have been added to the device. To use an RPC in your custom YANG module, you must import the module that contains the desired RPC into your custom module.

Note

Starting in Junos OS Release 17.4R1, the native YANG modules generated on a local device contain family-specific schemas, which are identical across all devices in the given device family. In earlier releases, the generated modules contain device-specific schemas. To generate device-specific modules in Junos OS Release 17.4R1 and later, configure the device-specific configuration statement at the [edit system services netconf yang-modules] hierarchy level.

Release History Table
Release
Description
Starting in Junos OS Release 17.4R1, Junos OS YANG modules use a new naming convention for the module’s name, filename, and namespace.
Starting in Junos OS Release 17.2, Junos OS YANG modules are specific to a device family and use a new convention for the module namespace. In addition, each of the individual operational command modules uses the command hierarchy area of the RPCs included in that module as its namespace prefix.
Starting in Junos OS Release 17.1, when you generate the juniper-command module, the output files are placed in the current working directory, which defaults to the user’s home directory