summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go31
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)