diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-30 17:39:13 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-09 22:43:01 +0900 |
commit | f4c07da88154dd4b21012576a4ceb205715f4b3e (patch) | |
tree | 1c00c7ee3c5d439008291532c3b70e83ab230d74 /server/server.go | |
parent | da01fa48af05820d8b8731379cf647be049be503 (diff) |
server: add REQ_BMP_NEIGHBORS api for internal bmp use
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go index 71eefced..8de474a2 100644 --- a/server/server.go +++ b/server/server.go @@ -1658,7 +1658,25 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { i++ } go sendMultipleResponses(grpcReq, results) - + case REQ_BMP_NEIGHBORS: + //TODO: merge REQ_NEIGHBORS and REQ_BMP_NEIGHBORS + msgs := make([]*bgp.BMPMessage, 0, len(server.neighborMap)) + for _, peer := range server.neighborMap { + if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED { + continue + } + laddr, lport := peer.fsm.LocalHostPort() + _, rport := peer.fsm.RemoteHostPort() + sentOpen := buildopen(peer.fsm.gConf, peer.fsm.pConf) + info := peer.fsm.peerInfo + timestamp := peer.conf.Timers.State.Uptime + msg := bmpPeerUp(laddr, lport, rport, sentOpen, peer.recvOpen, bgp.BMP_PEER_TYPE_GLOBAL, false, 0, info, timestamp) + msgs = append(msgs, msg) + } + grpcReq.ResponseCh <- &GrpcResponse{ + Data: msgs, + } + close(grpcReq.ResponseCh) case REQ_NEIGHBOR: peer, err := server.checkNeighborRequest(grpcReq) if err != nil { |