Cutest YANG Eater alive
Licensed under the Apache License, Version 2.0
[INFO] This project is currently in a transitional process of reimplementation based on Java, using OpenDaylight libraries!
To generate a Python API from a set of YANG modules, the following Gradle command can currently be used:
gradle run --args="path/to/your/yang/modules path/to/your/pythonized/yang/package" --info --stacktrace
[INFO] The old Python implementation, using pyang, is in parallel still extant without any modifications!
Alpakka is a python project that extends pyang to automatically generate code skeletons from YANG modules. The focus is on code stubs for the configuration of networks and network devices, which are controlled by NETCONF or RESCONF.
The following steps guide you through the installation process. Please be aware that the following instructions are only tested with the referenced versions of python and the required python libraries.
Python (version 3.5 or newer), pip, and optionally git are required to follow the guide and use the code from this repository.
The first step is to install the two required packages. The first is the alpakka
project itself. It contains the wrapping engine and the basic functionality to map YANG statements to their wrapped representation for the code generation step.
pip install alpakka
The second requirement is the wools
package. It adapts the wrapping engine of alpakka
by applying specific handling for different programming languages and frameworks and implements the code generation process itself.
pip install wools
After the installation of both projects is finished, you can verify that everything is installed correctly by listing all installed python packages:
pip list
If you want to contribute to the alpakka
project or further customize it, then you should clone the two required repositories.
git clone https://github.com/advaoptical/alpakka.git
git clone https://github.com/advaoptical/wools.git
The next step is to install both projects in development mode. It is recommended to install the alpakka
project first and then the wools
project. The following commands assume that you cloned both repositories into the current folder.
pip install -e ./alpakka
pip install -e ./wools
In this case, you can verify that everything is installed correctly by listing all python packages that are installed in development mode:
pip list -e
alpakka
can be launched from the command line by typing:
alpakka <options> <YANG source file>
alpakka
provides the following command line options:
-w
, --wool
(required)
--output-path
(required)
-i
, --interactive
--configuration-file-location
In addition, there is currently one relevant parameter inherited from pyang
--path
(inherited)
In some cases, alpakka
does not provide the correct result if augmentation is used. This will be fixed in one of the upcoming releases.