Further fix for image download and activate

Change-Id: Ida3e406ee4ff579f1d2b8ef5d9a6955c327c731a
diff --git a/go.sum b/go.sum
index 7c24f73..b7529f3 100644
--- a/go.sum
+++ b/go.sum
@@ -209,7 +209,6 @@
 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
 github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@@ -313,7 +312,6 @@
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20200221224223-e1da425f72fd h1:hHkvGJK23seRCflePJnVa9IMv8fsuavSCWKd11kDQFs=
 golang.org/x/tools v0.0.0-20200221224223-e1da425f72fd/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
 golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index 460c7c8..e129c6f 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -452,45 +452,49 @@
 	return errors.New("unImplemented")
 }
 
-//Download_image requests downloading some image according to indications as given in apRequest
-func (oo *OpenONUAC) Download_image(ctx context.Context, device *voltha.Device, apRequest *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	if !oo.pDownloadManager.imageExists(ctx, apRequest) {
-		logger.Debugw(ctx, "start image download", log.Fields{"image-description": apRequest})
+//Download_image requests downloading some image according to indications as given in request
+//The ImageDownload needs to be called `request`due to library reflection requirements
+func (oo *OpenONUAC) Download_image(ctx context.Context, device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+	if !oo.pDownloadManager.imageExists(ctx, request) {
+		logger.Debugw(ctx, "start image download", log.Fields{"image-description": request})
 		// Download_image is not supposed to be blocking, anyway let's call the DownloadManager still synchronously to detect 'fast' problems
 		// the download itself is later done in background
-		err := oo.pDownloadManager.startDownload(ctx, apRequest)
-		return apRequest, err
+		err := oo.pDownloadManager.startDownload(ctx, request)
+		return request, err
 	}
 	// image already exists
-	logger.Debugw(ctx, "image already downloaded", log.Fields{"image-description": apRequest})
-	return apRequest, nil
+	logger.Debugw(ctx, "image already downloaded", log.Fields{"image-description": request})
+	return request, nil
 }
 
 //Get_image_download_status unimplemented
+//The ImageDownload needs to be called `request`due to library reflection requirements
 func (oo *OpenONUAC) Get_image_download_status(ctx context.Context, device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	return nil, errors.New("unImplemented")
 }
 
 //Cancel_image_download unimplemented
+//The ImageDownload needs to be called `request`due to library reflection requirements
 func (oo *OpenONUAC) Cancel_image_download(ctx context.Context, device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	return nil, errors.New("unImplemented")
 }
 
 //Activate_image_update requests downloading some Onu Software image to the INU via OMCI
-//  according to indications as given in apRequest and on success activate the image on the ONU
-func (oo *OpenONUAC) Activate_image_update(ctx context.Context, device *voltha.Device, apRequest *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	if oo.pDownloadManager.imageLocallyDownloaded(ctx, apRequest) {
+//  according to indications as given in request and on success activate the image on the ONU
+//The ImageDownload needs to be called `request`due to library reflection requirements
+func (oo *OpenONUAC) Activate_image_update(ctx context.Context, device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+	if oo.pDownloadManager.imageLocallyDownloaded(ctx, request) {
 		if handler := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
 			logger.Debugw(ctx, "image download on omci requested", log.Fields{
-				"image-description": apRequest, "device-id": device.Id})
-			err := handler.doOnuSwUpgrade(ctx, apRequest, oo.pDownloadManager)
-			return apRequest, err
+				"image-description": request, "device-id": device.Id})
+			err := handler.doOnuSwUpgrade(ctx, request, oo.pDownloadManager)
+			return request, err
 		}
 		logger.Warnw(ctx, "no handler found for image activation", log.Fields{"device-id": device.Id})
-		return apRequest, fmt.Errorf(fmt.Sprintf("handler-not-found - device-id: %s", device.Id))
+		return request, fmt.Errorf(fmt.Sprintf("handler-not-found - device-id: %s", device.Id))
 	}
-	logger.Debugw(ctx, "image not yet downloaded on activate request", log.Fields{"image-description": apRequest})
-	return apRequest, fmt.Errorf(fmt.Sprintf("image-not-yet-downloaded - device-id: %s", device.Id))
+	logger.Debugw(ctx, "image not yet downloaded on activate request", log.Fields{"image-description": request})
+	return request, fmt.Errorf(fmt.Sprintf("image-not-yet-downloaded - device-id: %s", device.Id))
 }
 
 //Revert_image_update unimplemented