summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-22 23:58:31 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-01-25 04:57:11 -0800
commitcca91da0dfe70c2c32d5152b3a2cf76bfdb0f048 (patch)
treec651f896af8ae8a85a1e928bbc919b9eda4dd6b5 /tools
parent4ad751b4f01a23af523ba6ea6b183bebb74be041 (diff)
config: add go type of embeded enums defined in openconfig
these types are embeded enums of openconfig and were left uint32 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'tools')
-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',