Skip to main content

ncs-yang

License: Apache 2.0 Version: 1.2.3.1 Downloads Downloads

ncs-yang is a simple tool to compile specific yang file/s using ncsc and to create uml diagrams from it.

Introduction

We haven't found a simple way to compile single yang file or to create uml diagrams from it. We usuall run make or make all to compile the yang files. For uml diagrams we have to copy all the yang files from ncs and the project to an directory and generate uml diagram using pyang -f uml command.

Being a developer we wanted to trigger/generate with simple commands or single line commands. Which leaded to create this library.

Pre-requisites

  • ncsc, pyang commands must be reconginsed by the terminal.
  • ncs-yang supports both trains of python 2.7+ and 3.1+, the OS should not matter.

Installation and Downloads

The best way to get ncs-yang is with setuptools or pip. If you already have setuptools, you can install as usual:

python -m pip install ncs-yang
pip install ncs-yang

Otherwise download it from PyPi, extract it and run the setup.py script

python setup.py install

If you're Interested in the source, you can always pull from the github repo:

  • From github git clone https://github.com/kirankotari/ncs-yang.git

Help

⋊> ~/k/i/ncs-yang on master $ ncs-yang --help

ncs-yang 
    <YangFile or YangFiles> [--uml | --jtox | --dsdl] 
    --schema <yang>         [--json | --xml | --yml]
    --yang-sync <settings.yml>          to collect yang files from remote machine
    --payload <payload.json> 
        <YangFile or YangFiles>         will return payload.xml
    --payload <payload.xml>
        <YangFile or YangFiles>         will return payload.json
    --payload <payload.yml>             will return payload.json
        <YangFile or YangFiles>         will return payload.xml
    --log [info | debug]
    --path <dependency yang path>
    -h | --help
    -v | --version

Features

Compiling specific yang files

  • running single yang file
⋊> ~/k/i/cfs-package on sprint $ ncs-yang src/yang/cfs-mpls.yang
[ INFO ] :: [ ncs-yang ] :: compiling yang file: src/yang/cfs-mpls.yang
 /opt/ncs/ncs-5.2.1.2/bin/ncsc `ls cfs-mpls-ann.yang > /dev/null 2>&1 && echo "-a cfs-mpls-ann.yang"` --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../common/src/yang --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../resource-manager/src/yang -c -o /opt/ncs/ncs-run/packages/cfs-package/load-dir/cfs-mpls.fxs src/yang/cfs-mpls.yang
  • running multiple yang files
⋊> ~/k/i/cfs-package/src/yang on sprint $ ncs-yang cfs-mpls.yang cfs-asa.yang
[ INFO ] :: [ ncs-yang ] :: compiling yang file: cfs-mpls.yang
 /opt/ncs/ncs-5.2.1.2/bin/ncsc `ls cfs-mpls-ann.yang > /dev/null 2>&1 && echo "-a cfs-mpls-ann.yang"` --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../common/src/yang --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../resource-manager/src/yang -c -o /opt/ncs/ncs-run/packages/cfs-package/load-dir/cfs-mpls.fxs cfs-mpls.yang
[ INFO ] :: [ ncs-yang ] :: compiling yang file: cfs-asa.yang
 /opt/ncs/ncs-5.2.1.2/bin/ncsc `ls cfs-asa-ann.yang > /dev/null 2>&1 && echo "-a cfs-asa-ann.yang"` --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../common/src/yang --yangpath /opt/ncs/ncs-run/packages/cfs-package/src/../../resource-manager/src/yang -c -o /opt/ncs/ncs-run/packages/cfs-package/load-dir/cfs-asa.fxs cfs-asa.yang

Creating uml diagrams from yang files

⋊> ~/k/i/c/s/yang on sprint $ ncs-yang cfs-mpls.yang --uml
[ INFO ] :: [ ncs-yang ] :: generated uml diagram: cfs-mpls.uml

FAQ

  • Question: I am seeing an error?
    Answer: Error might be related to yang file, we recommend to check again beforing opening a bug.

Change Log

New in 1.2.4

  • Feature Adding yang-sync
  • Feature Adding payload convertion
  • Feature Adding schema generator

New in 1.2.3

  • Fix: Import issues, logger corrections

New in 1.2

  • Feature: Adding UML Diagrams support
  • Feature: Adding Jtox support
  • Feature: Adding DSDL support

Bug Tracking and Support

  • Please report any suggestions, bug reports, or annoyances with ncs-yang through the Github bug tracker.

Author and Thanks

ncs-yang was developed by Kiran Kumar Kotari, For any suggestions or comments contact kkotari@cisco.com or kirankotari@live.com. If you find any bugs please fix them and send me a pull request.

Release files for ncs-yang 1.2.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ncs-yang 1.2.4.3
File Size Uploaded
ncs-yang-1.2.4.3.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ncs-yang 1.2.4.3
File Interpreter ABI Platform
ncs_yang-1.2.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 36.3 kB

Release files / ncs-yang-1.2.4.3.tar.gz

Download URL ncs-yang-1.2.4.3.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
32f51d64a16a76d251e4c5dfef7369036709b8b6b9bb687f33a53197a165274e
BLAKE2b-256 checksum
How to use checksums
21b7f48fde0051c9abd2d91473a07e71dc8dd04736bfbd4f6d512365c8377829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / ncs_yang-1.2.4.3-py3-none-any.whl

Download URL ncs_yang-1.2.4.3-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9ca63ccf4fe46af69b1073469573783206db7aaeb116c26ccf554bae143649e
BLAKE2b-256 checksum
How to use checksums
f01da0f11ff29ddc6fa84955d3697f77acbfbf45f70ea369f68da81d77c7d974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.2.4.3 This release

2 release files

1.2.4

2 release files

1.2

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page