Skip to content
Snippets Groups Projects
Commit b5d09925 authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Fix assignment of enum values.

parent c486baad
No related branches found
No related tags found
No related merge requests found
......@@ -348,7 +348,7 @@ class EnumerationType(DataType):
:param stmt: YANG ``type enumeration`` statement
:param mid: id of the context module
"""
nextval = 0
nextval = max(self.enum.values()) + 1 if self.enum else 0
for est in stmt.find_all("enum"):
if not Context.if_features(est, mid):
continue
......@@ -356,12 +356,12 @@ class EnumerationType(DataType):
vst = est.find1("value")
if vst:
val = int(vst.argument)
if not self.enum or val > nextval:
nextval = val
self.enum[label] = val
if val > nextval:
nextval = val
else:
self.enum[label] = nextval
nextval += 1
nextval += 1
class LinkType(DataType):
"""Abstract class for instance-referencing types."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment