mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
528 stars 342 forks source link

pyang

Release Build Status

Overview

pyang is a YANG validator, transformator and code generator, written in python. It can be used to validate YANG modules for correctness, to transform YANG modules into other formats, and to write plugins to generate code from the modules.

YANG (RFC 7950) is a data modeling language for NETCONF (RFC 6241), developed by the IETF NETMOD WG.

Documentation

See Documentation.

Installation

Pyang can be installed from PyPI:

# pip install pyang

It is reccomended to use a Python virtual environment

  git clone https://github.com/mbj4668/pyang.git
  cd pyang
  pip install -e .

To install in a different location, run:

  python setup.py install --prefix=/usr/local

If you do this, it is recommended to set the environment variable YANG_INSTALL to the prefix directory. This ensures that pyang will find standard YANG modules. In addition, make sure that PYTHONPATH is set to something as follows:

export PYTHONPATH=/usr/local/lib/python3.10/site-packages

or whatever version of python you are running.

Run locally without installing

export PATH=`pwd`/bin:$PATH
export MANPATH=`pwd`/man:$MANPATH
export PYTHONPATH=`pwd`:$PYTHONPATH
export YANG_MODPATH=`pwd`/modules:$YANG_MODPATH
export PYANG_XSLT_DIR=`pwd`/xslt
export PYANG_RNG_LIBDIR=`pwd`/schema

or:

source ./env.sh

Compatibility

pyang is compatible with the following IETF RFCs:

Features

Usage

pyang -h

or

man pyang

Code structure