[VOL-3756] openonu-adapter-go: Allow reception of OMCI messages via inter-adapter messageType 'OmciResponse' and smaller changes for OnuSwUpgrade preparation
Change-Id: I7392360cd95f07bd6de5b6c4f3decb7a7d878fa2
diff --git a/VERSION b/VERSION
index e80532c..a9fe6f7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.0-dev157
+1.1.0-dev158
diff --git a/internal/pkg/onuadaptercore/adapter_download_manager.go b/internal/pkg/onuadaptercore/adapter_download_manager.go
index 660c1fe..cf3718e 100644
--- a/internal/pkg/onuadaptercore/adapter_download_manager.go
+++ b/internal/pkg/onuadaptercore/adapter_download_manager.go
@@ -19,7 +19,7 @@
import (
"context"
- "errors"
+ //"errors"
"sync"
//"time"
@@ -71,7 +71,9 @@
//startDownload returns true if the download of the requested image could be started
func (dm *adapterDownloadManager) startDownload(ctx context.Context, apImageDsc *voltha.ImageDownload) error {
- logger.Debugw(ctx, "image download requested", log.Fields{"image-name": apImageDsc.Name})
- //so far just return error
- return errors.New("could not start downloading")
+ logger.Warnw(ctx, "image download requested - but not yet processed", log.Fields{"image-name": apImageDsc.Name})
+ //return success to comfort the core processing during integration
+ return nil
+ // TODO!!: also verify error response behavior
+ //return fmt.Errorf("onuSwUpgrade not yet implemented")
}
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 758bf9e..64e8f24 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -299,7 +299,7 @@
}
-func (dh *deviceHandler) processInterAdapterOMCIReqMessage(ctx context.Context, msg *ic.InterAdapterMessage) error {
+func (dh *deviceHandler) processInterAdapterOMCIReceiveMessage(ctx context.Context, msg *ic.InterAdapterMessage) error {
msgBody := msg.GetBody()
omciMsg := &ic.InterAdapterOmciMessage{}
if err := ptypes.UnmarshalAny(msgBody, omciMsg); err != nil {
@@ -546,9 +546,10 @@
switch msgType {
// case ic.InterAdapterMessageType_ONU_IND_REQUEST: was handled by OpenONUAC already - see comments there
- case ic.InterAdapterMessageType_OMCI_REQUEST:
+ //OMCI_RESPONSE also accepted acc. to VOL-3756 (OMCI_REQUEST request was legacy code)
+ case ic.InterAdapterMessageType_OMCI_RESPONSE, ic.InterAdapterMessageType_OMCI_REQUEST:
{
- return dh.processInterAdapterOMCIReqMessage(ctx, msg)
+ return dh.processInterAdapterOMCIReceiveMessage(ctx, msg)
}
case ic.InterAdapterMessageType_TECH_PROFILE_DOWNLOAD_REQUEST:
{
@@ -958,7 +959,10 @@
func (dh *deviceHandler) doOnuSwUpgrade(ctx context.Context, apImageDsc *voltha.ImageDownload) error {
logger.Warnw(ctx, "onuSwUpgrade not yet implemented in deviceHandler", log.Fields{
"device-id": dh.deviceID, "image-name": (*apImageDsc).Name})
- return fmt.Errorf("onuSwUpgrade not yet implemented in deviceHandler: %s", dh.deviceID)
+ //return success to comfort the core processing during integration
+ return nil
+ // TODO!!: also verify error response behavior
+ //return fmt.Errorf("onuSwUpgrade not yet implemented in deviceHandler: %s", dh.deviceID)
}
// deviceHandler methods that implement the adapters interface requests## end #########
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index c75dc97..6ab0f78 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -449,7 +449,7 @@
return errors.New("unImplemented")
}
-//Download_image according to download image indications as given in apRequest
+//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})
@@ -459,6 +459,7 @@
return apRequest, err
}
// image already exists
+ logger.Debugw(ctx, "image already downloaded", log.Fields{"image-description": apRequest})
return apRequest, nil
}
@@ -472,14 +473,21 @@
return nil, errors.New("unImplemented")
}
-//Activate_image_update 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 handler := oo.getDeviceHandler(ctx, device.Id, false); handler != nil {
- err := handler.doOnuSwUpgrade(ctx, apRequest)
- return apRequest, err
+ if oo.pDownloadManager.imageExists(ctx, apRequest) {
+ 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)
+ return apRequest, 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))
}
- logger.Warnw(ctx, "no handler found for Onu image activation", log.Fields{"device-id": device.Id})
- return apRequest, fmt.Errorf(fmt.Sprintf("handler-not-found-%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))
}
//Revert_image_update unimplemented