YANG Library

There is a need for standard mechanisms to identify the YANG modules and submodules that are in use by each server that utilizes YANG-based data abstraction. If a large number of YANG modules are utilized by the server, then the YANG library information needed can be relatively large. This information changes very infrequently, so it is important that clients be able to cache the YANG library and easily identify if their cache is out-of-date.

The RFC 7895 YANG Module Library defines monitoring information about all the loaded YANG modules and submodules used by a server to represent management and protocol information. This is the first version, also called the 'non-NMDA' version.

The RFC 8525 YANG Module Library defines the NMDA version of the YANG library.


The NMDA version of the YANG library will only be used if the --with-nmda=``true`` setting is used.

The following information is used by the library (for each YANG module in the library) to fully utilize monitoring mechanism.

  • name: The mandatory YANG module name is unique within a YANG library. All modules and submodules share the same namespace, including modules used for deviations.

  • revision date: Each YANG module within the library has a revision date. This is derived from the most recent revision statement within the module or submodule.

  • submodule list: The name and revision date of each submodule used by main module.

  • feature list: The name of each YANG feature supported by the server.

  • deviation list: The name of each YANG module used for deviation statements.

  • conformance-type:

    • Extra leaf added if --with-yumaworks-system=true.

    • If 'implement', then the server is claiming conformance to the YANG module identified in this entry.

    • If 'import', then the server is not claiming any conformance for the YANG module identified by this entry. The module may be needed for reusable definitions, such as extensions, features, identifies, typedefs, or groupings.

  • schema: Contains a URL that represents the YANG schema resource for the module or submodule. This leaf will only be present if there is a URL available for retrieval of the schema for this entry.

  • namespace: The XML namespace identifier for this module.

The following information is used in order to identify if the YANG-Library cache is out-of-date and if the set of modules have changed.

  • module-set-id: Contains a server-specific identifier representing the current set of modules and submodules. The server will change the value of this leaf if the information represented by the 'module' list instances has changed.

Using the YANG Library

In order to retrieve the whole set of modules currently supported by the server the following command is used.

Example Request:

sget /modules-state
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <filter type="subtree">
      <modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang- library"/>

Example Reply:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="6" xmlns:ncx="http://netconfcentral.org/ns/yuma-ncx"
  <modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">

Example RESTCONF Request:

GET /restconf/data/modules-state/module=example-jukebox,2014-07-03/schema HTTP/1.1
Host: example.com
Accept: application/yang-data+json

The server might respond:

HTTP/1.1 200 OK
Date: Mon, 25 Apr 2012 11:10:30 GMT
Server: example-server
Content-Type: application/yang-data+json

  "ietf-yang-library:schema": "https://example.com/mymodules/example-jukebox/2015-06-04"

Using the Server in Library Mode

The server supports a special mode of operation with the --library-mode CLI parameter. In this mode, the server will only operate as a YANG Library Schema Server.


  • All vendor-added YANG instrumentation is ignored in Library Mode!

  • The --module, --bundle, and --loadpath CLI parameters are ignored in Library Mode.

  • The <load>, <load-bundle>, <unload> and <unload-bundle> RPC operations cannot be used in Library Mode.

  • The server will search for all valid YANG modules in the module search path.

  • All found modules will be added to the YANG Library

  • No found modules will be accessible or implemented in the server.

  • The server will scan the module search path and add all revisions of all modules it finds to the YANG library “module” list.

  • Only one copy of each revision will be loaded in case the same file existing in multiple places in the module search path.

Discover the Modules Available for Retrieval

  • The YANG library needs to be scanned by the client.

    • The non-NMDA module entry provides a schema leaf that can be used by RESTCONF to retrieve the YANG module.

    • The NMDA module entry provides a location leaf that can be used by RESTCONF to retrieve the YANG module.

  • The module list entry will contain the name and revision string for the found module. These values are used as parameters in the <get-schema> operation.

Only 6 RPC Operations are allowed in Library Mode

The Server is not Fully YANG Library Compliant in Library Mode

  • The /netconf-state/schemas/schema subtree will contain list entries for modules which are enabled in the server configuration. Not all of these modules will be usable in Library Mode.

  • The /modules-state/module subtree will contain list entries for all valid found modules in the module search path. These modules are not all implemented in the server. The conformance leaf will be set to import for all modules.

  • The /yang-library/module-set/module subtree will contain list entries for all valid found modules in the module search path. These modules are not all implemented in the server.

  • Only the <get-schema> operation will be available for the discovered modules.