diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-06 16:06:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-06 16:06:56 +0900 |
commit | 74774b39d28541684eb9a547fab794210d932ef7 (patch) | |
tree | 6d85886ccd3658f256ca387db440d4ffbfc03e36 /server | |
parent | 0a8d6e0e6b8d01651d6983470bea0e4a5ab747a7 (diff) |
server: log admin operations
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index 1e111c09..82193d00 100644 --- a/server/server.go +++ b/server/server.go @@ -1269,6 +1269,13 @@ func sendMultipleResponses(grpcReq *GrpcRequest, results []*GrpcResponse) { func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { var msgs []*SenderMsg + logOp := func(peer *Peer, action string) { + log.WithFields(log.Fields{ + "Topic": "Operation", + "Key": peer.conf.NeighborConfig.NeighborAddress.String(), + }).Info(action) + } + sortedDsts := func(t *table.Table) []*GrpcResponse { results := make([]*GrpcResponse, len(t.GetDestinations())) @@ -1417,6 +1424,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if err != nil { break } + logOp(peer, "Neighbor shutdown") m := bgp.NewBGPNotificationMessage(bgp.BGP_ERROR_CEASE, bgp.BGP_ERROR_SUB_ADMINISTRATIVE_SHUTDOWN, nil) msgs = []*SenderMsg{newSenderMsg(peer, []*bgp.BGPMessage{m})} grpcReq.ResponseCh <- &GrpcResponse{} @@ -1427,6 +1435,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if err != nil { break } + logOp(peer, "Neighbor reset") peer.fsm.idleHoldTime = peer.conf.Timers.TimersConfig.IdleHoldTimeAfterReset m := bgp.NewBGPNotificationMessage(bgp.BGP_ERROR_CEASE, bgp.BGP_ERROR_SUB_ADMINISTRATIVE_RESET, nil) msgs = []*SenderMsg{newSenderMsg(peer, []*bgp.BGPMessage{m})} @@ -1439,6 +1448,12 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if err != nil { break } + if grpcReq.RequestType == REQ_NEIGHBOR_SOFT_RESET { + logOp(peer, "Neighbor soft reset") + } else { + logOp(peer, "Neighbor soft reset in") + } + pathList := peer.adjRib.GetInPathList(grpcReq.RouteFamily) msgs = server.propagateUpdate(peer, pathList) @@ -1453,6 +1468,9 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if err != nil { break } + if grpcReq.RequestType == REQ_NEIGHBOR_SOFT_RESET_OUT { + logOp(peer, "Neighbor soft reset out") + } pathList := peer.adjRib.GetOutPathList(grpcReq.RouteFamily) msgList := table.CreateUpdateMsgFromPaths(pathList) msgs = []*SenderMsg{newSenderMsg(peer, msgList)} |