From 21938add9f67de5bea1ac7ccb4b21b24a996437b Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 26 Apr 2016 01:11:22 +0900 Subject: move NeighborPortNumber config to transport.Config More appropriate. Signed-off-by: FUJITA Tomonori --- config/bgp_configs.go | 12 ++++++------ server/fsm.go | 4 ++-- 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; } } -- cgit v1.2.3