Generating YANG Annotation Modules

When writing YANG modules for use with ConfD, it is necessary to use Tail-f YANG extension statements to provide for items such as backend instrumentation and CLI rendering guidance. Examples of some of the more common Tail-f YANG extension statements are “callpoint”, “actionpoint”, “validate”, “cli-drop-node-name”, etc. Because it is the easier path, oftentimes YANG module authors will use these extension statements directly inline in the YANG module.

However, while this eases development, eventually these YANG modules will need to be published so that customers can make use of your NETCONF or RESTCONF interface. It is not desirable to expose the Tail-f YANG extension statements in published modules as that would unnecessarily expose inner details of your network device as well as potentially cause problems for whatever NETCONF client, controller, or orchestrator is being used if they do not properly ignore extension statements they are not aware of.

The answer to this problem lies in using YANG annotation modules. Annotation modules are used to annotate another YANG module with those annotations being applied during the confdc compilation step. This allows the primary YANG module which will be published to be free of Tail-f extension statements. In order for your network device to be managed via NETCONF or RESTCONF, your customer only needs to receive the primary YANG module. The YANG annotation modules do not need to be published.

Recognizing both how common it is for users to use Tail-f YANG extension statements inline as well as how tedious it is to manually extract the annotation statements into an annotation module, we have written a new application note “How to Generate YANG Annotation Modules ” which shows how to quickly and easily automate the extraction of annotation statements. The techniques and tools shown can be leveraged for other custom processing of YANG modules.

Download the application note today!