diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-26 01:11:22 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-26 07:20:47 +0900 |
commit | 21938add9f67de5bea1ac7ccb4b21b24a996437b (patch) | |
tree | 59b9dc1376f153d03031bf5c20aeef2cd8f34f89 | |
parent | f1e1329dab8183214c9727a80debd2d40d283d93 (diff) |
move NeighborPortNumber config to transport.Config
More appropriate.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | config/bgp_configs.go | 12 | ||||
-rw-r--r-- | server/fsm.go | 4 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 5edaad2e..7beaeec9 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -1893,6 +1893,9 @@ type TransportConfig struct { // original -> bgp:local-address //bgp:local-address's original type is union LocalAddress string `mapstructure:"local-address"` + // original -> gobgp:remote-port + //gobgp:remote-port's original type is inet:port-number + RemotePort uint16 `mapstructure:"remote-port"` } func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool { @@ -1911,6 +1914,9 @@ func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool { if lhs.LocalAddress != rhs.LocalAddress { return false } + if lhs.RemotePort != rhs.RemotePort { + return false + } return true } @@ -2337,9 +2343,6 @@ type NeighborConfig struct { // original -> bgp:neighbor-address //bgp:neighbor-address's original type is inet:ip-address NeighborAddress string `mapstructure:"neighbor-address"` - // original -> gobgp:neighbor-port-number - //gobgp:neighbor-port-number's original type is inet:port-number - NeighborPortNumber uint16 `mapstructure:"neighbor-port-number"` } func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool { @@ -2376,9 +2379,6 @@ func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool { if lhs.NeighborAddress != rhs.NeighborAddress { return false } - if lhs.NeighborPortNumber != rhs.NeighborPortNumber { - return false - } return true } diff --git a/server/fsm.go b/server/fsm.go index 15299044..4132f3b1 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -312,8 +312,8 @@ func (fsm *FSM) connectLoop() error { if fsm.state == bgp.BGP_FSM_ACTIVE && !fsm.pConf.GracefulRestart.State.PeerRestarting { addr := fsm.pConf.Config.NeighborAddress port := int(bgp.BGP_PORT) - if fsm.pConf.Config.NeighborPortNumber != 0 { - port = int(fsm.pConf.Config.NeighborPortNumber) + if fsm.pConf.Transport.Config.RemotePort != 0 { + port = int(fsm.pConf.Transport.Config.RemotePort) } host := net.JoinHostPort(addr, strconv.Itoa(port)) // check if LocalAddress has been configured diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index bba39762..6650711d 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -585,8 +585,8 @@ module gobgp { } - augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:config" { - leaf neighbor-port-number { + augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:transport/bgp:config" { + leaf remote-port { type inet:port-number; } } |