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.

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.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yang_scan-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for yang_scan-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 191bf8edab310da450e09abda2dbed82f3b86a23dce1bdc860c47c5eb9322c34
MD5 d2cc965ffdebe43cf9c1271aaa16df86
BLAKE2b-256 73f7db7c29471d98b299e697718d96f6d8079e21025347a9551bdab4f8db109a

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