Description
Hi,
I am trying to build a data tree based on the example that you have provided. I can load the schema, but I was not able to create a data tree. I am getting an error: "libyang.util.LibyangError: validation failed: Missing required element "content-id" in "yang-library".
Any pointer is much appreciated.
ctx = libyang.Context()
module = ctx.parse_module_str('''
... module example {
... namespace "urn:example";
... prefix "ex";
... container data {
... list interface {
... key name;
... leaf name {
... type string;
... }
... leaf address {
... type string;
... }
... }
... leaf hostname {
... type string;
... }
... }
... }
... ''')print(module.print_mem('tree'))
module: example
+--rw data
+--rw interface* [name]
| +--rw name string
| +--rw address? string
+--rw hostname? string
node = module.parse_data_dict({
... 'data': {
... 'hostname': 'foobar',
... 'interface': [
... {'name': 'eth0', 'address': '1.2.3.4/24'},
... {'name': 'lo', 'address': '127.0.0.1'},
... ],
... },
... })
Traceback (most recent call last):
File "", line 6, in
File "/home/gwieser/libyang-python-test01/venv/lib/python3.6/site-packages/libyang/schema.py", line 190, in parse_data_dict
validate=validate,
File "/home/gwieser/libyang-python-test01/venv/lib/python3.6/site-packages/libyang/data.py", line 903, in dict_to_dnode
no_yanglib=no_yanglib,
File "/home/gwieser/libyang-python-test01/venv/lib/python3.6/site-packages/libyang/data.py", line 282, in validate
raise self.context.error("validation failed")
libyang.util.LibyangError: validation failed: Missing required element "content-id" in "yang-library".