[VOL-4631] openonuAdapterGo - hardening: check ONU OMCI get responses for consistency
Change-Id: I6402b16408fd29db8d95f1607ff1af21da5907de
diff --git a/internal/pkg/swupg/onu_image_status.go b/internal/pkg/swupg/onu_image_status.go
index 02d92bc..ae798d0 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -207,11 +207,14 @@
if _, ok := oo.requestedAttributes[me.SoftwareImage_Version]; ok {
if msgObj.Result != me.Success {
- logger.Errorw(ctx, "processAttributesReceived retrieval of mandatory attributes failed",
+ logger.Errorw(ctx, "processAttributesReceived - retrieval of mandatory attributes not successful",
log.Fields{"device-id": oo.deviceID})
- return fmt.Errorf("process-image-status-response-error")
+ return fmt.Errorf("retrieve-mandatory-attributes-not-successful")
}
- oo.pDevEntry.HandleSwImageIndications(ctx, msgObj.EntityInstance, meAttributes)
+ if !oo.pDevEntry.HandleSwImageIndications(ctx, msgObj.EntityInstance, meAttributes) {
+ logger.Errorw(ctx, "processAttributesReceived - not all mandatory attributes present in SoftwareImage instance", log.Fields{"device-id": oo.deviceID})
+ return fmt.Errorf("not-all-mandatory-attributes-present")
+ }
}
for k := range oo.requestedAttributes {
switch k {