diff options
Diffstat (limited to 'pkg/server/grpc_server.go')
-rw-r--r-- | pkg/server/grpc_server.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 1ae58055..b0cae8d3 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -102,6 +102,18 @@ func (s *server) serve() error { return nil } +func (s *server) ListDynamicNeighbor(r *api.ListDynamicNeighborRequest, stream api.GobgpApi_ListDynamicNeighborServer) error { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + fn := func(dn *api.DynamicNeighbor) { + if err := stream.Send(&api.ListDynamicNeighborResponse{DynamicNeighbor: dn}); err != nil { + cancel() + return + } + } + return s.bgpServer.ListDynamicNeighbor(ctx, r, fn) +} + func (s *server) ListPeerGroup(r *api.ListPeerGroupRequest, stream api.GobgpApi_ListPeerGroupServer) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -861,6 +873,10 @@ func (s *server) AddDynamicNeighbor(ctx context.Context, r *api.AddDynamicNeighb return &empty.Empty{}, s.bgpServer.AddDynamicNeighbor(ctx, r) } +func (s *server) DeleteDynamicNeighbor(ctx context.Context, r *api.DeleteDynamicNeighborRequest) (*empty.Empty, error) { + return &empty.Empty{}, s.bgpServer.DeleteDynamicNeighbor(ctx, r) +} + func newPrefixFromApiStruct(a *api.Prefix) (*table.Prefix, error) { _, prefix, err := net.ParseCIDR(a.IpPrefix) if err != nil { |