summaryrefslogtreecommitdiffhomepage
path: root/tools/pyang_plugins/bgpyang2golang.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pyang_plugins/bgpyang2golang.py')
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py
index cc2b81f2..64d4d97c 100644
--- a/tools/pyang_plugins/bgpyang2golang.py
+++ b/tools/pyang_plugins/bgpyang2golang.py
@@ -166,6 +166,9 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
else:
emit_type_name = t.arg
+ # case embeded enumeration
+ elif type_name == 'enumeration':
+ emit_type_name = val_name_go
# case translation required
elif is_translation_required(type_obj):
@@ -290,6 +293,16 @@ def visit_children(ctx, module, children):
t = c.search_one('type')
+ # define container embeded enums
+ if is_leaf(c) and c.search_one('type').arg == 'enumeration':
+ prefix = module.i_prefix
+ c.path = get_path(c)
+ c.golang_name = convert_to_golang(c.arg)
+ if prefix in ctx.golang_typedef_map:
+ ctx.golang_typedef_map[prefix][c.arg] = c
+ else:
+ ctx.golang_typedef_map[prefix] = {c.arg: c}
+
if is_list(c) or is_container(c) or is_choice(c):
c.golang_name = convert_to_golang(c.uniq_name)
@@ -542,7 +555,6 @@ def is_translation_required(t):
_type_translation_map = {
'union': 'string',
- 'enumeration': 'uint32',
'decimal64': 'float64',
'boolean': 'bool',
'empty': 'bool',