VOL-3052 Onu Software preliminary upgrade extensions with internal test, version 1.2.5-dev171
Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: I23ee1a14af635def33b565444f1a1f81370a86a7
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index e129c6f..357219b 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -362,7 +362,7 @@
func (oo *OpenONUAC) Reboot_device(ctx context.Context, device *voltha.Device) error {
logger.Infow(ctx, "reboot-device", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
- go handler.rebootDevice(ctx, device)
+ go handler.rebootDevice(ctx, true, device) //reboot request with device checking
return nil
}
logger.Warnw(ctx, "no handler found for device-reboot", log.Fields{"device-id": device.Id})
@@ -455,16 +455,19 @@
//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, request)
- return request, err
+ if request != nil && (*request).Name != "" {
+ 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, request)
+ return request, err
+ }
+ // image already exists
+ logger.Debugw(ctx, "image already downloaded", log.Fields{"image-description": request})
+ return request, nil
}
- // image already exists
- logger.Debugw(ctx, "image already downloaded", log.Fields{"image-description": request})
- return request, nil
+ return request, errors.New("invalid image definition")
}
//Get_image_download_status unimplemented
@@ -483,18 +486,21 @@
// 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": request, "device-id": device.Id})
- err := handler.doOnuSwUpgrade(ctx, request, oo.pDownloadManager)
- return request, err
+ if request != nil && (*request).Name != "" {
+ 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": 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 request, fmt.Errorf(fmt.Sprintf("handler-not-found - device-id: %s", device.Id))
}
- logger.Warnw(ctx, "no handler found for image activation", log.Fields{"device-id": 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": request})
+ return request, 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))
+ return request, errors.New("invalid image definition")
}
//Revert_image_update unimplemented