Metadata-Version: 2.1
Name: yang-scan
Version: 1.0.1
Summary: Pyang plugin scanning YANG modules
Home-page: https://gitlab.com/nso-developer/yang-scan
Author: UNKNOWN
Author-email: UNKNOWN
License: Apache-2.0
Keywords: YANG
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Telecommunications Industry
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Networking :: Monitoring
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: pyang

YANG scanner
============

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.


.. _pyang: https://github.com/mbj4668/pyang/
.. _drned-xmnr: https://github.com/NSO-developer/drned-xmnr



