(stream api.GoBgpService_AddPathStreamServer)
| 706 | } |
| 707 | |
| 708 | func (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 | |
| 736 | func (s *server) AddBmp(ctx context.Context, r *api.AddBmpRequest) (*api.AddBmpResponse, error) { |
| 737 | return &api.AddBmpResponse{}, s.bgpServer.AddBmp(ctx, r) |
nothing calls this directly
no test coverage detected