diff --git a/libyang/schema.py b/libyang/schema.py index a47974e..db0514d 100644 --- a/libyang/schema.py +++ b/libyang/schema.py @@ -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 @@ -276,6 +277,7 @@ def parse_data_dict( rpc=rpc, rpcreply=rpcreply, notification=notification, + store_only=store_only, ) diff --git a/tests/test_data.py b/tests/test_data.py index 1728042..4b7914e 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -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()