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 /config | |
parent | 3bed393b014210f6764778138798c31725839079 (diff) |
config: remove redundant definition in gobgp.yang
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r-- | config/bgp_configs.go | 68 |
1 files changed, 34 insertions, 34 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 { } |