Examples
All examples are located in examples/
directory.
Requirements:
- Python 3.5+
- resolvers-yang library must be installed.
- yangson library
Using Python virtual environment is recommended. Look at devinstall
example-data.json
example-data.json
is example of Json-encoded file, which is valid against resolvers-yang data model
You can edit this Json and validate it against data model using
$ make validate
No output means that example-data.json
is valid.
generate_conf.py
This script will generate unbound.conf
and kresd.conf
files in local files.
Run generate_conf.py
script with path to Json file as parameter
$ python generate_conf.py example-data.json
If generated unbound.conf
is converted to JSON using unb_to_json.py
script. The result do not have to be the same as input JSON for generate_conf.py
script because the configuration designed to Knot Resolver is ignored for Unbound.
unb_to_json.py
This script will convert Unbound configuration text file unbound.conf
to resolvers-yang data model valid Json-encoded file unb-data.json
.
As example configuration file can be used unbound.conf
created by running generate_conf.py
Run unb_to_conf.py
with path to unbound.conf
as parameter
$ python unb_to_json.py unbound.conf
No output means that the JSON data in created unb-data.json
is valid.
If you generate another unbound.conf
from this Json using generate_conf.py
script, it should be equal to unbound.conf
, which was used as input parameter to unb_to_json.py
script.