diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-05 15:54:52 +0000 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-05 15:54:52 +0000 |
commit | e4cd6e08f66c80a17230b709ede67f40d62969ce (patch) | |
tree | 6bea14f54dfc0d44681ef2d3f54b17a80db9bb4a /api | |
parent | b01e402739c14a18efdf427f6c928ef1424e9a6c (diff) |
bmp: fix wrong monitoring policy type translation
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api')
-rw-r--r-- | api/grpc_server.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index 654ef78c..34139d4e 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -574,10 +574,14 @@ func (s *Server) InjectMrt(stream GobgpApi_InjectMrtServer) error { } func (s *Server) AddBmp(ctx context.Context, arg *AddBmpRequest) (*AddBmpResponse, error) { + t, ok := config.IntToBmpRouteMonitoringPolicyTypeMap[int(arg.Type)] + if !ok { + return nil, fmt.Errorf("invalid bmp route monitoring policy: %d", arg.Type) + } return &AddBmpResponse{}, s.bgpServer.AddBmp(&config.BmpServerConfig{ Address: arg.Address, Port: arg.Port, - RouteMonitoringPolicy: config.BmpRouteMonitoringPolicyType(arg.Type), + RouteMonitoringPolicy: t, }) } |