diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-28 20:47:01 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-28 20:47:01 +0900 |
commit | c3560d1224f7759455b6916843341b20355dbfe5 (patch) | |
tree | b227d666143a6e7feade9267f4a993f189615824 /server/grpc_server.go | |
parent | 70251f7175f1b30a9ed58d240b7e04419c91d601 (diff) |
move gRPC-related code for RPKI to grpc_server.go
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/grpc_server.go')
-rw-r--r-- | server/grpc_server.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index d67d85cc..00e8e263 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -686,12 +686,12 @@ func (s *Server) SoftResetRpki(ctx context.Context, arg *api.SoftResetRpkiReques } func (s *Server) GetRpki(ctx context.Context, arg *api.GetRpkiRequest) (*api.GetRpkiResponse, error) { - d, err := s.get(REQ_GET_RPKI, arg) + servers, err := s.bgpServer.GetRpki() if err != nil { return nil, err } - l := make([]*api.Rpki, 0) - for _, s := range d.([]*config.RpkiServer) { + l := make([]*api.Rpki, 0, len(servers)) + for _, s := range servers { received := &s.State.RpkiMessages.RpkiReceived sent := &s.State.RpkiMessages.RpkiSent rpki := &api.Rpki{ @@ -725,12 +725,12 @@ func (s *Server) GetRpki(ctx context.Context, arg *api.GetRpkiRequest) (*api.Get } func (s *Server) GetRoa(ctx context.Context, arg *api.GetRoaRequest) (*api.GetRoaResponse, error) { - d, err := s.get(REQ_ROA, arg) + roas, err := s.bgpServer.GetRoa(bgp.RouteFamily(arg.Family)) if err != nil { return nil, err } - l := make([]*api.Roa, 0, len(d.([]*ROA))) - for _, r := range d.([]*ROA) { + l := make([]*api.Roa, 0, len(roas)) + for _, r := range roas { host, port, _ := net.SplitHostPort(r.Src) l = append(l, &api.Roa{ As: r.AS, |