diff options
Diffstat (limited to 'tools/pyang_plugins')
-rw-r--r-- | tools/pyang_plugins/bgpyang2golang.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py index d8f619dd..42e4e65e 100644 --- a/tools/pyang_plugins/bgpyang2golang.py +++ b/tools/pyang_plugins/bgpyang2golang.py @@ -242,7 +242,12 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix): emit_type_name = '[]' + t.golang_name if is_container(child): - print >> o, ' %s\t%s' % (emit_type_name, emit_type_name) + name = emit_type_name + if name.startswith(convert_to_golang(struct_name)) and name.endswith("Config"): + name = 'Config' + elif name.startswith(convert_to_golang(struct_name)) and name.endswith("State"): + name = 'State' + print >> o, ' %s\t%s' % (name, emit_type_name) else: print >> o, ' %s\t%s' % (val_name_go, emit_type_name) |