MCPcopy
hub / github.com/osrg/gobgp / AddPathStream

Method AddPathStream

pkg/server/grpc_server.go:708–734  ·  view source on GitHub ↗
(stream api.GoBgpService_AddPathStreamServer)

Source from the content-addressed store, hash-verified

706}
707
708func (s *server) AddPathStream(stream api.GoBgpService_AddPathStreamServer) error {
709 for {
710 arg, err := stream.Recv()
711 if err == io.EOF {
712 break
713 } else if err != nil {
714 return err
715 }
716
717 if arg.TableType != api.TableType_TABLE_TYPE_GLOBAL && arg.TableType != api.TableType_TABLE_TYPE_VRF {
718 return fmt.Errorf("unsupported resource: %s", arg.TableType)
719 }
720 pathList := make([]*table.Path, 0, len(arg.Paths))
721 for _, apiPath := range arg.Paths {
722 if path, err := api2Path(arg.TableType, apiPath, apiPath.IsWithdraw); err != nil {
723 return err
724 } else {
725 pathList = append(pathList, path)
726 }
727 }
728 err = s.bgpServer.addPathStream(arg.VrfId, pathList)
729 if err != nil {
730 return err
731 }
732 }
733 return stream.SendAndClose(&api.AddPathStreamResponse{})
734}
735
736func (s *server) AddBmp(ctx context.Context, r *api.AddBmpRequest) (*api.AddBmpResponse, error) {
737 return &api.AddBmpResponse{}, s.bgpServer.AddBmp(ctx, r)

Callers

nothing calls this directly

Calls 2

api2PathFunction · 0.85
addPathStreamMethod · 0.80

Tested by

no test coverage detected