Build baseline for release
Change-Id: I3183c17bfdf05143ff9b9bd0836082d9174d89ec
diff --git a/internal/pkg/swupg/adapter_download_manager.go b/internal/pkg/swupg/adapter_download_manager.go
index 951d6e3..4c6f291 100755
--- a/internal/pkg/swupg/adapter_download_manager.go
+++ b/internal/pkg/swupg/adapter_download_manager.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package swupg provides the utilities for onu sw upgrade
+// Package swupg provides the utilities for onu sw upgrade
package swupg
import (
@@ -43,14 +43,14 @@
// ### downloadToAdapter - end ####
-//AdapterDownloadManager structure holds information needed for downloading to and storing images within the adapter
+// AdapterDownloadManager structure holds information needed for downloading to and storing images within the adapter
type AdapterDownloadManager struct {
mutexDownloadImageDsc sync.RWMutex
downloadImageDscSlice []*voltha.ImageDownload
}
-//NewAdapterDownloadManager constructor returns a new instance of a AdapterDownloadManager
-//mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
+// NewAdapterDownloadManager constructor returns a new instance of a AdapterDownloadManager
+// mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
func NewAdapterDownloadManager(ctx context.Context) *AdapterDownloadManager {
logger.Debug(ctx, "init-AdapterDownloadManager")
var localDnldMgr AdapterDownloadManager
@@ -58,7 +58,7 @@
return &localDnldMgr
}
-//ImageExists returns true if the requested image already exists within the adapter
+// ImageExists returns true if the requested image already exists within the adapter
func (dm *AdapterDownloadManager) ImageExists(ctx context.Context, apImageDsc *voltha.ImageDownload) bool {
logger.Debugw(ctx, "checking on existence of the image", log.Fields{"image-name": (*apImageDsc).Name})
dm.mutexDownloadImageDsc.RLock()
@@ -74,7 +74,7 @@
return false
}
-//ImageLocallyDownloaded returns true if the requested image already exists within the adapter
+// ImageLocallyDownloaded returns true if the requested image already exists within the adapter
func (dm *AdapterDownloadManager) ImageLocallyDownloaded(ctx context.Context, apImageDsc *voltha.ImageDownload) bool {
logger.Debugw(ctx, "checking if image is fully downloaded", log.Fields{"image-name": (*apImageDsc).Name})
dm.mutexDownloadImageDsc.RLock()
@@ -96,7 +96,7 @@
return false
}
-//StartDownload returns true if the download of the requested image could be started
+// StartDownload returns true if the download of the requested image could be started
func (dm *AdapterDownloadManager) StartDownload(ctx context.Context, apImageDsc *voltha.ImageDownload) error {
if apImageDsc.LocalDir != "" {
logger.Infow(ctx, "image download-to-adapter requested", log.Fields{
@@ -119,7 +119,7 @@
return errors.New("could not start download: no valid local directory to write to")
}
-//downloadFile downloads the specified file from the given http location
+// downloadFile downloads the specified file from the given http location
func (dm *AdapterDownloadManager) downloadFile(ctx context.Context, aURLName string, aFilePath string, aFileName string) error {
// Get the data
logger.Infow(ctx, "downloading from http", log.Fields{"url": aURLName, "localPath": aFilePath})
@@ -237,7 +237,7 @@
}
}
-//getImageBufferLen returns the length of the specified file in bytes (file size)
+// getImageBufferLen returns the length of the specified file in bytes (file size)
func (dm *AdapterDownloadManager) getImageBufferLen(ctx context.Context, aFileName string,
aLocalPath string) (int64, error) {
//maybe we can also use FileSize from dm.downloadImageDscSlice - future option?
@@ -261,7 +261,7 @@
return stats.Size(), nil
}
-//getDownloadImageBuffer returns the content of the requested file as byte slice
+// getDownloadImageBuffer returns the content of the requested file as byte slice
func (dm *AdapterDownloadManager) getDownloadImageBuffer(ctx context.Context, aFileName string,
aLocalPath string) ([]byte, error) {
file, err := os.Open(filepath.Clean(aLocalPath + "/" + aFileName))
diff --git a/internal/pkg/swupg/common.go b/internal/pkg/swupg/common.go
index 06fceb4..8ec35a6 100755
--- a/internal/pkg/swupg/common.go
+++ b/internal/pkg/swupg/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package swupg provides the utilities for onu sw upgrade
+// Package swupg provides the utilities for onu sw upgrade
package swupg
import (
diff --git a/internal/pkg/swupg/file_download_manager.go b/internal/pkg/swupg/file_download_manager.go
index 6dd4886..05ffcf9 100755
--- a/internal/pkg/swupg/file_download_manager.go
+++ b/internal/pkg/swupg/file_download_manager.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package swupg provides the utilities for onu sw upgrade
+// Package swupg provides the utilities for onu sw upgrade
package swupg
import (
@@ -63,7 +63,7 @@
type requesterChannelMap map[chan<- bool]struct{} //using an empty structure map for easier (unique) element appending
-//FileDownloadManager structure holds information needed for downloading to and storing images within the adapter
+// FileDownloadManager structure holds information needed for downloading to and storing images within the adapter
type FileDownloadManager struct {
mutexFileState sync.RWMutex
mutexDownloadImageDsc sync.RWMutex
@@ -72,8 +72,8 @@
dlToAdapterTimeout time.Duration
}
-//NewFileDownloadManager constructor returns a new instance of a FileDownloadManager
-//mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
+// NewFileDownloadManager constructor returns a new instance of a FileDownloadManager
+// mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
func NewFileDownloadManager(ctx context.Context) *FileDownloadManager {
logger.Debug(ctx, "init-FileDownloadManager")
var localDnldMgr FileDownloadManager
@@ -83,7 +83,7 @@
return &localDnldMgr
}
-//SetDownloadTimeout configures the timeout used to supervice the download of the image to the adapter (assumed in seconds)
+// SetDownloadTimeout configures the timeout used to supervice the download of the image to the adapter (assumed in seconds)
func (dm *FileDownloadManager) SetDownloadTimeout(ctx context.Context, aDlTimeout time.Duration) {
dm.mutexDownloadImageDsc.Lock()
defer dm.mutexDownloadImageDsc.Unlock()
@@ -91,14 +91,14 @@
dm.dlToAdapterTimeout = aDlTimeout
}
-//GetDownloadTimeout delivers the timeout used to supervice the download of the image to the adapter (assumed in seconds)
+// GetDownloadTimeout delivers the timeout used to supervice the download of the image to the adapter (assumed in seconds)
func (dm *FileDownloadManager) GetDownloadTimeout(ctx context.Context) time.Duration {
dm.mutexDownloadImageDsc.RLock()
defer dm.mutexDownloadImageDsc.RUnlock()
return dm.dlToAdapterTimeout
}
-//StartDownload returns FileState and error code from download request for the given file name and URL
+// StartDownload returns FileState and error code from download request for the given file name and URL
func (dm *FileDownloadManager) StartDownload(ctx context.Context, aImageName string, aURLCommand string) (FileState, error) {
logger.Infow(ctx, "image download-to-adapter requested", log.Fields{
"image-name": aImageName, "url-command": aURLCommand})
@@ -140,7 +140,7 @@
return fileState, nil
}
-//GetImageBufferLen returns the length of the specified file in bytes (file size) - as detected after download
+// GetImageBufferLen returns the length of the specified file in bytes (file size) - as detected after download
func (dm *FileDownloadManager) GetImageBufferLen(ctx context.Context, aFileName string) (int64, error) {
dm.mutexDownloadImageDsc.RLock()
defer dm.mutexDownloadImageDsc.RUnlock()
@@ -153,9 +153,10 @@
return 0, fmt.Errorf("no downloaded image found: %s", aFileName)
}
-//GetDownloadImageBuffer returns the content of the requested file as byte slice
-//precondition: it is assumed that a check is done immediately before if the file was downloaded to adapter correctly from caller
-// straightforward approach is here to e.g. immediately call and verify GetImageBufferLen() before this
+// GetDownloadImageBuffer returns the content of the requested file as byte slice
+// precondition: it is assumed that a check is done immediately before if the file was downloaded to adapter correctly from caller
+//
+// straightforward approach is here to e.g. immediately call and verify GetImageBufferLen() before this
func (dm *FileDownloadManager) GetDownloadImageBuffer(ctx context.Context, aFileName string) ([]byte, error) {
file, err := os.Open(filepath.Clean(cDefaultLocalDir + "/" + aFileName))
if err != nil {
@@ -182,7 +183,7 @@
return bytes, err
}
-//RequestDownloadReady receives a channel that has to be used to inform the requester in case the concerned file is downloaded
+// RequestDownloadReady receives a channel that has to be used to inform the requester in case the concerned file is downloaded
func (dm *FileDownloadManager) RequestDownloadReady(ctx context.Context, aFileName string, aWaitChannel chan<- bool) {
//mutexDownloadImageDsc must already be locked here to avoid an update of the dnldImgReadyWaiting map
// just after returning false on imageLocallyDownloaded() (not found) and immediate handling of the
@@ -217,7 +218,7 @@
}
}
-//RemoveReadyRequest removes the specified channel from the requester(channel) map for the given file name
+// RemoveReadyRequest removes the specified channel from the requester(channel) map for the given file name
func (dm *FileDownloadManager) RemoveReadyRequest(ctx context.Context, aFileName string, aWaitChannel chan bool) {
dm.mutexDownloadImageDsc.Lock()
defer dm.mutexDownloadImageDsc.Unlock()
@@ -238,8 +239,8 @@
// FileDownloadManager private (unexported) methods -- start
-//imageExists returns current ImageState and if the requested image already exists within the adapter
-//precondition: at calling this method mutexDownloadImageDsc must already be at least RLocked by the caller
+// imageExists returns current ImageState and if the requested image already exists within the adapter
+// precondition: at calling this method mutexDownloadImageDsc must already be at least RLocked by the caller
func (dm *FileDownloadManager) imageExists(ctx context.Context, aImageName string, aURL string) (FileState, bool) {
logger.Debugw(ctx, "checking on existence of the image", log.Fields{"image-name": aImageName})
for _, dnldImgDsc := range dm.downloadImageDscSlice {
@@ -256,8 +257,9 @@
return CFileStateUnknown, false
}
-//imageLocallyDownloaded returns true if the requested image already exists within the adapter
-// requires mutexDownloadImageDsc to be locked (at least RLocked)
+// imageLocallyDownloaded returns true if the requested image already exists within the adapter
+//
+// requires mutexDownloadImageDsc to be locked (at least RLocked)
func (dm *FileDownloadManager) imageLocallyDownloaded(ctx context.Context, aImageName string) bool {
logger.Debugw(ctx, "checking if image is fully downloaded to adapter", log.Fields{"image-name": aImageName})
for _, dnldImgDsc := range dm.downloadImageDscSlice {
@@ -276,7 +278,7 @@
return false
}
-//updateDownloadCancel sets context cancel function to be used in case the download is to be aborted
+// updateDownloadCancel sets context cancel function to be used in case the download is to be aborted
func (dm *FileDownloadManager) updateDownloadCancel(ctx context.Context,
aImageName string, aCancelFn context.CancelFunc) {
dm.mutexDownloadImageDsc.Lock()
@@ -293,7 +295,7 @@
}
}
-//updateFileState sets the new active (downloaded) file state and informs possibly waiting requesters on this change
+// updateFileState sets the new active (downloaded) file state and informs possibly waiting requesters on this change
func (dm *FileDownloadManager) updateFileState(ctx context.Context, aImageName string, aFileSize int64) {
dm.mutexDownloadImageDsc.Lock()
defer dm.mutexDownloadImageDsc.Unlock()
@@ -321,7 +323,7 @@
}
}
-//downloadFile downloads the specified file from the given http location
+// downloadFile downloads the specified file from the given http location
func (dm *FileDownloadManager) downloadFile(ctx context.Context, aURLCommand string, aFilePath string, aFileName string) error {
// Get the data
logger.Infow(ctx, "downloading with URL", log.Fields{"url": aURLCommand, "localPath": aFilePath})
@@ -440,7 +442,7 @@
return nil
}
-//removeImage deletes the given image according to the Image name from filesystem and downloadImageDscSlice
+// removeImage deletes the given image according to the Image name from filesystem and downloadImageDscSlice
func (dm *FileDownloadManager) removeImage(ctx context.Context, aImageName string, aDelFs bool) {
logger.Debugw(ctx, "remove the image from Adapter", log.Fields{"image-name": aImageName, "del-fs": aDelFs})
dm.mutexDownloadImageDsc.RLock()
@@ -469,7 +471,7 @@
//image not found (by name)
}
-//CancelDownload stops the download and clears all entires concerning this aimageName
+// CancelDownload stops the download and clears all entires concerning this aimageName
func (dm *FileDownloadManager) CancelDownload(ctx context.Context, aImageName string) {
// for the moment that would only support to wait for the download end and remove the image then
// further reactions while still downloading can be considered with some effort, but does it make sense (synchronous load here!)
diff --git a/internal/pkg/swupg/omci_onu_upgrade.go b/internal/pkg/swupg/omci_onu_upgrade.go
index 5d4706a..64b5299 100755
--- a/internal/pkg/swupg/omci_onu_upgrade.go
+++ b/internal/pkg/swupg/omci_onu_upgrade.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package swupg provides the utilities for onu sw upgrade
+// Package swupg provides the utilities for onu sw upgrade
package swupg
import (
@@ -134,10 +134,10 @@
UpgradeStAbortingDL = "UpgradeStAbortingDL"
)
-//COnuUpgradeFsmIdleState - required definition for IdleState detection for activities on OMCI
+// COnuUpgradeFsmIdleState - required definition for IdleState detection for activities on OMCI
const COnuUpgradeFsmIdleState = UpgradeStWaitForCommit
-//OnuUpgradeFsm defines the structure for the state machine to config the PON ANI ports of ONU UNI ports via OMCI
+// OnuUpgradeFsm defines the structure for the state machine to config the PON ANI ports of ONU UNI ports via OMCI
type OnuUpgradeFsm struct {
pDeviceHandler cmn.IdeviceHandler
pDownloadManager *AdapterDownloadManager
@@ -194,8 +194,9 @@
omciDownloadSectionSize int64
}
-//NewOnuUpgradeFsm is the 'constructor' for the state machine to config the PON ANI ports
-// of ONU UNI ports via OMCI
+// NewOnuUpgradeFsm is the 'constructor' for the state machine to config the PON ANI ports
+//
+// of ONU UNI ports via OMCI
func NewOnuUpgradeFsm(ctx context.Context, apDeviceHandler cmn.IdeviceHandler,
apDevEntry cmn.IonuDeviceEntry, apOnuDB *devdb.OnuDeviceDB,
aRequestEvent cmn.OnuDeviceEvent, aName string, aCommChannel chan cmn.Message) *OnuUpgradeFsm {
@@ -315,8 +316,9 @@
return instFsm
}
-//SetDownloadParams configures the needed parameters for a specific download to the ONU
-// called from 'old' API Activate_image_update()
+// SetDownloadParams configures the needed parameters for a specific download to the ONU
+//
+// called from 'old' API Activate_image_update()
func (oFsm *OnuUpgradeFsm) SetDownloadParams(ctx context.Context, aInactiveImageID uint16,
apImageDsc *voltha.ImageDownload, apDownloadManager *AdapterDownloadManager) error {
pBaseFsm := oFsm.PAdaptFsm.PFsm
@@ -342,9 +344,10 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
}
-//SetDownloadParamsAfterDownload configures the needed parameters for a specific download to the ONU according to
-// updated API interface with R2.8: start download to ONU if the image is downloaded to the adapter
-// called from 'new' API Download_onu_image
+// SetDownloadParamsAfterDownload configures the needed parameters for a specific download to the ONU according to
+//
+// updated API interface with R2.8: start download to ONU if the image is downloaded to the adapter
+// called from 'new' API Download_onu_image
func (oFsm *OnuUpgradeFsm) SetDownloadParamsAfterDownload(ctx context.Context, aInactiveImageID uint16,
apImageRequest *voltha.DeviceImageDownloadRequest, apDownloadManager *FileDownloadManager,
aImageIdentifier string) error {
@@ -374,8 +377,9 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
}
-//SetActivationParamsRunning sets the activate and commit flags for a running download to the ONU according to adapters rpc call
-// called from 'new' API Activate_onu_image
+// SetActivationParamsRunning sets the activate and commit flags for a running download to the ONU according to adapters rpc call
+//
+// called from 'new' API Activate_onu_image
func (oFsm *OnuUpgradeFsm) SetActivationParamsRunning(ctx context.Context,
aImageIdentifier string, aCommit bool) error {
logger.Debugw(ctx, "OnuUpgradeFsm activate/commit parameter setting", log.Fields{
@@ -412,8 +416,9 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID))
}
-//SetActivationParamsStart starts upgrade processing with immediate activation
-// called from 'new' API Activate_onu_image
+// SetActivationParamsStart starts upgrade processing with immediate activation
+//
+// called from 'new' API Activate_onu_image
func (oFsm *OnuUpgradeFsm) SetActivationParamsStart(ctx context.Context, aImageVersion string, aInactiveImageID uint16, aCommit bool) error {
oFsm.mutexUpgradeParams.Lock()
var pBaseFsm *fsm.FSM = nil
@@ -441,8 +446,9 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
}
-//SetCommitmentParamsRunning sets the commit flag for a running download to the ONU according to adapters rpc call
-// called from 'new' API Commit_onu_image
+// SetCommitmentParamsRunning sets the commit flag for a running download to the ONU according to adapters rpc call
+//
+// called from 'new' API Commit_onu_image
func (oFsm *OnuUpgradeFsm) SetCommitmentParamsRunning(ctx context.Context,
aImageIdentifier string, aImageVersion string) error {
oFsm.mutexUpgradeParams.Lock()
@@ -477,8 +483,9 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID))
}
-//SetCommitmentParamsStart starts upgrade processing with immediate commitment
-// called from 'new' API Commit_onu_image
+// SetCommitmentParamsStart starts upgrade processing with immediate commitment
+//
+// called from 'new' API Commit_onu_image
func (oFsm *OnuUpgradeFsm) SetCommitmentParamsStart(ctx context.Context, aImageVersion string, aActiveImageID uint16) error {
oFsm.mutexUpgradeParams.Lock()
var pBaseFsm *fsm.FSM = nil
@@ -504,14 +511,14 @@
return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
}
-//GetCommitFlag delivers the commit flag that was configured here
+// GetCommitFlag delivers the commit flag that was configured here
func (oFsm *OnuUpgradeFsm) GetCommitFlag(ctx context.Context) bool {
oFsm.mutexUpgradeParams.RLock()
defer oFsm.mutexUpgradeParams.RUnlock()
return oFsm.commitImage
}
-//GetImageStates delivers the download/image states as per device proto buf definition
+// GetImageStates delivers the download/image states as per device proto buf definition
func (oFsm *OnuUpgradeFsm) GetImageStates(ctx context.Context,
aImageIdentifier string, aVersion string) *voltha.ImageState {
pImageState := &voltha.ImageState{}
@@ -531,7 +538,7 @@
return pImageState
}
-//SetImageStateActive sets the FSM internal volthaImageState to ImageState_IMAGE_ACTIVE
+// SetImageStateActive sets the FSM internal volthaImageState to ImageState_IMAGE_ACTIVE
func (oFsm *OnuUpgradeFsm) SetImageStateActive(ctx context.Context) {
oFsm.mutexUpgradeParams.Lock()
defer oFsm.mutexUpgradeParams.Unlock()
@@ -539,7 +546,7 @@
oFsm.volthaImageState = voltha.ImageState_IMAGE_ACTIVE
}
-//CancelProcessing ensures that suspended processing at waiting on some response is aborted and reset of FSM
+// CancelProcessing ensures that suspended processing at waiting on some response is aborted and reset of FSM
func (oFsm *OnuUpgradeFsm) CancelProcessing(ctx context.Context, abCompleteAbort bool,
aReason voltha.ImageState_ImageFailureReason) {
pAdaptFsm := oFsm.PAdaptFsm
@@ -625,7 +632,7 @@
go oFsm.processOmciUpgradeMessages(ctx)
}
-//enterWaitingAdapterDL state can only be reached with useAPIVersion43
+// enterWaitingAdapterDL state can only be reached with useAPIVersion43
func (oFsm *OnuUpgradeFsm) enterWaitingAdapterDL(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm waiting for adapter download", log.Fields{"in state": e.FSM.Current(),
"device-id": oFsm.deviceID})
@@ -734,8 +741,9 @@
go oFsm.runSwDlSectionWindow(ctx)
}
-//runSwDlSectionWindow runs a loop to send all DlSection frames of one window in background
-// may be aborted by parallel change of abortRequested
+// runSwDlSectionWindow runs a loop to send all DlSection frames of one window in background
+//
+// may be aborted by parallel change of abortRequested
func (oFsm *OnuUpgradeFsm) runSwDlSectionWindow(ctx context.Context) {
var windowAckRequest uint8 = 0
var bufferStartOffset uint32
@@ -868,8 +876,9 @@
go oFsm.delayAndSendEndSwDl(ctx)
}
-//delayAndSendEndSwDl ensures a delay before sending the EndSwDl request
-// may also be aborted by parallel channel reception on chAbortEndSwDl
+// delayAndSendEndSwDl ensures a delay before sending the EndSwDl request
+//
+// may also be aborted by parallel channel reception on chAbortEndSwDl
func (oFsm *OnuUpgradeFsm) delayAndSendEndSwDl(ctx context.Context) {
oFsm.mutexUpgradeParams.RLock()
if oFsm.delayEndSwDl {
@@ -1166,7 +1175,7 @@
go oFsm.waitOnAbortEndSwDlResponse(ctx)
}
-//abortingDlEvaluateResponse waits for a channel indication with decision to proceed the FSM processing
+// abortingDlEvaluateResponse waits for a channel indication with decision to proceed the FSM processing
func (oFsm *OnuUpgradeFsm) abortingDlEvaluateResponse(ctx context.Context,
pBaseFsm *cmn.AdapterFsm, aResponseResult tEndSwDlResponseResult) bool {
switch aResponseResult {
@@ -1788,8 +1797,9 @@
_ = oFsm.PAdaptFsm.PFsm.Event(UpgradeEvAbort)
} //verifyOnuSwStatusAfterDownload
-//abortOnOmciError aborts the upgrade processing with evAbort
-// asynchronous/synchronous based on parameter aAsync
+// abortOnOmciError aborts the upgrade processing with evAbort
+//
+// asynchronous/synchronous based on parameter aAsync
func (oFsm *OnuUpgradeFsm) abortOnOmciError(ctx context.Context, aAsync bool) {
oFsm.mutexUpgradeParams.Lock()
oFsm.conditionalCancelRequested = false //any conditional cancelRequest is superseded by this abortion
@@ -1816,8 +1826,9 @@
}
}
-//waitOnDownloadToAdapterReady state can only be reached with useAPIVersion43 (usage of pFileManager)
-// precondition: mutexIsAwaitingAdapterDlResponse is lockek on call
+// waitOnDownloadToAdapterReady state can only be reached with useAPIVersion43 (usage of pFileManager)
+//
+// precondition: mutexIsAwaitingAdapterDlResponse is lockek on call
func (oFsm *OnuUpgradeFsm) waitOnDownloadToAdapterReady(ctx context.Context, aSyncChannel chan<- struct{},
aWaitChannel chan bool) {
oFsm.mutexIsAwaitingAdapterDlResponse.Lock()
@@ -1878,7 +1889,7 @@
}
}
-//waitOnDownloadToOnuReady state can only be reached with useAPIVersion43 (usage of pFileManager)
+// waitOnDownloadToOnuReady state can only be reached with useAPIVersion43 (usage of pFileManager)
func (oFsm *OnuUpgradeFsm) waitOnDownloadToOnuReady(ctx context.Context, aWaitChannel chan bool) {
downloadToOnuTimeout := time.Duration(1+(oFsm.imageLength/0x400000)) * oFsm.downloadToOnuTimeout4MB
logger.Debugw(ctx, "OnuUpgradeFsm start download-to-ONU timer", log.Fields{"device-id": oFsm.deviceID,
@@ -1907,7 +1918,7 @@
}
}
-//waitOnAbortEndSwDlResponse waits for either abort/success or timeout of EndSwDownload (for abortion)
+// waitOnAbortEndSwDlResponse waits for either abort/success or timeout of EndSwDownload (for abortion)
func (oFsm *OnuUpgradeFsm) waitOnAbortEndSwDlResponse(ctx context.Context) {
logger.Debugw(ctx, "OnuUpgradeFsm start wait for EndSwDl response (abort)", log.Fields{"device-id": oFsm.deviceID})
select {
@@ -1936,7 +1947,7 @@
} //select
}
-//stateUpdateOnReset writes the download and/or image state on entering the reset state according to FSM internal indications
+// stateUpdateOnReset writes the download and/or image state on entering the reset state according to FSM internal indications
func (oFsm *OnuUpgradeFsm) stateUpdateOnReset(ctx context.Context) {
oFsm.mutexUpgradeParams.Lock()
defer oFsm.mutexUpgradeParams.Unlock()
diff --git a/internal/pkg/swupg/onu_image_status.go b/internal/pkg/swupg/onu_image_status.go
index e83a50d..4948ecb 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package swupg provides the utilities for onu sw upgrade
+// Package swupg provides the utilities for onu sw upgrade
package swupg
import (
@@ -31,7 +31,7 @@
"github.com/opencord/voltha-protos/v5/go/voltha"
)
-//OnuImageStatus implements methods to get status info of onu images
+// OnuImageStatus implements methods to get status info of onu images
type OnuImageStatus struct {
deviceID string
pDeviceHandler cmn.IdeviceHandler
@@ -48,7 +48,7 @@
const cResponse = "response: "
-//NewOnuImageStatus creates a new instance of OnuImageStatus
+// NewOnuImageStatus creates a new instance of OnuImageStatus
func NewOnuImageStatus(apDeviceHandler cmn.IdeviceHandler, apDevEntry cmn.IonuDeviceEntry) *OnuImageStatus {
return &OnuImageStatus{
deviceID: apDeviceHandler.GetDeviceID(),
@@ -297,7 +297,7 @@
return value
}
-//CancelProcessing ensures that interrupted processing is canceled while waiting for a response
+// CancelProcessing ensures that interrupted processing is canceled while waiting for a response
func (oo *OnuImageStatus) CancelProcessing(ctx context.Context) {
logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oo.deviceID})
if oo.isWaitingForResp() {