diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-08 13:34:09 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-09 05:17:57 -0800 |
commit | 834476474672f44d2e2d9fd7a1b913f0981116c3 (patch) | |
tree | 83deccf1a36936b11918766455c3ddc3c20cbaac /config/bgp_configs.go | |
parent | 033c8bfdb8fca37b7dccc46aaa2dda02763d9f35 (diff) |
config: we don't need to modify origin PeerType name
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r-- | config/bgp_configs.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 2c1298e4..713c7821 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -104,14 +104,14 @@ type BgpExtCommunityType string type BgpStdCommunityType string // typedef for typedef bgp-types:peer-type -type PeerTypeDef string +type PeerType string const ( - PEER_TYPE_INTERNAL PeerTypeDef = "internal" - PEER_TYPE_EXTERNAL PeerTypeDef = "external" + PEER_TYPE_INTERNAL PeerType = "internal" + PEER_TYPE_EXTERNAL PeerType = "external" ) -func (v PeerTypeDef) ToInt() int { +func (v PeerType) ToInt() int { for i, vv := range []string{"internal", "external"} { if string(v) == vv { return i @@ -120,18 +120,18 @@ func (v PeerTypeDef) ToInt() int { return -1 } -func (v PeerTypeDef) FromInt(i int) PeerTypeDef { +func (v PeerType) FromInt(i int) PeerType { for j, vv := range []string{"internal", "external"} { if i == j { - return PeerTypeDef(vv) + return PeerType(vv) } } - return PeerTypeDef("") + return PeerType("") } -func (v PeerTypeDef) Validate() error { +func (v PeerType) Validate() error { if v.ToInt() < 0 { - return fmt.Errorf("invalid PeerTypeDef: %s", v) + return fmt.Errorf("invalid PeerType: %s", v) } return nil } @@ -563,7 +563,7 @@ type PeerGroupState struct { //bgp:local-as's original type is inet:as-number LocalAs uint32 // original -> bgp:peer-type - PeerType PeerTypeDef + PeerType PeerType // original -> bgp:auth-password AuthPassword string // original -> bgp:remove-private-as @@ -592,7 +592,7 @@ type PeerGroupConfig struct { //bgp:local-as's original type is inet:as-number LocalAs uint32 // original -> bgp:peer-type - PeerType PeerTypeDef + PeerType PeerType // original -> bgp:auth-password AuthPassword string // original -> bgp:remove-private-as @@ -1001,7 +1001,7 @@ type NeighborState struct { //bgp:local-as's original type is inet:as-number LocalAs uint32 // original -> bgp:peer-type - PeerType PeerTypeDef + PeerType PeerType // original -> bgp:auth-password AuthPassword string // original -> bgp:remove-private-as @@ -1046,7 +1046,7 @@ type NeighborConfig struct { //bgp:local-as's original type is inet:as-number LocalAs uint32 // original -> bgp:peer-type - PeerType PeerTypeDef + PeerType PeerType // original -> bgp:auth-password AuthPassword string // original -> bgp:remove-private-as |