This is a prototype implementation of RESTCONF for the OpenWrt system that utilizes the UCI configuration files as a datastore. The implementation also extends support to run operations.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
The efficient automation of operations in heterogeneous network devices from different vendors is a great challenge. OpenWrt an open-source embedded operating system has become a popular firmware choice replacing proprietary firmware on networking devices, whether home routers or enterprise networks.
RESTCONF is a network management protocol that offers a programmatic interface for accessing state and configuration data, RPC operations, and event notifications on a networking device. Although OpenWrt pro- vides ways to run common network-related operations via the web user interface and the command-line interface, it still lacks an efficient implementation of RESTCONF that allows for efficient automated operation tasks across devices. Contemplating this pos- sibility, OpenWrt RESTCONF (ORC) was extended to support operations.
The steps to setup the development environment can be quite hectic. The following resources can help in development environment setup.
- Python 3 for the YANG conversion script
- Tool for converting YANG to YIN
To add YANG modules for OpenWrt they have to go through some pre-processing. This is
what the ./yin2json/yin2json.py
script does.
Before YANG modules can be used with this implementation they have to be
annotated with the extensions provided in /yang/openwrt-uci-extension.yang
.
An example of an annotated module is /yang/restconf-example.yang
-
Convert the YANG modules to be included to YIN and put them in one folder, i.e.
/yin
. For example withpyang
pyang -f yin ./yang/restconf-example.yang -p ./yang -o ./yin/restconf-example.yin
-
Run the
yin2json.py
scriptpython3 ./yin2json/yin2json.py -y ./yin -o ./generated-for-openwrt ./yin/restconf-example.yin ...
This converts the YIN files and generates a
.h
file in./generated-for-openwrt
that has to be included in/src/generated/yang.h
A script file
yang2json.sh
is also provided for automation of conversion directly from yang to theyang.h
header file.
- Clone this repository
cd docker
docker build -t digggy/orc-sdk:1.0 .
cd ..
docker run -v $(pwd):/restconf digggy/openwrt-build
- The generated
.ipk
will be in thebuild
folder
The tests are inside the /test
directory and are based on the Python
Tavern Testing Framework. After
installing the framework the tests can be run using either of the
following commands:
tavern-ci ./test/test_restconf.tavern.yml
# or
py.test ./test/test_restconf.tavern.yml
This will run integration tests that check the actual implementation. The
url where the server is located can be changed in /test/common.yaml
.
The .ipk file can be installed in the Openwrt system to utlize the features of restconf for the Openwrt devices.
For more examples, please refer to the Documentation
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the BSD-3 License. See LICENSE
for more information.
Your Name - @_dkunwar - d.kunwar@jacobs-university.de
Project Link: https://github.com/digggy/orc