diff --git a/pyang/plugins/sid.py b/pyang/plugins/sid.py index dc9134ff..f39ad260 100644 --- a/pyang/plugins/sid.py +++ b/pyang/plugins/sid.py @@ -566,6 +566,15 @@ def out_of_ranges(self, sid): def has_yang_data_extension(statement): try: return statement.i_extension.arg == 'yang-data' + + except AttributeError: + return False + + @staticmethod + def has_structure_extension(statement): + try: + return statement.i_extension.arg == 'structure' + except AttributeError: return False @@ -616,6 +625,8 @@ def collect_module_items(self, module): self.collect_in_substmts(substmt.substmts) elif self.has_yang_data_extension(substmt): self.collect_in_substmts(substmt.substmts) + elif self.has_structure_extension(substmt): + self.collect_in_substmts(substmt.substmts) def collect_inner_data_nodes(self, statements, prefix=""): for statement in statements: @@ -679,8 +690,11 @@ def get_path(self, statement, prefix=""): return prefix + path def merge_item(self, namespace, identifier): + # only compare the last component. + lastid = re.split(r'[/:]', identifier)[-1] for item in self.content['items']: - if (namespace == item['namespace'] and identifier == item['identifier']): + itemlast = re.split(r'[/:]',item['identifier'])[-1] + if (namespace == item['namespace'] and lastid == itemlast): item['lifecycle'] = 'o' # Item already assigned return self.content['items'].append(collections.OrderedDict(