Library for converts YANG modules into TOSCA node types for Cloudify orchestration framework. Cloudify
YANG - A Data Modeling Language for the Network Configuration Protocol RFC 6020
TOSCA - Topology and Orchestration Specification for Cloud Applications TOSCA
This module require Python 2.
$git clone https://github.com/cloudify-cosmo/yttc
$cd yttc
$ pip install .
For converting yang modules, you must call:
yacc.convert(filenames, out_fd)
Where:
- filenames - list of filenames, of yang files
- out_fd - file descriptor. It may be descriptor of open file, or StringIO class.
The output will be written to the out_fd.
> import yttc
> import StringIO
> output = StringIO.StringIO()
> yttc.convert( ['acme.yang', 'acme-augment.yang'], output)
> print output.getvalue()
> output.close()
> import yttc
> import sys
> output = sys.stdout
> yttc.convert( ['acme.yang', 'acme-augment.yang'], output)
> import yttc
> import sys
> output = file.open('acme.yaml', 'w')
> yttc.convert( ['acme.yang', 'acme-augment.yang'], output)
Directory examples contains simple YANG files for testing purpose.
For running converter from commad line you can use "test.py" from 'tests' directory:
cd test
python test.py ../examples/acme.yang
This library has simple wrapper for pyang
command line utility: yttc
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 generate code from the modules. https://github.com/mbj4668/pyang
Instead of run:
pyang --plugindir /home/user/yttc/plugin -f tosca acme.yang
You can just run:
yttc acme.yang
Also you can use other options, that pyang
support.
For example:
yttc -o acme.yaml acme.yang