Skip to content
Open
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
16 changes: 15 additions & 1 deletion pyang/plugins/sid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down