diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-30 20:56:27 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-09 22:52:15 +0900 |
commit | d94bb930dc2778a39dd96050193743136a26fb0e (patch) | |
tree | 2eb3755fc82df74a28f433cf79b2ec2b7febd7d8 /server/server.go | |
parent | aff1c244ad0d88a814f2ce573800717ccd08b450 (diff) |
api: support bmp configuration
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index cd86da38..2deb9b0f 100644 --- a/server/server.go +++ b/server/server.go @@ -1975,6 +1975,8 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { server.handleMrt(grpcReq) case REQ_MOD_MRT: server.handleModMrt(grpcReq) + case REQ_MOD_BMP: + server.handleModBmp(grpcReq) case REQ_MOD_RPKI: server.handleModRpki(grpcReq) case REQ_ROA, REQ_RPKI: @@ -2532,6 +2534,35 @@ func (server *BgpServer) handleModMrt(grpcReq *GrpcRequest) { } } +func (server *BgpServer) handleModBmp(grpcReq *GrpcRequest) { + arg := grpcReq.Data.(*api.ModBmpArguments) + w, y := server.watchers[WATCHER_BMP] + if !y { + if arg.Operation == api.Operation_ADD { + w, _ = newBmpWatcher(server.GrpcReqCh) + server.watchers[WATCHER_BMP] = w + } else if arg.Operation == api.Operation_DEL { + grpcDone(grpcReq, fmt.Errorf("not enabled yet")) + return + } + } + c := config.BmpServerConfig{ + Address: arg.Address, + Port: arg.Port, + RouteMonitoringPolicy: config.BmpRouteMonitoringPolicyType(arg.Type), + } + switch arg.Operation { + case api.Operation_ADD: + err := w.(*bmpWatcher).addServer(c) + grpcDone(grpcReq, err) + case api.Operation_DEL: + err := w.(*bmpWatcher).deleteServer(c) + grpcDone(grpcReq, err) + default: + grpcDone(grpcReq, fmt.Errorf("unsupported operation: %s", arg.Operation)) + } +} + func (server *BgpServer) handleModRpki(grpcReq *GrpcRequest) { arg := grpcReq.Data.(*api.ModRpkiArguments) |