Correction of ONU SW upgrade EndSwDownload CRC insertion

Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: Idaa7178e49ccb13e309ae5ab1f5e620a72cd668c
diff --git a/VERSION b/VERSION
index c114700..f2ae0b4 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.11
+1.2.12
diff --git a/internal/pkg/onuadaptercore/omci_cc.go b/internal/pkg/onuadaptercore/omci_cc.go
index 58082a3..1c58250 100644
--- a/internal/pkg/onuadaptercore/omci_cc.go
+++ b/internal/pkg/onuadaptercore/omci_cc.go
@@ -561,15 +561,6 @@
 			proxy_device_id=self._proxy_address.device_id
 		)
 		*/
-		device, err := oo.coreProxy.GetDevice(ctx,
-			oo.pBaseDeviceHandler.deviceID, oo.deviceID) //parent, child
-		if err != nil || device == nil {
-			/*TODO: needs to handle error scenarios */
-			logger.Errorw(ctx, "Failed to fetch device", log.Fields{"err": err, "ParentId": oo.pBaseDeviceHandler.deviceID,
-				"ChildId": oo.deviceID})
-			return fmt.Errorf("failed to fetch device %s", oo.deviceID)
-		}
-
 		if omciTxRequest.withFramePrint {
 			logger.Debugw(ctx, "omci-message-to-send:", log.Fields{
 				"TxOmciMessage": hex.EncodeToString(omciTxRequest.txFrame),
diff --git a/internal/pkg/onuadaptercore/omci_onu_upgrade.go b/internal/pkg/onuadaptercore/omci_onu_upgrade.go
index 0158977..b44ce52 100644
--- a/internal/pkg/onuadaptercore/omci_onu_upgrade.go
+++ b/internal/pkg/onuadaptercore/omci_onu_upgrade.go
@@ -19,6 +19,7 @@
 
 import (
 	"context"
+	"encoding/binary"
 	"fmt"
 	"strconv"
 	"time"
@@ -38,10 +39,11 @@
 	cOmciDownloadSectionSize     = 31 //in bytes
 	cOmciDownloadWindowSizeLimit = 31 //in sections for window offset (windowSize(32)-1)
 	//cOmciDownloadWindowRetryMax  = 2    // max attempts for a specific window
-	cOmciSectionInterleaveMilliseconds = 100 //DownloadSection interleave time in milliseconds
-	cOmciEndSwDlDelaySeconds           = 1   //End Software Download delay after last section (may be also configurable?)
-	cWaitCountEndSwDl                  = 6   //maximum number of EndSwDl requests
-	cWaitDelayEndSwDlSeconds           = 10  //duration, how long is waited before next request on EndSwDl
+	//cOmciSectionInterleaveMilliseconds = 100 //DownloadSection interleave time in milliseconds
+	cOmciSectionInterleaveMilliseconds = 0  //DownloadSection interleave time in milliseconds
+	cOmciEndSwDlDelaySeconds           = 1  //End Software Download delay after last section (may be also configurable?)
+	cWaitCountEndSwDl                  = 6  //maximum number of EndSwDl requests
+	cWaitDelayEndSwDlSeconds           = 10 //duration, how long is waited before next request on EndSwDl
 	//cOmciDownloadCompleteTimeout = 5400 //in s for the complete timeout (may be better scale to image size/ noOfWindows)
 )
 
@@ -721,8 +723,13 @@
 						_ = oFsm.pAdaptFsm.pFsm.Event(upgradeEvAbort)
 						return
 					}
-					oFsm.delayEndSwDl = true                                                      //ensure a delay for the EndSwDl message
-					oFsm.imageCRC = crc32a.Checksum(oFsm.imageBuffer[:int(oFsm.origImageLength)]) //store internal for multiple usage
+					oFsm.delayEndSwDl = true                                                  //ensure a delay for the EndSwDl message
+					imageCRC := crc32a.Checksum(oFsm.imageBuffer[:int(oFsm.origImageLength)]) //store internal for multiple usage
+					//revert the retrieved CRC Byte Order (seems not to deliver NetworkByteOrder)
+					var byteSlice []byte = make([]byte, 4)
+					binary.LittleEndian.PutUint32(byteSlice, uint32(imageCRC))
+					oFsm.imageCRC = binary.BigEndian.Uint32(byteSlice)
+
 					_ = oFsm.pAdaptFsm.pFsm.Event(upgradeEvEndSwDownload)
 					return
 				}