diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2014-11-17 10:36:53 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-11-17 11:11:12 +0900 |
commit | a2f3cb72d14ae54b85950b6cb6cb319ffcf68175 (patch) | |
tree | 920e5a258cc5767777febfc596215d513cb6176a /tools/pyang_plugins | |
parent | d25dc5c6c2db44e3cc88b35dc14c032c5ecc270f (diff) |
pyang_plugin: modify type translation rule and copyright
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'tools/pyang_plugins')
-rw-r--r-- | tools/pyang_plugins/bgpyang2golang.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py index 05091fb5..e5c9f8b8 100644 --- a/tools/pyang_plugins/bgpyang2golang.py +++ b/tools/pyang_plugins/bgpyang2golang.py @@ -1,4 +1,4 @@ -# Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation. +# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,17 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -# this is a pyang plugin to generate $GOPATH/gobgp/config/bgp_configs.go +# this is a pyang plugin to generate $GOBGP_PATH/config/bgp_configs.go # usage example: +# GOBGP_PATH=$GOPATH/src/github.com/osrg/gobgp # cd $PYANG_INSTALL_DIR # source ./env.sh -# PYTHONPATH=. ./bin/pyang --plugindir $GOPATH/gobgp/tools/pyang_plugins \ -# -f golang ./modules/bgp.yang > $GOPATH/gobgp/config/bgp_configs.go -# NOTICE: copy related yang files into $$PYANG_INSTALL_DIR/modules/ in advance. +# PYTHONPATH=. ./bin/pyang --plugindir $GOBGP_PATH/tools/pyang_plugins \ +# -f golang ./modules/bgp.yang > out.go +# gofmt out.go > $GOBGP_PATH/config/bgp_configs.go +# +# NOTICE: copy related yang files into $PYANG_INSTALL_DIR/modules/ in advance. _COPYRIGHT_NOTICE = """ -// Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation. +// Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -156,7 +159,7 @@ def emit_class_def(ctx, c, struct_name): # case translation required elif is_translation_required(type_obj): - print >> o, ' //original type is list of %s' % (type_obj) + print >> o, ' //original type is list of %s' % (type_obj.arg) emit_type_name = '[]'+translate_type(type_name) # case other primitives @@ -341,8 +344,8 @@ _type_translation_map = { 'decimal64': 'float64', 'boolean': 'bool', 'empty': 'bool', - 'inet:ip-address': '*net.IP', - 'inet:ipv4-address': '*net.IP', + 'inet:ip-address': 'net.IP', + 'inet:ipv4-address': 'net.IP', 'inet:as-number': 'uint32', 'rr-cluster-id-type': 'uint32', } |