diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-26 17:29:38 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-26 17:29:38 +0900 |
commit | 982a5b448f5ba99033911cdcaeebeeb8c2ed81fa (patch) | |
tree | 43206c30e60d4b2bd65ead978d1d72de882e7e76 /api/grpc_server.go | |
parent | c8bb5752f6a08eb5d1aac9fd4d58571cf9d8e2f4 (diff) |
zebra: add grpc api
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r-- | api/grpc_server.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index 3ddc43b2..e429e456 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -688,6 +688,21 @@ func (s *Server) GetRoa(ctx context.Context, arg *GetRoaRequest) (*GetRoaRespons return &GetRoaResponse{Roas: l}, nil } +func (s *Server) EnableZebra(ctx context.Context, arg *EnableZebraRequest) (*EnableZebraResponse, error) { + l := []config.InstallProtocolType{} + for _, p := range arg.RouteTypes { + if err := config.InstallProtocolType(p).Validate(); err != nil { + return &EnableZebraResponse{}, err + } else { + l = append(l, config.InstallProtocolType(p)) + } + } + return &EnableZebraResponse{}, s.bgpServer.StartZebraClient(&config.ZebraConfig{ + Url: arg.Url, + RedistributeRouteTypeList: l, + }) +} + func (s *Server) GetVrf(ctx context.Context, arg *GetVrfRequest) (*GetVrfResponse, error) { toApi := func(v *table.Vrf) *Vrf { f := func(rts []bgp.ExtendedCommunityInterface) [][]byte { |