summaryrefslogtreecommitdiffhomepage
path: root/tools/pyang_plugins/bgpyang2golang.py
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-12-28 21:02:03 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-12-28 21:02:03 +0900
commit58946b7924840f1effc993e95440266479c668d5 (patch)
treeac6fe1387af028f49a93f9f74f5bcf6ae694a376 /tools/pyang_plugins/bgpyang2golang.py
parent7a2b3951160804c6895714621099168e8e56aa74 (diff)
config: make config/state variable name simple
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'tools/pyang_plugins/bgpyang2golang.py')
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py7
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)