diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-28 23:37:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-29 00:10:24 +0900 |
commit | 9e6fede3f4eeb084dadd7dffde9ee9d3cb044254 (patch) | |
tree | f9d1ad32bbc0a808192d4f7ffb97bf8f6b2afd75 | |
parent | 0147728f77aa1871714b5dd23260732caeceb7ed (diff) |
fix RPKI gRPC API
fix c3560d1224f77 regression.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/grpc_server.go | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index b16990c1..c9ca9a24 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -641,51 +641,42 @@ func (s *Server) ValidateRib(ctx context.Context, arg *api.ValidateRibRequest) ( } func (s *Server) AddRpki(ctx context.Context, arg *api.AddRpkiRequest) (*api.AddRpkiResponse, error) { - d, err := s.get(REQ_ADD_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.AddRpkiResponse), err + return &api.AddRpkiResponse{}, s.bgpServer.AddRpki(&config.RpkiServerConfig{ + Address: arg.Address, + Port: arg.Port, + RecordLifetime: arg.Lifetime, + }) } func (s *Server) DeleteRpki(ctx context.Context, arg *api.DeleteRpkiRequest) (*api.DeleteRpkiResponse, error) { - d, err := s.get(REQ_DELETE_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.DeleteRpkiResponse), err + return &api.DeleteRpkiResponse{}, s.bgpServer.DeleteRpki(&config.RpkiServerConfig{ + Address: arg.Address, + Port: arg.Port, + }) } func (s *Server) EnableRpki(ctx context.Context, arg *api.EnableRpkiRequest) (*api.EnableRpkiResponse, error) { - d, err := s.get(REQ_ENABLE_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.EnableRpkiResponse), err + return &api.EnableRpkiResponse{}, s.bgpServer.EnableRpki(&config.RpkiServerConfig{ + Address: arg.Address, + }) } func (s *Server) DisableRpki(ctx context.Context, arg *api.DisableRpkiRequest) (*api.DisableRpkiResponse, error) { - d, err := s.get(REQ_DISABLE_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.DisableRpkiResponse), err + return &api.DisableRpkiResponse{}, s.bgpServer.DisableRpki(&config.RpkiServerConfig{ + Address: arg.Address, + }) } func (s *Server) ResetRpki(ctx context.Context, arg *api.ResetRpkiRequest) (*api.ResetRpkiResponse, error) { - d, err := s.get(REQ_RESET_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.ResetRpkiResponse), err + return &api.ResetRpkiResponse{}, s.bgpServer.ResetRpki(&config.RpkiServerConfig{ + Address: arg.Address, + }) } func (s *Server) SoftResetRpki(ctx context.Context, arg *api.SoftResetRpkiRequest) (*api.SoftResetRpkiResponse, error) { - d, err := s.get(REQ_SOFT_RESET_RPKI, arg) - if err != nil { - return nil, err - } - return d.(*api.SoftResetRpkiResponse), err + return &api.SoftResetRpkiResponse{}, s.bgpServer.SoftResetRpki(&config.RpkiServerConfig{ + Address: arg.Address, + }) } func (s *Server) GetRpki(ctx context.Context, arg *api.GetRpkiRequest) (*api.GetRpkiResponse, error) { |