From fc59aaf12933b20c9acee06988ae9518cfb58a4a Mon Sep 17 00:00:00 2001 From: Carl Smith Date: Tue, 19 Sep 2023 11:37:42 +1200 Subject: [PATCH] Strip path nodes from C path if choice/case We missed the setting of level if choice/case which meant we were pringin the full path for a choice/case even if that traversed a list key (*). --- pyang-cpaths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyang-cpaths.py b/pyang-cpaths.py index 1c60df5..a8e15df 100644 --- a/pyang-cpaths.py +++ b/pyang-cpaths.py @@ -81,16 +81,16 @@ def print_node(node, module, prefix, fd, ctx, level=0, strip=0): if node.keyword in ['rpc', 'notification']: return + # Strip all nodes from the path at list items + if node.parent.keyword == 'list': + strip = level + # Skip over choice and case if node.keyword in ['choice', 'case']: for child in node.i_children: print_node(child, module, prefix, fd, ctx, level, strip) return - # Strip all nodes from the path at list items - if node.parent.keyword == 'list': - strip = level - # Create path value value = mk_path_str(node, prefix, level, strip, fd) if strip == 0: