Skip to content

Commit bca074e

Browse files
avazquezrdrjarry
authored andcommitted
meta: add DNode.get_meta()
Get specific item from node metadata.
1 parent 16782da commit bca074e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libyang/data.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ def meta(self):
249249
item = item.next
250250
return ret
251251

252+
def get_meta(self, name):
253+
item = self.cdata.meta
254+
while item != ffi.NULL:
255+
if c2str(item.name) == name:
256+
return c2str(
257+
lib.lyd_value_get_canonical(
258+
self.context.cdata, ffi.addressof(item.value)
259+
)
260+
)
261+
item = item.next
262+
return None
263+
252264
def meta_free(self, name):
253265
item = self.cdata.meta
254266
while item != ffi.NULL:

0 commit comments

Comments
 (0)