diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-26 16:01:20 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-26 16:01:20 +0900 |
commit | 5966466632bd73676ec80ca71c5082f88cb65bd6 (patch) | |
tree | fecd12fd6d7f02e5efb79f3d9511161fd0fa56a6 /server/grpc_server.go | |
parent | e7354de8bbc20bc507723dc185940f7368723ca4 (diff) |
move gRPC-related code for REQ_GET_VRF 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 | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index 34aa1f9d..ca852f83 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -772,11 +772,6 @@ func (s *Server) GetRoa(ctx context.Context, arg *api.GetRoaRequest) (*api.GetRo } func (s *Server) GetVrf(ctx context.Context, arg *api.GetVrfRequest) (*api.GetVrfResponse, error) { - d, err := s.get(REQ_GET_VRF, arg) - if err != nil { - return nil, err - } - l := make([]*api.Vrf, 0, len(d.([]*table.Vrf))) toApi := func(v *table.Vrf) *api.Vrf { f := func(rts []bgp.ExtendedCommunityInterface) [][]byte { ret := make([][]byte, 0, len(rts)) @@ -794,8 +789,9 @@ func (s *Server) GetVrf(ctx context.Context, arg *api.GetVrfRequest) (*api.GetVr ExportRt: f(v.ExportRt), } } - - for _, v := range d.([]*table.Vrf) { + vrfs := s.bgpServer.GetVrf() + l := make([]*api.Vrf, 0, len(vrfs)) + for _, v := range vrfs { l = append(l, toApi(v)) } return &api.GetVrfResponse{Vrfs: l}, nil |