Skip to main content

Pyang plugin scanning YANG modules

Project description

Overview

This simple pyang plugin scans YANG modules for constructs that are likely to cause interoperability issues, especially when integrating with Cisco NSO. The constructs that it looks for are:

  • tailf:display-when used in a configuration node that refers operational nodes. Pyang checks this kind of reference for when or must statements, but not for this extension statement. Operational nodes are not part of the accessible data tree when checking references from configuration node, so such tailf:display-when statement would cause the parent node to be always hidden.

    Note that this check works only if you use a recent version of pyang, it is not supported with the version distributed with Cisco NSO.

    tag: XPATH_REF_CONFIG_FALSE

  • Duplicate prefixes. Two distinct YANG modules having the same prefix is not a YANG standard violation, but orchestration or configuration management systems may not be able to work with such modules.

    tag: SCAN_DUPLICATE_PREFIXES

  • tailf:hidden with any argument other than full. tailf:hidden full hides the node from all interfaces, other arguments cause the node to be hidden from interactive interfaces like CLI. This may cause interoperability issues, since some tools (like drned-xmnr) use them.

    tag: SCAN_HIDDEN

The plugin generates a warning for each occurrence of such construct. If needed, warnings can be turned off via --ignore-error, see below.

Installation and running

This is a pyang plugin, so pyang must be available (e.g. via pip install pyang). With that, no installation is required, only clone the repository and use it like

$ pyang --plugindir /path/to/repo/yang_scan -f yang-scan /modules/*.yang

If convenient, you may install the plugin to your python environment though:

$ python setup.py install

and the argument --plugindir is not necessary then.

Installing the plugin from PyPI coming soon.

The plugin is always run through pyang, for running it please refer to its documentation or to pyang --help. Warnings generated by the plugin can be turned off using pyang’s option --ignore-error <tag>, where tag is one of XPATH_REF_CONFIG_FALSE, SCAN_DUPLICATE_PREFIXES, or SCAN_HIDDEN. Note that ignoring XPATH_REF_CONFIG_FALSE turns off warnings for when and must statements too.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

yang_scan-1.0.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file yang_scan-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: yang_scan-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for yang_scan-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 695dfde4c5a66d84752ec3edbfe6baa84b0cc5f42673e586143224e9aedea87a
MD5 34c560b81529c2c6039aea6a3dbc4b96
BLAKE2b-256 eee18e75259c6068103598db3b35d74ce2be8a6b76e3e4400a57349db50fa9bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page