Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libyang/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def parse_data_dict(
rpc: bool = False,
rpcreply: bool = False,
notification: bool = False,
store_only: bool = False,
) -> "libyang.data.DNode":
"""
Convert a python dictionary to a DNode object following the schema of this
Expand Down Expand Up @@ -276,6 +277,7 @@ def parse_data_dict(
rpc=rpc,
rpcreply=rpcreply,
notification=notification,
store_only=store_only,
)


Expand Down
19 changes: 19 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,3 +1112,22 @@ def test_dnode_builtin_plugins_only(self):
self.assertIsInstance(dnode, DLeaf)
self.assertEqual(dnode.value(), "test")
dnode.free()

def test_merge_store_only(self):
MAIN = {"yolo-nodetypes:test1": 50}
module = self.ctx.load_module("yolo-nodetypes")
dnode = module.parse_data_dict(MAIN, validate=False, store_only=True)
self.assertIsInstance(dnode, DLeaf)
self.assertEqual(dnode.value(), 50)
dnode.free()

def test_merge_builtin_plugins_only(self):
MAIN = {"yolo-nodetypes:ip-address": "test"}
self.tearDown()
gc.collect()
self.ctx = Context(YANG_DIR, builtin_plugins_only=True)
module = self.ctx.load_module("yolo-nodetypes")
dnode = module.parse_data_dict(MAIN, validate=False, store_only=True)
self.assertIsInstance(dnode, DLeaf)
self.assertEqual(dnode.value(), "test")
dnode.free()
Loading