diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-26 18:15:03 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-26 18:15:03 +0900 |
commit | eef1fc0a7529a2ee12c822af1b393906cd114ef9 (patch) | |
tree | d3ea1183f2f3d162b59b0c3197a8969dbcd6aaf6 | |
parent | 982a5b448f5ba99033911cdcaeebeeb8c2ed81fa (diff) |
add RemoteRouterId to config.NeighborState
Stop using config.NeighborState's Description in a hacky way for the
remote Router Id.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | api/grpc_server.go | 2 | ||||
-rw-r--r-- | config/bgp_configs.go | 5 | ||||
-rw-r--r-- | server/mrt.go | 2 | ||||
-rw-r--r-- | server/peer.go | 2 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 6 |
5 files changed, 14 insertions, 3 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index e429e456..43960620 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -107,7 +107,7 @@ func (s *Server) GetNeighbor(ctx context.Context, arg *GetNeighborRequest) (*Get return &Peer{ Conf: &PeerConf{ NeighborAddress: pconf.Config.NeighborAddress, - Id: s.Description, + Id: s.RemoteRouterId, PeerAs: pconf.Config.PeerAs, LocalAs: pconf.Config.LocalAs, PeerType: uint32(pconf.Config.PeerType.ToInt()), diff --git a/config/bgp_configs.go b/config/bgp_configs.go index c2353c8f..7125db4c 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -2512,6 +2512,8 @@ type NeighborState struct { Flops uint32 `mapstructure:"flops"` // original -> gobgp:neighbor-interface NeighborInterface string `mapstructure:"neighbor-interface"` + // original -> gobgp:remote-router-id + RemoteRouterId string `mapstructure:"remote-router-id"` } func (lhs *NeighborState) Equal(rhs *NeighborState) bool { @@ -2589,6 +2591,9 @@ func (lhs *NeighborState) Equal(rhs *NeighborState) bool { if lhs.NeighborInterface != rhs.NeighborInterface { return false } + if lhs.RemoteRouterId != rhs.RemoteRouterId { + return false + } return true } diff --git a/server/mrt.go b/server/mrt.go index b92ce293..06537817 100644 --- a/server/mrt.go +++ b/server/mrt.go @@ -104,7 +104,7 @@ func (m *mrtWriter) loop() error { t := uint32(time.Now().Unix()) peers := make([]*mrt.Peer, 0, len(m.Neighbor)) for _, pconf := range m.Neighbor { - peers = append(peers, mrt.NewPeer(pconf.State.Description, pconf.Config.NeighborAddress, pconf.Config.PeerAs, true)) + peers = append(peers, mrt.NewPeer(pconf.State.RemoteRouterId, pconf.Config.NeighborAddress, pconf.Config.PeerAs, true)) } if bm, err := mrt.NewMRTMessage(t, mrt.TABLE_DUMPv2, mrt.PEER_INDEX_TABLE, mrt.NewPeerIndexTable(m.RouterId, "", peers)); err != nil { break diff --git a/server/peer.go b/server/peer.go index d27f96e6..f239033a 100644 --- a/server/peer.go +++ b/server/peer.go @@ -394,7 +394,7 @@ func (peer *Peer) ToConfig() *config.Neighbor { } conf.State.Capabilities.LocalList = localCap - conf.State.Description = peer.fsm.peerInfo.ID.To4().String() + conf.State.RemoteRouterId = peer.fsm.peerInfo.ID.To4().String() conf.State.SessionState = config.IntToSessionStateMap[int(peer.fsm.state)] conf.State.AdminState = peer.fsm.adminState.String() diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index 873b8816..44a36299 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -667,6 +667,12 @@ module gobgp { } } + augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" { + leaf remote-router-id { + type string; + } + } + augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:transport/bgp:config" { leaf remote-port { type inet:port-number; |