diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-10 05:08:24 +0000 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-14 02:15:35 +0000 |
commit | 926ab34220431de2561c17269d473f8fc8f33217 (patch) | |
tree | 1b3caab92f0a59adc3c8acebe4b8a31626ec8152 /tools | |
parent | d23cea2d7c95b0d6683fbd80abcdb65e303816a4 (diff) |
config: use struct type instead of []byte for capability and open msg
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pyang_plugins/bgpyang2golang.py | 9 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 21 |
2 files changed, 20 insertions, 10 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py index 9f131df0..5be6569f 100644 --- a/tools/pyang_plugins/bgpyang2golang.py +++ b/tools/pyang_plugins/bgpyang2golang.py @@ -665,6 +665,8 @@ _type_translation_map = { 'yang:timeticks': 'int64', 'ptypes:install-protocol-type': 'string', 'binary': '[]byte', + 'bgp-capability': 'bgp.ParameterCapabilityInterface', + 'bgp-open-message': '*bgp.BGPMessage', } @@ -690,7 +692,9 @@ _path_exclude = ["/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/rpol "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/bgp-pol:ext-community-set/bgp-pol:ext-community-member", "/rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/bgp-pol:as-path-set-member"] -_typedef_exclude =[] +_typedef_exclude =["/gobgp:bgp-capability", + "/gobgp:bgp-open-message"] + def generate_header(ctx): print _COPYRIGHT_NOTICE @@ -698,7 +702,8 @@ def generate_header(ctx): print '' print 'import (' print '"fmt"' - print '"bytes"' + print '' + print '"github.com/osrg/gobgp/packet/bgp"' print ')' print '' diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index 6729349d..06b545af 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -631,19 +631,24 @@ module gobgp { uses gobgp-adjacent-table; } + typedef bgp-capability { + type uint8; + } + + typedef bgp-open-message { + type uint8; + } augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" { - container Capabilities { - leaf-list remote { - type binary; - } - leaf-list local { - type binary; - } + leaf-list remote-capability { + type bgp-capability; + } + leaf-list local-capability { + type bgp-capability; } leaf received-open-message { - type binary; + type bgp-open-message; } } |