diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-08 13:23:52 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-09 05:17:57 -0800 |
commit | 033c8bfdb8fca37b7dccc46aaa2dda02763d9f35 (patch) | |
tree | c2b79fd11f885e3782723048fd25a72b12bfa45f | |
parent | 3bed393b014210f6764778138798c31725839079 (diff) |
config: remove redundant definition in gobgp.yang
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | config/bgp_configs.go | 68 | ||||
-rw-r--r-- | tools/pyang_plugins/bgpyang2golang.py | 2 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 17 |
3 files changed, 35 insertions, 52 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 6baa8bdd..2c1298e4 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -169,6 +169,40 @@ func (v BgpSessionDirection) Validate() error { return nil } +// typedef for typedef bgp-types:bgp-origin-attr-type +type BgpOriginAttrType string + +const ( + BGP_ORIGIN_ATTR_TYPE_IGP BgpOriginAttrType = "igp" + BGP_ORIGIN_ATTR_TYPE_EGP BgpOriginAttrType = "egp" + BGP_ORIGIN_ATTR_TYPE_INCOMPLETE BgpOriginAttrType = "incomplete" +) + +func (v BgpOriginAttrType) ToInt() int { + for i, vv := range []string{"igp", "egp", "incomplete"} { + if string(v) == vv { + return i + } + } + return -1 +} + +func (v BgpOriginAttrType) FromInt(i int) BgpOriginAttrType { + for j, vv := range []string{"igp", "egp", "incomplete"} { + if i == j { + return BgpOriginAttrType(vv) + } + } + return BgpOriginAttrType("") +} + +func (v BgpOriginAttrType) Validate() error { + if v.ToInt() < 0 { + return fmt.Errorf("invalid BgpOriginAttrType: %s", v) + } + return nil +} + // typedef for typedef ptypes:match-set-options-restricted-type type MatchSetOptionsRestrictedType string @@ -406,40 +440,6 @@ func (v RpkiValidationResultType) Validate() error { return nil } -// typedef for typedef gobgp:bgp-origin-attr-type -type BgpOriginAttrType string - -const ( - BGP_ORIGIN_ATTR_TYPE_IGP BgpOriginAttrType = "igp" - BGP_ORIGIN_ATTR_TYPE_EGP BgpOriginAttrType = "egp" - BGP_ORIGIN_ATTR_TYPE_INCOMPLETE BgpOriginAttrType = "incomplete" -) - -func (v BgpOriginAttrType) ToInt() int { - for i, vv := range []string{"igp", "egp", "incomplete"} { - if string(v) == vv { - return i - } - } - return -1 -} - -func (v BgpOriginAttrType) FromInt(i int) BgpOriginAttrType { - for j, vv := range []string{"igp", "egp", "incomplete"} { - if i == j { - return BgpOriginAttrType(vv) - } - } - return BgpOriginAttrType("") -} - -func (v BgpOriginAttrType) Validate() error { - if v.ToInt() < 0 { - return fmt.Errorf("invalid BgpOriginAttrType: %s", v) - } - return nil -} - //struct for container gobgp:state type BmpServerState struct { } diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py index 5cb09e6a..b409a562 100644 --- a/tools/pyang_plugins/bgpyang2golang.py +++ b/tools/pyang_plugins/bgpyang2golang.py @@ -570,7 +570,7 @@ _path_exclude = ["/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:transport/bgp:config/b "/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 =["/bgp-types:bgp-origin-attr-type"] +_typedef_exclude =[] def generate_header(ctx): print _COPYRIGHT_NOTICE diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index 701e408a..4528d3ad 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -32,23 +32,6 @@ module gobgp { reference "TBD"; } - typedef bgp-origin-attr-type { - type enumeration { - enum IGP { - value 0; - description "Origin of the NLRI is internal"; - } - enum EGP { - value 1; - description "Origin of the NLRI is EGP"; - } - enum INCOMPLETE { - value 2; - description "Origin of the NLRI is neither IGP or EGP"; - } - } - } - typedef bmp-route-monitoring-policy-type { type enumeration { enum PRE-POLICY { |