[VOL-5374] go version upgrade to 1.23.1 and few other package versions upgrade
Signed-off-by: akashreddyk <akash.kankanala@radisys.com>
Change-Id: I50531e8febdc00b335ebbe5a4b1099fc3bf6d5b4
diff --git a/internal/pkg/almgr/alarm_manager.go b/internal/pkg/almgr/alarm_manager.go
index 64a52ec..13a3bef 100755
--- a/internal/pkg/almgr/alarm_manager.go
+++ b/internal/pkg/almgr/alarm_manager.go
@@ -90,36 +90,36 @@
}
type onuDeviceEvent struct {
EventName string
+ EventDescription string
EventCategory eventif.EventCategory
EventSubCategory eventif.EventSubCategory
- EventDescription string
}
// OnuAlarmManager holds alarm manager related data
type OnuAlarmManager struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pOnuDeviceEntry cmn.IonuDeviceEntry
eventProxy eventif.EventProxy
StopProcessingOmciMessages chan bool
eventChannel chan cmn.Message
- onuAlarmManagerLock sync.RWMutex
- processMessage bool
activeAlarms alarms
alarmBitMapDB alarmBitMapDB
onuEventsList map[onuDevice]onuDeviceEvent
- lastAlarmSequence uint8
AlarmSyncFsm *cmn.AdapterFsm
oltDbCopy alarmBitMapDB
onuDBCopy alarmBitMapDB
+ StopAlarmAuditTimer chan struct{}
+ AsyncAlarmsCommChan chan struct{}
+ deviceID string
bufferedNotifications []*omci.AlarmNotificationMsg
+ onuAlarmManagerLock sync.RWMutex
+ onuAlarmRequestLock sync.RWMutex
alarmUploadSeqNo uint16
alarmUploadNoOfCmdsOrMEs uint16
- StopAlarmAuditTimer chan struct{}
+ processMessage bool
+ lastAlarmSequence uint8
isExtendedOmci bool
- AsyncAlarmsCommChan chan struct{}
isAsyncAlarmRequest bool
- onuAlarmRequestLock sync.RWMutex
}
// NewAlarmManager - TODO: add comment
@@ -752,6 +752,7 @@
raisedTimestamp)
}
+//nolint:unparam
func (am *OnuAlarmManager) isAlarmDBDiffPresent(ctx context.Context) bool {
return !reflect.DeepEqual(am.onuDBCopy, am.oltDbCopy)
}
@@ -785,6 +786,8 @@
}
// getDeviceEventData returns the event data for a device
+//
+//nolint:unparam
func (am *OnuAlarmManager) getDeviceEventData(ctx context.Context, classID me.ClassID, alarmNo uint8) (onuDeviceEvent, error) {
if onuEventDetails, ok := am.onuEventsList[onuDevice{classID: classID, alarmno: alarmNo}]; ok {
return onuEventDetails, nil
diff --git a/internal/pkg/avcfg/omci_ani_config.go b/internal/pkg/avcfg/omci_ani_config.go
index b58d772..e438a71 100755
--- a/internal/pkg/avcfg/omci_ani_config.go
+++ b/internal/pkg/avcfg/omci_ani_config.go
@@ -112,51 +112,51 @@
const CAniFsmIdleState = aniStConfigDone
type ponAniGemPortAttribs struct {
+ qosPolicy string
+ pbitString string
+ staticACL string
+ dynamicACL string
gemPortID uint16
upQueueID uint16
downQueueID uint16
- direction uint8
- qosPolicy string
- weight uint8
- pbitString string
- isMulticast bool
multicastGemID uint16
- staticACL string
- dynamicACL string
+ direction uint8
+ weight uint8
+ isMulticast bool
}
// UniPonAniConfigFsm defines the structure for the state machine to config the PON ANI ports of ONU UNI ports via OMCI
type UniPonAniConfigFsm struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pOnuDeviceEntry cmn.IonuDeviceEntry
pOmciCC *cmn.OmciCC
pOnuUniPort *cmn.OnuUniPort
pUniTechProf *OnuUniTechProf
pOnuDB *devdb.OnuDeviceDB
- techProfileID uint8
- techProfileType string
- uniTpKey uniTP
- requestEvent cmn.OnuDeviceEvent
- mutexIsAwaitingResponse sync.RWMutex
- isCanceled bool
- isAwaitingResponse bool
omciMIdsResponseReceived chan bool //separate channel needed for checking multiInstance OMCI message responses
PAdaptFsm *cmn.AdapterFsm
chSuccess chan<- uint8
- procStep uint8
+ pLastTxMeInstance *me.ManagedEntity
+ waitFlowDeleteChannel chan bool
+ deviceID string
+ techProfileType string
+ gemPortAttribsSlice []ponAniGemPortAttribs
+ requestEvent cmn.OnuDeviceEvent
+ mutexIsAwaitingResponse sync.RWMutex
mutexChanSet sync.RWMutex
- chanSet bool
+ mutexPLastTxMeInstance sync.RWMutex
mapperSP0ID uint16
macBPCD0ID uint16
tcont0ID uint16
alloc0ID uint16
- gemPortAttribsSlice []ponAniGemPortAttribs
- mutexPLastTxMeInstance sync.RWMutex
- pLastTxMeInstance *me.ManagedEntity
+ uniTpKey uniTP
+ techProfileID uint8
+ isCanceled bool
+ isAwaitingResponse bool
+ procStep uint8
+ chanSet bool
requestEventOffset uint8 //used to indicate ConfigDone or Removed using successor (enum)
isWaitingForFlowDelete bool
- waitFlowDeleteChannel chan bool
tcontSetBefore bool
}
@@ -488,6 +488,7 @@
}
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterConfigStartingState(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm start", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
@@ -522,6 +523,7 @@
}
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterCreatingDot1PMapper(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "UniPonAniConfigFsm Tx Create::Dot1PMapper", log.Fields{
"EntitytId": strconv.FormatInt(int64(oFsm.mapperSP0ID), 16),
@@ -552,6 +554,7 @@
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterCreatingMBPCD(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "Creating Tx MAC Bridge Port Config Data", log.Fields{
"EntitytId": strconv.FormatInt(int64(oFsm.macBPCD0ID), 16),
@@ -592,6 +595,7 @@
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterSettingTconts(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "Tx Setting Tcont ", log.Fields{
"EntitytId": strconv.FormatInt(int64(oFsm.tcont0ID), 16),
@@ -638,12 +642,14 @@
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterCreatingGemNCTPs(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm - start creating GemNWCtp loop", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
go oFsm.performCreatingGemNCTPs(ctx)
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterCreatingGemIWs(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm - start creating GemIwTP loop", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
@@ -807,6 +813,7 @@
//the FSM is left active in this state as long as no specific reset or remove is requested from outside
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterRemovingGemIW(ctx context.Context, e *fsm.Event) {
// no need to protect access to oFsm.waitFlowDeleteChannel, only used in synchronized state entries
// or CancelProcessing() that uses separate isWaitingForFlowDelete to write to the channel
@@ -876,6 +883,7 @@
oFsm.pOnuDB.DeleteMe(me.GemInterworkingTerminationPointClassID, loGemPortID)
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterWaitingFlowRem(ctx context.Context, e *fsm.Event) {
oFsm.mutexIsAwaitingResponse.Lock()
oFsm.isWaitingForFlowDelete = true
@@ -946,6 +954,7 @@
}
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterRemovingGemNCTP(ctx context.Context, e *fsm.Event) {
oFsm.pUniTechProf.mutexTPState.RLock()
loGemPortID := (*(oFsm.pUniTechProf.mapRemoveGemEntry[oFsm.uniTpKey])).gemPortID
@@ -981,6 +990,8 @@
OnuMetricsManager.RemoveGemPortForPerfMonitoring(ctx, loGemPortID)
}
}
+
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterRemovingTD(ctx context.Context, e *fsm.Event) {
oFsm.pUniTechProf.mutexTPState.RLock()
loGemPortID := (*(oFsm.pUniTechProf.mapRemoveGemEntry[oFsm.uniTpKey])).gemPortID
@@ -1012,6 +1023,7 @@
oFsm.mutexPLastTxMeInstance.Unlock()
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterResettingTcont(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm - start resetting the TCont", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
@@ -1047,6 +1059,7 @@
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterRemoving1pMapper(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm - start deleting the .1pMapper", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
@@ -1105,6 +1118,7 @@
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterRemovingAniBPCD(ctx context.Context, e *fsm.Event) {
logger.Info(ctx, "UniPonAniConfigFsm - start deleting the ANI MBCD", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
@@ -1198,6 +1212,7 @@
}
}
+//nolint:unparam
func (oFsm *UniPonAniConfigFsm) enterDisabledState(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "UniPonAniConfigFsm enters disabled state", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
diff --git a/internal/pkg/avcfg/omci_vlan_config.go b/internal/pkg/avcfg/omci_vlan_config.go
index 9eb4c10..5b0772d 100755
--- a/internal/pkg/avcfg/omci_vlan_config.go
+++ b/internal/pkg/avcfg/omci_vlan_config.go
@@ -136,50 +136,52 @@
const CVlanFsmConfiguredState = VlanStConfigDone // state that indicates that at least some valid user related VLAN configuration should exist
type uniRemoveVlanFlowParams struct {
- isSuspendedOnAdd bool
removeChannel chan bool
+ respChan *chan error
cookie uint64 //just the last cookie valid for removal
vlanRuleParams cmn.UniVlanRuleParams
- respChan *chan error
+ isSuspendedOnAdd bool
}
// UniVlanConfigFsm defines the structure for the state machine for configuration of the VLAN related setting via OMCI
//
// builds upon 'VLAN rules' that are derived from multiple flows
+//
+//nolint:govet
type UniVlanConfigFsm struct {
- pDeviceHandler cmn.IdeviceHandler
- pOnuDeviceEntry cmn.IonuDeviceEntry
- deviceID string
- pOmciCC *cmn.OmciCC
- pOnuUniPort *cmn.OnuUniPort
- pUniTechProf *OnuUniTechProf
- pOnuDB *devdb.OnuDeviceDB
- requestEvent cmn.OnuDeviceEvent
- omciMIdsResponseReceived chan bool //seperate channel needed for checking multiInstance OMCI message responses
- PAdaptFsm *cmn.AdapterFsm
+ actualUniFlowParam cmn.UniVlanFlowParams
+ pDeviceHandler cmn.IdeviceHandler
+ pOnuDeviceEntry cmn.IonuDeviceEntry
+ pOmciCC *cmn.OmciCC
+ pOnuUniPort *cmn.OnuUniPort
+ pUniTechProf *OnuUniTechProf
+ pOnuDB *devdb.OnuDeviceDB
+ omciMIdsResponseReceived chan bool //seperate channel needed for checking multiInstance OMCI message responses
+ PAdaptFsm *cmn.AdapterFsm
+ chCookieDeleted chan bool //channel to indicate that a specific cookie (related to the active rule) was deleted
+ pLastTxMeInstance *me.ManagedEntity
+ flowDeleteChannel chan<- bool
+ deviceID string
+ uniVlanFlowParamsSlice []cmn.UniVlanFlowParams
+ uniRemoveFlowsSlice []uniRemoveVlanFlowParams
+ requestEvent cmn.OnuDeviceEvent
+ //cookie value that indicates that a rule to add is delayed by waiting for deletion of some other existing rule with the same cookie
+ delayNewRuleCookie uint64
+ mutexIsAwaitingResponse sync.RWMutex
+ mutexFlowParams sync.RWMutex
+ mutexPLastTxMeInstance sync.RWMutex
+ vlanFilterList [cVtfdTableSize]uint16
+ evtocdID uint16
acceptIncrementalEvtoOption bool
isCanceled bool
isAwaitingResponse bool
- mutexIsAwaitingResponse sync.RWMutex
- mutexFlowParams sync.RWMutex
- chCookieDeleted chan bool //channel to indicate that a specific cookie (related to the active rule) was deleted
- actualUniFlowParam cmn.UniVlanFlowParams
- uniVlanFlowParamsSlice []cmn.UniVlanFlowParams
- uniRemoveFlowsSlice []uniRemoveVlanFlowParams
NumUniFlows uint8 // expected number of flows should be less than 12
ConfiguredUniFlow uint8
numRemoveFlows uint8
numVlanFilterEntries uint8
- vlanFilterList [cVtfdTableSize]uint16
- evtocdID uint16
- mutexPLastTxMeInstance sync.RWMutex
- pLastTxMeInstance *me.ManagedEntity
requestEventOffset uint8
TpIDWaitingFor uint8
signalOnFlowDelete bool
- flowDeleteChannel chan<- bool
- //cookie value that indicates that a rule to add is delayed by waiting for deletion of some other existing rule with the same cookie
- delayNewRuleCookie uint64
// Used to indicate if the FSM is for a reconciling flow and if it's the last flow to be reconciled
// thus notification needs to be sent on chan.
lastFlowToReconcile bool
@@ -463,7 +465,7 @@
}
pRemoveParams := &oFsm.uniRemoveFlowsSlice[flow] //wants to modify the uniRemoveFlowsSlice element directly!
oFsm.mutexFlowParams.RUnlock()
- if err := oFsm.suspendAddRule(ctx, pRemoveParams); err != nil {
+ if err = oFsm.suspendAddRule(ctx, pRemoveParams); err != nil {
logger.Errorw(ctx, "UniVlanConfigFsm suspension on add aborted - abort complete add-request", log.Fields{
"device-id": oFsm.deviceID, "cookie": removeUniFlowParams.cookie})
err = fmt.Errorf("abort UniVlanConfigFsm suspension on add %s", oFsm.deviceID)
@@ -1254,6 +1256,7 @@
}
}
+//nolint:unparam
func (oFsm *UniVlanConfigFsm) enterConfigEvtocd(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "UniVlanConfigFsm - start config EVTOCD loop", log.Fields{
"device-id": oFsm.deviceID})
@@ -1829,6 +1832,7 @@
oFsm.pushReponseOnFlowResponseChannel(ctx, flowRespChan, nil)
}
+//nolint:unparam
func (oFsm *UniVlanConfigFsm) enterResetting(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "UniVlanConfigFsm resetting", log.Fields{"device-id": oFsm.deviceID})
@@ -1930,6 +1934,7 @@
log.Fields{"device-id": oFsm.deviceID})
}
+//nolint:unparam
func (oFsm *UniVlanConfigFsm) enterDisabled(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "UniVlanConfigFsm enters disabled state", log.Fields{"device-id": oFsm.deviceID})
@@ -2641,7 +2646,7 @@
// this defines VID translation scenario: dobletagged-doubletagged (if not transparent)
logger.Debugw(ctx, "UniVlanConfigFsm Tx Set::EVTOCD clear double tagged rule", log.Fields{
"device-id": oFsm.deviceID, "match-vlan": aRuleParams.MatchVid, "innerCvlan": aRuleParams.InnerCvlan})
- sliceEvtocdRule := make([]uint8, 16)
+ sliceEvtocdRule = make([]uint8, 16)
// fill vlan tagging operation table bit fields using network=bigEndian order and using slice offset 0 as highest 'word'
binary.BigEndian.PutUint32(sliceEvtocdRule[cFilterOuterOffset:],
cPrioIgnoreTag<<cFilterPrioOffset| // Not an outer-tag rule
diff --git a/internal/pkg/avcfg/onu_uni_tp.go b/internal/pkg/avcfg/onu_uni_tp.go
index 4f51b1a..d3492a5 100755
--- a/internal/pkg/avcfg/onu_uni_tp.go
+++ b/internal/pkg/avcfg/onu_uni_tp.go
@@ -67,29 +67,29 @@
schedPolicy uint8
}
type gemPortParamStruct struct {
- //ponOmciCC bool
- gemPortID uint16
- direction uint8
- gemPortEncState uint8
- prioQueueIndex uint8
- pbitString string
- discardPolicy string
+ pbitString string
+ discardPolicy string
//could also be a queue specific parameter, not used that way here
//maxQueueSize uint16
queueSchedPolicy string
- queueWeight uint8
- removeGemID uint16
- isMulticast bool
+ staticACL string
+ dynamicACL string
+ //ponOmciCC bool
+ gemPortID uint16
+ removeGemID uint16
//TODO check if this has any value/difference from gemPortId
multicastGemPortID uint16
- staticACL string
- dynamicACL string
+ direction uint8
+ gemPortEncState uint8
+ prioQueueIndex uint8
+ queueWeight uint8
+ isMulticast bool
}
// refers to one tcont and its properties and all assigned GemPorts and their properties
type tcontGemList struct {
- tcontParams tcontParamStruct
mapGemPortParams map[uint16]*gemPortParamStruct
+ tcontParams tcontParamStruct
}
// refers a unique combination of uniID and tpID for a given ONU.
@@ -100,19 +100,19 @@
// OnuUniTechProf structure holds information about the TechProfiles attached to Uni Ports of the ONU
type OnuUniTechProf struct {
- deviceID string
baseDeviceHandler cmn.IdeviceHandler
onuDevice cmn.IonuDeviceEntry
- tpProcMutex sync.RWMutex
chTpConfigProcessingStep chan uint8
mapUniTpIndication map[uniTP]*tTechProfileIndication //use pointer values to ease assignments to the map
mapPonAniConfig map[uniTP]*tcontGemList //per UNI: use pointer values to ease assignments to the map
PAniConfigFsm map[uniTP]*UniPonAniConfigFsm
procResult map[uniTP]error //error indication of processing
- mutexTPState sync.RWMutex
tpProfileExists map[uniTP]bool
tpProfileResetting map[uniTP]bool
mapRemoveGemEntry map[uniTP]*gemPortParamStruct //per UNI: pointer to GemEntry to be removed
+ deviceID string
+ tpProcMutex sync.RWMutex
+ mutexTPState sync.RWMutex
}
func (onuTP *OnuUniTechProf) multicastConfiguredForOtherUniTps(ctx context.Context, uniTpKey uniTP) bool {
@@ -384,7 +384,7 @@
//default start with 1Tcont profile, later perhaps extend to MultiTcontMultiGem
localMapGemPortParams := make(map[uint16]*gemPortParamStruct)
- onuTP.mapPonAniConfig[uniTPKey] = &tcontGemList{tcontParamStruct{}, localMapGemPortParams}
+ onuTP.mapPonAniConfig[uniTPKey] = &tcontGemList{tcontParams: tcontParamStruct{}, mapGemPortParams: localMapGemPortParams}
//note: the code is currently restricted to one TCcont per Onu (index [0])
//get the relevant values from the profile and store to mapPonAniConfig
@@ -1030,6 +1030,8 @@
}
// setProfileResetting sets/resets the indication, that a reset of the TechProfileConfig/Removal is ongoing
+//
+//nolint:unparam
func (onuTP *OnuUniTechProf) setProfileResetting(ctx context.Context, aUniID uint8, aTpID uint8, aState bool) {
uniTpKey := uniTP{uniID: aUniID, tpID: aTpID}
onuTP.mutexTPState.Lock()
diff --git a/internal/pkg/common/defines.go b/internal/pkg/common/defines.go
index c7ebf26..9ccb781 100755
--- a/internal/pkg/common/defines.go
+++ b/internal/pkg/common/defines.go
@@ -51,8 +51,8 @@
// Message - message type and data(OMCI)
type Message struct {
- Type MessageType
Data interface{}
+ Type MessageType
}
// TestMessageType - message data for various events
@@ -214,9 +214,9 @@
// SEntrySwImageIndication - TODO: add comment
type SEntrySwImageIndication struct {
- Valid bool
- EntityID uint16
Version string
+ EntityID uint16
+ Valid bool
IsCommitted uint8
}
@@ -231,7 +231,7 @@
///////////////////////////////////////////////////////////
-type activityDescr struct {
+type ActivityDescr struct {
DatabaseClass func(context.Context) error
//advertiseEvents bool
AuditInterval time.Duration
@@ -239,14 +239,14 @@
}
// OmciDeviceFsms - FSM event mapping to database class and time to wait between audits
-type OmciDeviceFsms map[string]activityDescr
+type OmciDeviceFsms map[string]ActivityDescr
// AdapterFsm - Adapter FSM details including channel, event and device
type AdapterFsm struct {
- fsmName string
- deviceID string
CommChan chan Message
PFsm *fsm.FSM
+ fsmName string
+ deviceID string
}
// CErrWaitAborted - AdapterFsm related error string
@@ -271,17 +271,17 @@
// OnuUniPort structure holds information about the ONU attached Uni Ports
type OnuUniPort struct {
- Enabled bool
+ PPort *voltha.Port
Name string
- PortNo uint32
- PortType UniPortType
OfpPortNo string
- UniID uint8
- MacBpNo uint8
- EntityID uint16
+ PortNo uint32
AdminState vc.AdminState_Types
OperState vc.OperStatus_Types
- PPort *voltha.Port
+ EntityID uint16
+ Enabled bool
+ PortType UniPortType
+ UniID uint8
+ MacBpNo uint8
}
// OnuUniPortMap - TODO: add comment
@@ -309,21 +309,21 @@
// UniVlanRuleParams - TODO: add comment
type UniVlanRuleParams struct {
- TpID uint8 `json:"tp_id"`
MatchVid uint32 `json:"match_vid"` //use uint32 types for allowing immediate bitshifting
MatchPcp uint32 `json:"match_pcp"`
TagsToRemove uint32 `json:"tags_to_remove"`
SetVid uint32 `json:"set_vid"`
SetPcp uint32 `json:"set_pcp"`
InnerCvlan uint16 `json:"inner_cvlan"`
+ TpID uint8 `json:"tp_id"`
}
// UniVlanFlowParams - TODO: add comment
type UniVlanFlowParams struct {
- CookieSlice []uint64 `json:"cookie_slice"`
- VlanRuleParams UniVlanRuleParams `json:"vlan_rule_params"`
Meter *ofp.OfpMeterConfig `json:"flow_meter"`
RespChan *chan error `json:"-"`
+ CookieSlice []uint64 `json:"cookie_slice"`
+ VlanRuleParams UniVlanRuleParams `json:"vlan_rule_params"`
}
///////////////////////////////////////////////////////////
diff --git a/internal/pkg/common/omci_cc.go b/internal/pkg/common/omci_cc.go
index 8763443..ab12ef7 100755
--- a/internal/pkg/common/omci_cc.go
+++ b/internal/pkg/common/omci_cc.go
@@ -84,20 +84,20 @@
// CallbackPair to be used for ReceiveCallback init
type CallbackPair struct {
- CbKey uint16
CbEntry CallbackPairEntry
+ CbKey uint16
}
// OmciTransferStructure - TODO: add comment
type OmciTransferStructure struct {
+ chSuccess chan bool
+ OnuSwWindow *ia.OmciMessages
+ cbPair CallbackPair
txFrame []byte
timeout int
retries int
highPrio bool
withFramePrint bool
- cbPair CallbackPair
- chSuccess chan bool
- OnuSwWindow *ia.OmciMessages
}
type txRxCounters struct {
@@ -109,40 +109,42 @@
// OmciCC structure holds information needed for OMCI communication (to/from OLT Adapter)
type OmciCC struct {
- enabled bool
pBaseDeviceHandler IdeviceHandler
pOnuDeviceEntry IonuDeviceEntry
pOnuAlarmManager IonuAlarmManager
- deviceID string
coreClient *vgrpc.Client
- supportExtMsg bool
- rxOmciFrameError tOmciReceiveError
+ lowPrioTxQueue *list.List
+ highPrioTxQueue *list.List
+ rxSchedulerMap map[uint16]CallbackPairEntry
+ monitoredRequests map[uint16]OmciTransferStructure
+ deviceID string
confFailMEs []me.ClassID
mutexConfFailMEs sync.RWMutex
mutexCounters sync.RWMutex
+ mutexMonReq sync.RWMutex
countersBase txRxCounters
countersExt txRxCounters
- txRetries uint32
- txTimeouts uint32
// OMCI params
- mutexTid sync.Mutex
+ mutexTid sync.Mutex
+ mutexHpTid sync.Mutex
+
+ mutexSendQueuedRequests sync.Mutex
+ mutexLowPrioTxQueue sync.Mutex
+ mutexHighPrioTxQueue sync.Mutex
+ mutexRxSchedMap sync.Mutex
+ txRetries uint32
+ txTimeouts uint32
+
tid uint16
- mutexHpTid sync.Mutex
hpTid uint16
UploadSequNo uint16
UploadNoOfCmds uint16
- mutexSendQueuedRequests sync.Mutex
- mutexLowPrioTxQueue sync.Mutex
- lowPrioTxQueue *list.List
- mutexHighPrioTxQueue sync.Mutex
- highPrioTxQueue *list.List
- mutexRxSchedMap sync.Mutex
- rxSchedulerMap map[uint16]CallbackPairEntry
- mutexMonReq sync.RWMutex
- monitoredRequests map[uint16]OmciTransferStructure
+ enabled bool
+ supportExtMsg bool
+ rxOmciFrameError tOmciReceiveError
}
var responsesWithMibDataSync = []omci.MessageType{
@@ -432,7 +434,9 @@
}
//disadvantage of decoupling: error verification made difficult, but anyway the question is
// how to react on erroneous frame reception, maybe can simply be ignored
- go rxCallbackEntry.CbFunction(ctx, omciMsg, &packet, rxCallbackEntry.CbRespChannel)
+ go func() {
+ _ = rxCallbackEntry.CbFunction(ctx, omciMsg, &packet, rxCallbackEntry.CbRespChannel)
+ }()
isSuccessfulResponse, err := oo.isSuccessfulResponseWithMibDataSync(ctx, omciMsg, &packet)
if err != nil {
// qualified error logging already done in function above
@@ -593,14 +597,14 @@
printFrame := receiveCallbackPair.CbEntry.FramePrint //printFrame true means debug print of frame is requested
//just use a simple list for starting - might need some more effort, especially for multi source write access
omciTxRequest := OmciTransferStructure{
- txFrame,
- timeout,
- retry,
- highPrio,
- printFrame,
- receiveCallbackPair,
- nil,
- nil,
+ chSuccess: make(chan bool),
+ OnuSwWindow: nil,
+ cbPair: receiveCallbackPair,
+ txFrame: txFrame,
+ timeout: timeout,
+ retries: retry,
+ highPrio: highPrio,
+ withFramePrint: printFrame,
}
oo.mutexMonReq.Lock()
defer oo.mutexMonReq.Unlock()
@@ -5229,12 +5233,14 @@
oo.countersExt.rxAkFrames++
}
+//nolint:unparam
func (oo *OmciCC) increaseBaseTxNoArFramesBy(ctx context.Context, value uint32) {
oo.mutexCounters.Lock()
defer oo.mutexCounters.Unlock()
oo.countersBase.txNoArFrames += value
}
+//nolint:unparam
func (oo *OmciCC) increaseExtTxNoArFramesBy(ctx context.Context, value uint32) {
oo.mutexCounters.Lock()
defer oo.mutexCounters.Unlock()
diff --git a/internal/pkg/common/onu_uni_port.go b/internal/pkg/common/onu_uni_port.go
index b5ff606..8ef92fa 100755
--- a/internal/pkg/common/onu_uni_port.go
+++ b/internal/pkg/common/onu_uni_port.go
@@ -39,6 +39,7 @@
aPortType UniPortType) *OnuUniPort {
logger.Infow(ctx, "init-onuUniPort", log.Fields{"uniID": aUniID,
"portNo": aPortNo, "InstNo": aInstNo, "type": aPortType})
+ //nolint:govet
var OnuUniPort OnuUniPort
OnuUniPort.Enabled = false
OnuUniPort.Name = "uni-" + strconv.FormatUint(uint64(aPortNo), 10)
diff --git a/internal/pkg/common/utils.go b/internal/pkg/common/utils.go
index 5560ab6..f96a58a 100755
--- a/internal/pkg/common/utils.go
+++ b/internal/pkg/common/utils.go
@@ -93,7 +93,7 @@
// TrimStringFromMeOctet trim string out of Me octet
func TrimStringFromMeOctet(input interface{}) string {
ifBytes, _ := me.InterfaceToOctets(input)
- return fmt.Sprintf("%s", bytes.Trim(ifBytes, "\x00"))
+ return string(bytes.Trim(ifBytes, "\x00"))
}
////////////////////////////////////////////////////////////////////////
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 1f29999..5d90f92 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -35,15 +35,17 @@
InstanceID string
KafkaClusterAddress string // NOTE this is unused across the adapter
KVStoreType string
- KVStoreTimeout time.Duration
KVStoreAddress string
EventTopic string
LogLevel string
- OnuNumber int
- Banner bool
- DisplayVersionOnly bool
- AccIncrEvto bool
ProbeHost string
+ TraceAgentAddress string
+ OnuVendorIds string
+ AdapterEndpoint string
+ GrpcAddress string
+ CoreEndpoint string
+ KVStoreTimeout time.Duration
+ OnuNumber int
ProbePort int
LiveProbeInterval time.Duration
NotLiveProbeInterval time.Duration
@@ -54,12 +56,6 @@
TotalReplicas int
MaxTimeoutInterAdapterComm time.Duration
MaxTimeoutReconciling time.Duration
- TraceEnabled bool
- TraceAgentAddress string
- LogCorrelationEnabled bool
- OnuVendorIds string
- MetricsEnabled bool
- ExtendedOmciSupportEnabled bool
MibAuditInterval time.Duration
OmciTimeout time.Duration
AlarmAuditInterval time.Duration
@@ -68,13 +64,17 @@
UniPortMask int
MinBackoffRetryDelay time.Duration
MaxBackoffRetryDelay time.Duration
- AdapterEndpoint string
- GrpcAddress string
- CoreEndpoint string
RPCTimeout time.Duration
MaxConcurrentFlowsPerUni int
PerRPCRetryTimeout time.Duration
MaxRetries uint
+ Banner bool
+ DisplayVersionOnly bool
+ AccIncrEvto bool
+ TraceEnabled bool
+ LogCorrelationEnabled bool
+ MetricsEnabled bool
+ ExtendedOmciSupportEnabled bool
SkipOnuConfig bool
}
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 8daca76..bab59ef 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -142,27 +142,20 @@
// FlowCb is the flow control block containing flow add/delete information along with a response channel
type FlowCb struct {
ctx context.Context // Flow handler context
- addFlow bool // if true flow to be added, else removed
flowItem *of.OfpFlowStats
uniPort *cmn.OnuUniPort
flowMetaData *of.FlowMetadata
respChan *chan error // channel to report the Flow handling error
+ addFlow bool // if true flow to be added, else removed
}
// deviceHandler will interact with the ONU ? device.
type deviceHandler struct {
- DeviceID string
- DeviceType string
- adminState string
- device *voltha.Device
- logicalDeviceID string
- ProxyAddressID string
- ProxyAddressType string
- parentID string
- ponPortNumber uint32
+ EventProxy eventif.EventProxy
+
+ device *voltha.Device
coreClient *vgrpc.Client
- EventProxy eventif.EventProxy
pmConfigs *voltha.PmConfigs
config *config.AdapterFlags
@@ -170,19 +163,61 @@
pOpenOnuAc *OpenONUAC
pDeviceStateFsm *fsm.FSM
//pPonPort *voltha.Port
- deviceEntrySet chan bool //channel for DeviceEntry set event
- pOnuOmciDevice *mib.OnuDeviceEntry
- pOnuTP *avcfg.OnuUniTechProf
- pOnuMetricsMgr *pmmgr.OnuMetricsManager
- pAlarmMgr *almgr.OnuAlarmManager
- pSelfTestHdlr *otst.SelfTestControlBlock
- exitChannel chan int
- lockDevice sync.RWMutex
- pOnuIndication *oop.OnuIndication
- deviceReason uint8
- mutexDeviceReason sync.RWMutex
- pLockStateFsm *uniprt.LockStateFsm
- pUnlockStateFsm *uniprt.LockStateFsm
+ deviceEntrySet chan bool //channel for DeviceEntry set event
+ pOnuOmciDevice *mib.OnuDeviceEntry
+ pOnuTP *avcfg.OnuUniTechProf
+ pOnuMetricsMgr *pmmgr.OnuMetricsManager
+ pAlarmMgr *almgr.OnuAlarmManager
+ pSelfTestHdlr *otst.SelfTestControlBlock
+ exitChannel chan int
+ pOnuIndication *oop.OnuIndication
+ pLockStateFsm *uniprt.LockStateFsm
+ pUnlockStateFsm *uniprt.LockStateFsm
+
+ stopCollector chan bool
+ stopAlarmManager chan bool
+ stopHeartbeatCheck chan bool
+ uniEntityMap cmn.OnuUniPortMap
+ UniVlanConfigFsmMap map[uint8]*avcfg.UniVlanConfigFsm
+ pOnuUpradeFsm *swupg.OnuUpgradeFsm
+ chUniVlanConfigReconcilingDone chan uint16 //channel to indicate that VlanConfig reconciling for a specific UNI has been finished
+ chReconcilingFinished chan bool //channel to indicate that reconciling has been finished
+ pLastUpgradeImageState *voltha.ImageState
+ upgradeFsmChan chan struct{}
+
+ deviceDeleteCommChan chan bool
+ DeviceID string
+ DeviceType string
+ adminState string
+ logicalDeviceID string
+ ProxyAddressID string
+ ProxyAddressType string
+ parentID string
+
+ flowCbChan []chan FlowCb
+ stopFlowMonitoringRoutine []chan bool // length of slice equal to number of uni ports
+ isFlowMonitoringRoutineActive []bool // length of slice equal to number of uni ports
+ reconcileExpiryComplete time.Duration
+ reconcileExpiryVlanConfig time.Duration
+ lockDevice sync.RWMutex
+ mutexDeviceReason sync.RWMutex
+ mutexCollectorFlag sync.RWMutex
+ mutextAlarmManagerFlag sync.RWMutex
+ lockVlanConfig sync.RWMutex
+ lockVlanAdd sync.RWMutex
+ lockUpgradeFsm sync.RWMutex
+ mutexReconcilingFlag sync.RWMutex
+ mutexReconcilingFirstPassFlag sync.RWMutex
+ mutexReconcilingReasonUpdate sync.RWMutex
+ mutexReadyForOmciConfig sync.RWMutex
+ mutexDeletionInProgressFlag sync.RWMutex
+ mutexFlowMonitoringRoutineFlag sync.RWMutex
+ mutexForDisableDeviceRequested sync.RWMutex
+ mutexOltAvailable sync.RWMutex
+ mutexKvStoreContext sync.Mutex
+ ponPortNumber uint32
+
+ deviceReason uint8
//flowMgr *OpenOltFlowMgr
//eventMgr *OpenOltEventMgr
@@ -191,47 +226,16 @@
//discOnus sync.Map
//onus sync.Map
//portStats *OpenOltStatisticsMgr
- collectorIsRunning bool
- mutexCollectorFlag sync.RWMutex
- stopCollector chan bool
- alarmManagerIsRunning bool
- mutextAlarmManagerFlag sync.RWMutex
- stopAlarmManager chan bool
- stopHeartbeatCheck chan bool
- uniEntityMap cmn.OnuUniPortMap
- mutexKvStoreContext sync.Mutex
- lockVlanConfig sync.RWMutex
- lockVlanAdd sync.RWMutex
- UniVlanConfigFsmMap map[uint8]*avcfg.UniVlanConfigFsm
- lockUpgradeFsm sync.RWMutex
- pOnuUpradeFsm *swupg.OnuUpgradeFsm
- upgradeCanceled bool
- reconciling uint8
- mutexReconcilingFlag sync.RWMutex
- reconcilingFirstPass bool
- mutexReconcilingFirstPassFlag sync.RWMutex
- reconcilingReasonUpdate bool
- mutexReconcilingReasonUpdate sync.RWMutex
- chUniVlanConfigReconcilingDone chan uint16 //channel to indicate that VlanConfig reconciling for a specific UNI has been finished
- chReconcilingFinished chan bool //channel to indicate that reconciling has been finished
- reconcileExpiryComplete time.Duration
- reconcileExpiryVlanConfig time.Duration
- mutexReadyForOmciConfig sync.RWMutex
- readyForOmciConfig bool
- deletionInProgress bool
- mutexDeletionInProgressFlag sync.RWMutex
- pLastUpgradeImageState *voltha.ImageState
- upgradeFsmChan chan struct{}
-
- flowCbChan []chan FlowCb
- mutexFlowMonitoringRoutineFlag sync.RWMutex
- mutexForDisableDeviceRequested sync.RWMutex
- mutexOltAvailable sync.RWMutex
- stopFlowMonitoringRoutine []chan bool // length of slice equal to number of uni ports
- isFlowMonitoringRoutineActive []bool // length of slice equal to number of uni ports
- disableDeviceRequested bool // this flag identify ONU received disable request or not
- oltAvailable bool
- deviceDeleteCommChan chan bool
+ collectorIsRunning bool
+ alarmManagerIsRunning bool
+ upgradeCanceled bool
+ reconciling uint8
+ reconcilingFirstPass bool
+ reconcilingReasonUpdate bool
+ readyForOmciConfig bool
+ deletionInProgress bool
+ disableDeviceRequested bool // this flag identify ONU received disable request or not
+ oltAvailable bool
}
// newDeviceHandler creates a new device handler
@@ -408,8 +412,8 @@
defer dh.pOnuTP.UnlockTpProcMutex()
if techProfMsg.UniId >= platform.MaxUnisPerOnu {
- return fmt.Errorf(fmt.Sprintf("received UniId value exceeds range: %d, device-id: %s",
- techProfMsg.UniId, dh.DeviceID))
+ return fmt.Errorf("received UniId value exceeds range: %d, device-id: %s",
+ techProfMsg.UniId, dh.DeviceID)
}
uniID := uint8(techProfMsg.UniId)
tpID, err := cmn.GetTpIDFromTpPath(techProfMsg.TpInstancePath)
@@ -495,8 +499,8 @@
if delGemPortMsg.UniId >= platform.MaxUnisPerOnu {
logger.Errorw(ctx, "delete-gem-port UniId exceeds range", log.Fields{
"device-id": dh.DeviceID, "uni-id": delGemPortMsg.UniId})
- return fmt.Errorf(fmt.Sprintf("received UniId value exceeds range: %d, device-id: %s",
- delGemPortMsg.UniId, dh.DeviceID))
+ return fmt.Errorf("received UniId value exceeds range: %d, device-id: %s",
+ delGemPortMsg.UniId, dh.DeviceID)
}
uniID := uint8(delGemPortMsg.UniId)
tpID, err := cmn.GetTpIDFromTpPath(delGemPortMsg.TpInstancePath)
@@ -536,8 +540,8 @@
if delTcontMsg.UniId >= platform.MaxUnisPerOnu {
logger.Errorw(ctx, "delete-tcont UniId exceeds range", log.Fields{
"device-id": dh.DeviceID, "uni-id": delTcontMsg.UniId})
- return fmt.Errorf(fmt.Sprintf("received UniId value exceeds range: %d, device-id: %s",
- delTcontMsg.UniId, dh.DeviceID))
+ return fmt.Errorf("received UniId value exceeds range: %d, device-id: %s",
+ delTcontMsg.UniId, dh.DeviceID)
}
uniID := uint8(delTcontMsg.UniId)
tpPath := delTcontMsg.TpInstancePath
@@ -1666,7 +1670,7 @@
if !dh.IsReconciling() {
logger.Infow(ctx, "DeviceUpdate", log.Fields{"deviceReason": dh.device.Reason, "device-id": dh.DeviceID})
- if err := dh.updateDeviceInCore(ctx, dh.device); err != nil {
+ if err = dh.updateDeviceInCore(ctx, dh.device); err != nil {
logger.Errorw(ctx, "device-update-failed", log.Fields{"device-id": dh.device.Id, "error": err})
}
//TODO Need to Update Device Reason To CORE as part of device update userstory
@@ -1927,6 +1931,8 @@
}
// addOnuDeviceEntry creates a new ONU device or returns the existing
+//
+//nolint:unparam
func (dh *deviceHandler) addOnuDeviceEntry(ctx context.Context) error {
logger.Debugw(ctx, "adding-deviceEntry", log.Fields{"device-id": dh.DeviceID})
@@ -2331,6 +2337,7 @@
return nil
}
+//nolint:unparam
func (dh *deviceHandler) processMibDatabaseSyncEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Debugw(ctx, "MibInSync event received, adding uni ports and locking the ONU interfaces", log.Fields{"device-id": dh.DeviceID})
@@ -2362,6 +2369,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processUniLockStateDoneEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Infow(ctx, "UniLockStateDone event: Starting MIB download", log.Fields{"device-id": dh.DeviceID})
/* Mib download procedure -
@@ -2399,6 +2407,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processMibDownloadDoneEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Info(ctx, "MibDownloadDone event received, unlocking the ONU interfaces", log.Fields{"device-id": dh.DeviceID})
pDevEntry := dh.GetOnuDeviceEntry(ctx, false)
@@ -2499,6 +2508,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processUniUnlockStateDoneEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
dh.EnableUniPortStateUpdate(ctx) //cmp python yield self.enable_ports()
@@ -2528,6 +2538,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processUniDisableStateDoneEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Debugw(ctx, "DeviceStateUpdate upon disable", log.Fields{
"OperStatus": voltha.OperStatus_UNKNOWN, "device-id": dh.DeviceID})
@@ -2563,6 +2574,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processUniEnableStateDoneEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Debugw(ctx, "DeviceStateUpdate upon re-enable", log.Fields{"ConnectStatus": voltha.ConnectStatus_REACHABLE,
"OperStatus": voltha.OperStatus_ACTIVE, "device-id": dh.DeviceID})
@@ -2597,6 +2609,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) processUniEnableStateFailedEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
logger.Debugw(ctx, "DeviceStateUpdate upon re-enable failure. ", log.Fields{
"OperStatus": voltha.OperStatus_FAILED, "device-id": dh.DeviceID})
@@ -2999,13 +3012,15 @@
// createOnuUpgradeFsm initializes and runs the Onu Software upgrade FSM
// precondition: lockUpgradeFsm is already locked from caller of this function
+//
+//nolint:unparam
func (dh *deviceHandler) createOnuUpgradeFsm(ctx context.Context, apDevEntry *mib.OnuDeviceEntry, aDevEvent cmn.OnuDeviceEvent) error {
chUpgradeFsm := make(chan cmn.Message, 2)
var sFsmName = "OnuSwUpgradeFSM"
logger.Debugw(ctx, "create OnuSwUpgradeFSM", log.Fields{"device-id": dh.DeviceID})
if apDevEntry.PDevOmciCC == nil {
logger.Errorw(ctx, "no valid OnuDevice or omciCC - abort", log.Fields{"device-id": dh.DeviceID})
- return fmt.Errorf(fmt.Sprintf("no valid omciCC - abort for device-id: %s", dh.device.Id))
+ return fmt.Errorf("no valid omciCC - abort for device-id: %s", dh.device.Id)
}
dh.pOnuUpradeFsm = swupg.NewOnuUpgradeFsm(ctx, dh, apDevEntry, apDevEntry.GetOnuDB(), aDevEvent,
sFsmName, chUpgradeFsm)
@@ -3016,7 +3031,7 @@
if err := pUpgradeStatemachine.Event(swupg.UpgradeEvStart); err != nil {
logger.Errorw(ctx, "OnuSwUpgradeFSM: can't start", log.Fields{"device-id": dh.DeviceID, "err": err})
// maybe try a FSM reset and then again ... - TODO!!!
- return fmt.Errorf(fmt.Sprintf("OnuSwUpgradeFSM could not be started for device-id: %s", dh.device.Id))
+ return fmt.Errorf("OnuSwUpgradeFSM could not be started for device-id: %s", dh.device.Id)
}
/***** Upgrade FSM started */
//reset the last stored upgrade states (which anyway should be don't care as long as the newly created FSM exists)
@@ -3029,16 +3044,16 @@
logger.Errorw(ctx, "wrong state of OnuSwUpgradeFSM to start - want: disabled", log.Fields{
"have": pUpgradeStatemachine.Current(), "device-id": dh.DeviceID})
// maybe try a FSM reset and then again ... - TODO!!!
- return fmt.Errorf(fmt.Sprintf("OnuSwUpgradeFSM could not be started for device-id: %s, wrong internal state", dh.device.Id))
+ return fmt.Errorf("OnuSwUpgradeFSM could not be started for device-id: %s, wrong internal state", dh.device.Id)
}
} else {
logger.Errorw(ctx, "OnuSwUpgradeFSM internal FSM invalid - cannot be executed!!", log.Fields{"device-id": dh.DeviceID})
// maybe try a FSM reset and then again ... - TODO!!!
- return fmt.Errorf(fmt.Sprintf("OnuSwUpgradeFSM internal FSM could not be created for device-id: %s", dh.device.Id))
+ return fmt.Errorf("OnuSwUpgradeFSM internal FSM could not be created for device-id: %s", dh.device.Id)
}
} else {
logger.Errorw(ctx, "OnuSwUpgradeFSM could not be created - abort", log.Fields{"device-id": dh.DeviceID})
- return fmt.Errorf(fmt.Sprintf("OnuSwUpgradeFSM could not be created - abort for device-id: %s", dh.device.Id))
+ return fmt.Errorf("OnuSwUpgradeFSM could not be created - abort for device-id: %s", dh.device.Id)
}
return nil
}
@@ -3170,6 +3185,8 @@
return kvbackend
}
+
+//nolint:unparam
func (dh *deviceHandler) getFlowOfbFields(ctx context.Context, apFlowItem *of.OfpFlowStats, loMatchVlan *uint16,
loMatchPcp *uint8, loIPProto *uint32) {
@@ -3891,6 +3908,7 @@
}
}
+//nolint:unparam
func (dh *deviceHandler) setOnuOffloadStats(ctx context.Context, config *extension.AppOffloadOnuConfig) *extension.SingleSetValueResponse {
singleValResp := extension.SingleSetValueResponse{
@@ -3947,6 +3965,7 @@
return pDevOmciCC.GetOmciCounters(), nil
}
+//nolint:unparam
func (dh *deviceHandler) isFsmInOmciIdleState(ctx context.Context, PFsm *fsm.FSM, wantedState string) bool {
if PFsm == nil {
return true //FSM not active - so there is no activity on omci
@@ -4030,6 +4049,7 @@
return true
}
+//nolint:unparam
func (dh *deviceHandler) isUniVlanConfigFsmInOmciIdleState(ctx context.Context, omciFsm cmn.UsedOmciConfigFsms, idleState string) bool {
dh.lockVlanConfig.RLock()
defer dh.lockVlanConfig.RUnlock()
@@ -4041,6 +4061,7 @@
return true //FSM not active - so there is no activity on omci
}
+//nolint:unparam
func (dh *deviceHandler) checkUserServiceExists(ctx context.Context) bool {
dh.lockVlanConfig.RLock()
defer dh.lockVlanConfig.RUnlock()
@@ -4538,7 +4559,7 @@
logger.Errorw(ctx, "configuration exceeds ONU capabilities - running out of TCONT instances: send ONU device event!",
log.Fields{"device-id": dh.device.Id})
pDevEntry.SendOnuDeviceEvent(ctx, cmn.OnuConfigFailureMissingTcont, cmn.OnuConfigFailureMissingTcontDesc)
- return fmt.Errorf(fmt.Sprintf("configuration exceeds ONU capabilities - running out of TCONT instances: device-id: %s", dh.DeviceID))
+ return fmt.Errorf("configuration exceeds ONU capabilities - running out of TCONT instances: device-id: %s", dh.DeviceID)
}
} else {
pDevEntry.MutexPersOnuConfig.Unlock()
@@ -4549,7 +4570,7 @@
queueInstKeys := pDevEntry.GetOnuDB().GetSortedInstKeys(ctx, me.PriorityQueueClassID)
for _, mgmtEntityID := range queueInstKeys {
- if mgmtEntityID >= 0x8000 && mgmtEntityID <= 0xFFFF {
+ if mgmtEntityID >= 0x8000 {
numberOfUsPrioQueueDbInsts++
}
}
@@ -4565,7 +4586,7 @@
logger.Errorw(ctx, "configuration exceeds ONU capabilities - running out of upstream PrioQueue instances: send ONU device event!",
log.Fields{"device-id": dh.device.Id})
pDevEntry.SendOnuDeviceEvent(ctx, cmn.OnuConfigFailureMissingUsPriorityQueue, cmn.OnuConfigFailureMissingUsPriorityQueueDesc)
- return fmt.Errorf(fmt.Sprintf("configuration exceeds ONU capabilities - running out of upstream PrioQueue instances: device-id: %s", dh.DeviceID))
+ return fmt.Errorf("configuration exceeds ONU capabilities - running out of upstream PrioQueue instances: device-id: %s", dh.DeviceID)
}
// Downstream PrioQueue instances are evaluated in accordance with ONU MIB upload data in function UniPonAniConfigFsm::prepareAndEnterConfigState().
// In case of missing downstream PrioQueues the attribute "Priority queue pointer for downstream" of ME "GEM port network CTP" will be set to "0",
diff --git a/internal/pkg/core/openonu.go b/internal/pkg/core/openonu.go
index 9e46c54..4d68e8f 100755
--- a/internal/pkg/core/openonu.go
+++ b/internal/pkg/core/openonu.go
@@ -64,44 +64,44 @@
// OpenONUAC structure holds the ONU core information
type OpenONUAC struct {
- deviceHandlers map[string]*deviceHandler
- deviceHandlersCreateChan map[string]chan bool //channels for deviceHandler create events
- mutexDeviceHandlersMap sync.RWMutex
- coreClient *vgrpc.Client
- parentAdapterClients map[string]*vgrpc.Client
- lockParentAdapterClients sync.RWMutex
- reachableFromRemote map[string]*reachabilityFromRemote
- lockReachableFromRemote sync.RWMutex
eventProxy eventif.EventProxy
kvClient kvstore.Client
+ deviceHandlers map[string]*deviceHandler
+ deviceHandlersCreateChan map[string]chan bool //channels for deviceHandler create events
+ coreClient *vgrpc.Client
+ parentAdapterClients map[string]*vgrpc.Client
+ reachableFromRemote map[string]*reachabilityFromRemote
cm *conf.ConfigManager
config *config.AdapterFlags
- numOnus int
- KVStoreAddress string
- KVStoreType string
- KVStoreTimeout time.Duration
mibTemplatesGenerated map[string]bool
- mutexMibTemplateGenerated sync.RWMutex
exitChannel chan int
- HeartbeatCheckInterval time.Duration
- HeartbeatFailReportInterval time.Duration
- AcceptIncrementalEvto bool
pSupportedFsms *cmn.OmciDeviceFsms
- maxTimeoutInterAdapterComm time.Duration
- maxTimeoutReconciling time.Duration
pDownloadManager *swupg.AdapterDownloadManager
pFileManager *swupg.FileDownloadManager //let coexist 'old and new' DownloadManager as long as 'old' does not get obsolete
- MetricsEnabled bool
- ExtendedOmciSupportEnabled bool
+ MibDatabaseMap devdb.OnuMCmnMEDBMap
+ KVStoreAddress string
+ KVStoreType string
+ numOnus int
+ KVStoreTimeout time.Duration
+ HeartbeatCheckInterval time.Duration
+ HeartbeatFailReportInterval time.Duration
+ maxTimeoutInterAdapterComm time.Duration
+ maxTimeoutReconciling time.Duration
mibAuditInterval time.Duration
omciTimeout int // in seconds
alarmAuditInterval time.Duration
dlToOnuTimeout4M time.Duration
rpcTimeout time.Duration
maxConcurrentFlowsPerUni int
- skipOnuConfig bool
+ mutexDeviceHandlersMap sync.RWMutex
+ lockParentAdapterClients sync.RWMutex
+ lockReachableFromRemote sync.RWMutex
+ mutexMibTemplateGenerated sync.RWMutex
mutexMibDatabaseMap sync.RWMutex
- MibDatabaseMap devdb.OnuMCmnMEDBMap
+ AcceptIncrementalEvto bool
+ MetricsEnabled bool
+ ExtendedOmciSupportEnabled bool
+ skipOnuConfig bool
}
// NewOpenONUAC returns a new instance of OpenONU_AC
@@ -142,7 +142,7 @@
openOnuAc.maxConcurrentFlowsPerUni = cfg.MaxConcurrentFlowsPerUni
openOnuAc.pSupportedFsms = &cmn.OmciDeviceFsms{
- "mib-synchronizer": {
+ "mib-synchronizer": cmn.ActivityDescr{
//mibSyncFsm, // Implements the MIB synchronization state machine
DatabaseClass: mibDbVolatileDictImpl, // Implements volatile ME MIB database
//true, // Advertise events on OpenOMCI event bus
@@ -301,7 +301,7 @@
return &empty.Empty{}, nil
}
logger.Warnw(ctx, "no handler found for device-disable", log.Fields{"device-id": device.Id})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id))
+ return nil, fmt.Errorf("handler-not-found-%s", device.Id)
}
// ReEnableDevice enables the onu device after disable
@@ -312,7 +312,7 @@
return &empty.Empty{}, nil
}
logger.Warnw(ctx, "no handler found for device-reenable", log.Fields{"device-id": device.Id})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", device.Id))
+ return nil, fmt.Errorf("handler-not-found-%s", device.Id)
}
// RebootDevice reboots the given device
@@ -401,7 +401,7 @@
return &empty.Empty{}, nil
}
logger.Warnw(ctx, "no handler found for incremental flow update", log.Fields{"device-id": incrFlows.Device.Id})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", incrFlows.Device.Id))
+ return nil, fmt.Errorf("handler-not-found-%s", incrFlows.Device.Id)
}
// UpdatePmConfig returns PmConfigs nil or error
@@ -414,7 +414,7 @@
return &empty.Empty{}, nil
}
logger.Warnw(ctx, "no handler found for update-pm-config", log.Fields{"device-id": configs.DeviceId})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", configs.DeviceId))
+ return nil, fmt.Errorf("handler-not-found-%s", configs.DeviceId)
}
// DownloadImage requests downloading some image according to indications as given in request
@@ -459,10 +459,10 @@
return imageInfo.Image, nil
}
logger.Warnw(ctx, "no handler found for image activation", log.Fields{"device-id": imageInfo.Device.Id})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found - device-id: %s", imageInfo.Device.Id))
+ return nil, fmt.Errorf("handler-not-found - device-id: %s", imageInfo.Device.Id)
}
logger.Debugw(ctx, "image not yet downloaded on activate request", log.Fields{"image-description": imageInfo.Image})
- return nil, fmt.Errorf(fmt.Sprintf("image-not-yet-downloaded - device-id: %s", imageInfo.Device.Id))
+ return nil, fmt.Errorf("image-not-yet-downloaded - device-id: %s", imageInfo.Device.Id)
}
return nil, errors.New("invalid image definition")
}
@@ -773,10 +773,10 @@
if err == nil {
return images, nil
}
- return nil, fmt.Errorf(fmt.Sprintf("%s-%s", err, id.Id))
+ return nil, fmt.Errorf("%s-%s", err, id.Id)
}
logger.Warnw(ctx, "no handler found for Get_onu_images", log.Fields{"device-id": id.Id})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", id.Id))
+ return nil, fmt.Errorf("handler-not-found-%s", id.Id)
}
// ActivateOnuImage initiates the activation of the image for the requested ONU(s)
@@ -927,7 +927,7 @@
}
logger.Warnw(ctx, "no handler found for received onu-ind-request", log.Fields{
"msgToDeviceId": onuInd.DeviceId})
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", onuInd.DeviceId))
+ return nil, fmt.Errorf("handler-not-found-%s", onuInd.DeviceId)
}
// OmciIndication is part of the ONU Inter-adapter service API.
@@ -940,7 +940,7 @@
}
return &empty.Empty{}, nil
}
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", msg.ChildDeviceId))
+ return nil, fmt.Errorf("handler-not-found-%s", msg.ChildDeviceId)
}
// DownloadTechProfile is part of the ONU Inter-adapter service API.
@@ -953,7 +953,7 @@
logger.Warnw(ctx, "Device deletion in progress - avoid processing Tech Profile", log.Fields{"device-id": tProfile.DeviceId})
handler.RUnlockMutexDeletionInProgressFlag()
- return nil, fmt.Errorf(fmt.Sprintf("Can't proceed, device deletion is in progress-%s", tProfile.DeviceId))
+ return nil, fmt.Errorf("Can't proceed, device deletion is in progress-%s", tProfile.DeviceId)
}
handler.RUnlockMutexDeletionInProgressFlag()
if err := handler.handleTechProfileDownloadRequest(log.WithSpanFromContext(context.Background(), ctx), tProfile); err != nil {
@@ -961,7 +961,7 @@
}
return &empty.Empty{}, nil
}
- return nil, fmt.Errorf(fmt.Sprintf("handler-not-found-%s", tProfile.DeviceId))
+ return nil, fmt.Errorf("handler-not-found-%s", tProfile.DeviceId)
}
// DeleteGemPort is part of the ONU Inter-adapter service API.
@@ -1010,6 +1010,7 @@
return string(h)
}
+// nolint:unparam
func (oo *OpenONUAC) updateReachabilityFromRemote(ctx context.Context, remote *common.Connection) {
logger.Debugw(context.Background(), "updating-remote-connection-status", log.Fields{"remote": remote})
oo.lockReachableFromRemote.Lock()
diff --git a/internal/pkg/devdb/onu_device_db.go b/internal/pkg/devdb/onu_device_db.go
index 423f0d9..f8e99cb 100755
--- a/internal/pkg/devdb/onu_device_db.go
+++ b/internal/pkg/devdb/onu_device_db.go
@@ -59,10 +59,10 @@
// OnuDeviceDB structure holds information about ME's
type OnuDeviceDB struct {
ctx context.Context
- deviceID string
CommonMeDb *OnuCmnMEDB // Reference to OnuCmnMEDB
- OnuSpecificMeDbLock sync.RWMutex
OnuSpecificMeDb MeDbMap
+ deviceID string
+ OnuSpecificMeDbLock sync.RWMutex
}
// MIBUploadStatus represents the status of MIBUpload for a particular ONT.
@@ -78,10 +78,10 @@
// OnuCmnMEDB structure holds information about ME's common to ONT possessing same MIB Template.
type OnuCmnMEDB struct {
- MeDbLock sync.RWMutex
MeDb MeDbMap
UnknownMeAndAttribDb UnknownMeAndAttribDbMap
MIBUploadStatus MIBUploadStatus
+ MeDbLock sync.RWMutex
}
// NewOnuCmnMEDB returns a new instance of OnuCmnMEDB
@@ -98,6 +98,7 @@
// NewOnuDeviceDB returns a new instance for a specific ONU_Device_Entry
func NewOnuDeviceDB(ctx context.Context, aDeviceID string) *OnuDeviceDB {
logger.Debugw(ctx, "Init OnuDeviceDB for:", log.Fields{"device-id": aDeviceID})
+ //nolint:govet
var OnuDeviceDB OnuDeviceDB
OnuDeviceDB.ctx = ctx
OnuDeviceDB.deviceID = aDeviceID
@@ -171,7 +172,7 @@
case reflect.Uint32:
return meAttribute.(uint32), nil
default:
- return uint32(0), fmt.Errorf(fmt.Sprintf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID))
+ return uint32(0), fmt.Errorf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID)
}
}
@@ -185,7 +186,7 @@
case reflect.Uint16:
return meAttribute.(uint16), nil
default:
- return uint16(0), fmt.Errorf(fmt.Sprintf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID))
+ return uint16(0), fmt.Errorf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID)
}
}
diff --git a/internal/pkg/mib/mib_download.go b/internal/pkg/mib/mib_download.go
index 921043a..8f1a26d 100755
--- a/internal/pkg/mib/mib_download.go
+++ b/internal/pkg/mib/mib_download.go
@@ -108,6 +108,7 @@
}
}
+//nolint:unparam
func (onuDeviceEntry *OnuDeviceEntry) enterResettingState(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "MibDownload FSM resetting", log.Fields{"device-id": onuDeviceEntry.deviceID})
pMibDlFsm := onuDeviceEntry.PMibDownloadFsm
@@ -382,6 +383,7 @@
_ = onuDeviceEntry.PMibDownloadFsm.PFsm.Event(DlEvRxBridgeResp)
}
+//nolint:unparam
func (onuDeviceEntry *OnuDeviceEntry) waitforOmciResponse(ctx context.Context, apMeInstance *me.ManagedEntity) error {
select {
// maybe be also some outside cancel (but no context modeled for the moment ...)
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index b15f9ec..47f8593 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -43,8 +43,8 @@
)
type sLastTxMeParameter struct {
- lastTxMessageType omci.MessageType
pLastTxMeInstance *me.ManagedEntity
+ lastTxMessageType omci.MessageType
repeatCount uint8
}
@@ -130,6 +130,7 @@
logger.Errorw(ctx, "ONU-G get failed, aborting MibSync FSM", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -154,6 +155,7 @@
logger.Errorw(ctx, "ONU-G get failed, aborting MibSync FSM", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -178,6 +180,7 @@
logger.Errorw(ctx, "ONU2-G get failed, aborting MibSync FSM!", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -215,6 +218,7 @@
}
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvGetFirstSwVersion)
}(pMibUlFsm)
@@ -234,6 +238,7 @@
logger.Errorw(ctx, "SoftwareImage get failed, aborting MibSync FSM", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -258,6 +263,7 @@
logger.Errorw(ctx, "SoftwareImage get failed, aborting MibSync FSM", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -282,6 +288,7 @@
logger.Errorw(ctx, "IpHostConfigData get failed, aborting MibSync FSM", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
@@ -293,6 +300,7 @@
oo.mutexLastTxParamStruct.Unlock()
}
+//nolint:unparam
func (oo *OnuDeviceEntry) enterGettingMibTemplateState(ctx context.Context, e *fsm.Event) {
oo.mutexOnuSwImageIndications.RLock()
@@ -1156,7 +1164,7 @@
oo.MutexPersOnuConfig.Lock()
snBytes, _ := me.InterfaceToOctets(onuGSerialNumber)
if cmn.OnugSerialNumberLen == len(snBytes) {
- snVendorPart := fmt.Sprintf("%s", snBytes[:4])
+ snVendorPart := string(snBytes[:4])
snNumberPart := hex.EncodeToString(snBytes[4:])
oo.SOnuPersistentData.PersSerialNumber = snVendorPart + snNumberPart
} else {
@@ -1373,6 +1381,7 @@
logger.Errorw(ctx, "ONUData get failed, aborting MibSync FSM!", log.Fields{"device-id": oo.deviceID})
pMibUlFsm := oo.PMibUploadFsm
if pMibUlFsm != nil {
+ //nolint:unparam
go func(a_pAFsm *cmn.AdapterFsm) {
_ = oo.PMibUploadFsm.PFsm.Event(UlEvStop)
}(pMibUlFsm)
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index 108a706..c5f9365 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -138,87 +138,90 @@
const vlanConfigSendChanExpiry = 5
type uniPersConfig struct {
- PersUniID uint8 `json:"uni_id"`
PersTpPathMap map[uint8]string `json:"PersTpPathMap"` // tp-id to tp-path map
PersFlowParams []cmn.UniVlanFlowParams `json:"flow_params"` //as defined in omci_ani_config.go
+ PersUniID uint8 `json:"uni_id"`
}
type onuPersistentData struct {
- PersOnuID uint32 `json:"onu_id"`
- PersIntfID uint32 `json:"intf_id"`
+ PersTcontMap map[uint16]uint16 `json:"tcont_map"` //alloc-id to me-instance-id map
PersSerialNumber string `json:"serial_number"`
PersMacAddress string `json:"mac_address"`
PersVendorID string `json:"vendor_id"`
PersVersion string `json:"version"`
PersEquipmentID string `json:"equipment_id"`
- PersIsExtOmciSupported bool `json:"is_ext_omci_supported"`
PersActiveSwVersion string `json:"active_sw_version"`
PersAdminState string `json:"admin_state"`
PersOperState string `json:"oper_state"`
+ PersUniConfig []uniPersConfig `json:"uni_config"`
+ PersMibAuditInterval time.Duration `json:"mib_audit_interval"`
+ PersAlarmAuditInterval time.Duration `json:"alarm_audit_interval"`
+ PersOnuID uint32 `json:"onu_id"`
+ PersIntfID uint32 `json:"intf_id"`
+ PersMibLastDbSync uint32 `json:"mib_last_db_sync"`
+ PersIsExtOmciSupported bool `json:"is_ext_omci_supported"`
PersUniUnlockDone bool `json:"uni_unlock_done"`
PersUniDisableDone bool `json:"uni_disable_done"`
- PersMibAuditInterval time.Duration `json:"mib_audit_interval"`
- PersMibLastDbSync uint32 `json:"mib_last_db_sync"`
PersMibDataSyncAdpt uint8 `json:"mib_data_sync_adpt"`
- PersUniConfig []uniPersConfig `json:"uni_config"`
- PersAlarmAuditInterval time.Duration `json:"alarm_audit_interval"`
- PersTcontMap map[uint16]uint16 `json:"tcont_map"` //alloc-id to me-instance-id map
}
//type UniTpidInstances map[uint8]map[uint8]inter_adapter.TechProfileDownloadMessage
// OnuDeviceEntry - ONU device info and FSM events.
+//
+//nolint:govet
type OnuDeviceEntry struct {
- deviceID string
+ SOnuPersistentData onuPersistentData
baseDeviceHandler cmn.IdeviceHandler
eventProxy eventif.EventProxy
pOpenOnuAc cmn.IopenONUAC
pOnuTP cmn.IonuUniTechProf
+ onuKVStoreProcResult error //error indication of processing
coreClient *vgrpc.Client
PDevOmciCC *cmn.OmciCC
pOnuDB *devdb.OnuDeviceDB
mibTemplateKVStore *db.Backend
- MutexPersOnuConfig sync.RWMutex
- SOnuPersistentData onuPersistentData
ReconciledTpInstances map[uint8]map[uint8]inter_adapter.TechProfileDownloadMessage
- MutexReconciledTpInstances sync.RWMutex
- reconcilingFlows bool
- mutexReconcilingFlowsFlag sync.RWMutex
chReconcilingFlowsFinished chan bool //channel to indicate that reconciling of flows has been finished
- mibTemplatePath string
- mutexOnuKVStore sync.RWMutex
onuKVStore *db.Backend
- onuKVStorePath string
- mutexOnuKVStoreProcResult sync.RWMutex
- onuKVStoreProcResult error //error indication of processing
- mutexOnuSwImageIndications sync.RWMutex
- onuSwImageIndications cmn.SswImageIndications
- MutexOnuImageStatus sync.RWMutex
POnuImageStatus *swupg.OnuImageStatus
//lockDeviceEntries sync.RWMutex
mibDbClass func(context.Context) error
supportedFsms cmn.OmciDeviceFsms
- devState cmn.OnuDeviceEvent
+
+ // for mibUpload
+ PMibUploadFsm *cmn.AdapterFsm //could be handled dynamically and more general as pcmn.AdapterFsm - perhaps later
+ // for mibDownload
+ PMibDownloadFsm *cmn.AdapterFsm //could be handled dynamically and more general as pcmn.AdapterFsm - perhaps later
+ pLastTxMeInstance *me.ManagedEntity
+ omciMessageReceived chan bool //seperate channel needed by DownloadFsm
+ omciRebootMessageReceivedChannel chan cmn.Message // channel needed by reboot request
+ lastTxParamStruct sLastTxMeParameter
+ deviceID string
+ mibTemplatePath string
+ onuKVStorePath string
+ onuSwImageIndications cmn.SswImageIndications
+ devState cmn.OnuDeviceEvent
// Audit and MDS
mibAuditInterval time.Duration
alarmAuditInterval time.Duration
// TODO: periodical mib resync will be implemented with story VOL-3792
//mibNextDbResync uint32
- // for mibUpload
- PMibUploadFsm *cmn.AdapterFsm //could be handled dynamically and more general as pcmn.AdapterFsm - perhaps later
+ MutexPersOnuConfig sync.RWMutex
+ MutexReconciledTpInstances sync.RWMutex
+ mutexReconcilingFlowsFlag sync.RWMutex
+ mutexOnuKVStore sync.RWMutex
+ mutexOnuKVStoreProcResult sync.RWMutex
+ mutexOnuSwImageIndications sync.RWMutex
+ MutexOnuImageStatus sync.RWMutex
mutexLastTxParamStruct sync.RWMutex
- lastTxParamStruct sLastTxMeParameter
- mibSyncMsgProcessorRunning bool
mutexMibSyncMsgProcessorRunning sync.RWMutex
- // for mibDownload
- PMibDownloadFsm *cmn.AdapterFsm //could be handled dynamically and more general as pcmn.AdapterFsm - perhaps later
//remark: general usage of pAdapterFsm would require generalization of CommChan usage and internal event setting
// within the FSM event procedures
- mutexPLastTxMeInstance sync.RWMutex
- pLastTxMeInstance *me.ManagedEntity
- omciMessageReceived chan bool //seperate channel needed by DownloadFsm
- omciRebootMessageReceivedChannel chan cmn.Message // channel needed by reboot request
+ mutexPLastTxMeInstance sync.RWMutex
+ reconcilingFlows bool
+ mibSyncMsgProcessorRunning bool
}
// NewOnuDeviceEntry returns a new instance of a OnuDeviceEntry
@@ -252,7 +255,7 @@
//var mibSyncFsm = NewMibSynchronizer()
// use some internal defaults, if not defined from outside
onuDeviceEntry.supportedFsms = cmn.OmciDeviceFsms{
- "mib-synchronizer": {
+ "mib-synchronizer": cmn.ActivityDescr{
//mibSyncFsm, // Implements the MIB synchronization state machine
DatabaseClass: onuDeviceEntry.mibDbVolatileDict, // Implements volatile ME MIB database
//true, // Advertise events on OpenOMCI event bus
@@ -270,7 +273,9 @@
}
onuDeviceEntry.mibDbClass = onuDeviceEntry.supportedFsms["mib-synchronizer"].DatabaseClass
logger.Debug(ctx, "access2mibDbClass")
- go onuDeviceEntry.mibDbClass(ctx)
+ go func() {
+ _ = onuDeviceEntry.mibDbClass(ctx)
+ }()
if !dh.IsReconciling() {
onuDeviceEntry.mibAuditInterval = onuDeviceEntry.supportedFsms["mib-synchronizer"].AuditInterval
onuDeviceEntry.SOnuPersistentData.PersMibAuditInterval = onuDeviceEntry.mibAuditInterval
@@ -539,13 +544,32 @@
func (oo *OnuDeviceEntry) RestoreDataFromOnuKvStore(ctx context.Context) error {
if oo.onuKVStore == nil {
logger.Debugw(ctx, "onuKVStore not set - abort", log.Fields{"device-id": oo.deviceID})
- return fmt.Errorf(fmt.Sprintf("onuKVStore-not-set-abort-%s", oo.deviceID))
+ return fmt.Errorf("onuKVStore-not-set-abort-%s", oo.deviceID)
}
oo.MutexPersOnuConfig.Lock()
defer oo.MutexPersOnuConfig.Unlock()
oo.SOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", false, "", "", "", false, false, oo.mibAuditInterval, 0, 0,
- make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
+ onuPersistentData{
+ PersTcontMap: make(map[uint16]uint16),
+ PersSerialNumber: "",
+ PersMacAddress: "",
+ PersVendorID: "",
+ PersVersion: "",
+ PersEquipmentID: "",
+ PersActiveSwVersion: "",
+ PersAdminState: "",
+ PersOperState: "",
+ PersUniConfig: make([]uniPersConfig, 0),
+ PersMibAuditInterval: oo.mibAuditInterval,
+ PersAlarmAuditInterval: oo.alarmAuditInterval,
+ PersOnuID: 0,
+ PersIntfID: 0,
+ PersMibLastDbSync: 0,
+ PersIsExtOmciSupported: false,
+ PersUniUnlockDone: false,
+ PersUniDisableDone: false,
+ PersMibDataSyncAdpt: 0,
+ }
oo.mutexOnuKVStore.RLock()
Value, err := oo.onuKVStore.Get(ctx, oo.onuKVStorePath)
oo.mutexOnuKVStore.RUnlock()
@@ -557,7 +581,7 @@
if err = json.Unmarshal(tmpBytes, &oo.SOnuPersistentData); err != nil {
logger.Errorw(ctx, "unable to unmarshal ONU-data", log.Fields{"error": err, "device-id": oo.deviceID})
- return fmt.Errorf(fmt.Sprintf("unable-to-unmarshal-ONU-data-%s", oo.deviceID))
+ return fmt.Errorf("unable-to-unmarshal-ONU-data-%s", oo.deviceID)
}
logger.Debugw(ctx, "ONU-data", log.Fields{"SOnuPersistentData": oo.SOnuPersistentData,
"device-id": oo.deviceID})
@@ -567,7 +591,7 @@
}
} else {
logger.Errorw(ctx, "unable to read from KVstore", log.Fields{"device-id": oo.deviceID})
- return fmt.Errorf(fmt.Sprintf("unable-to-read-from-KVstore-%s", oo.deviceID))
+ return fmt.Errorf("unable-to-read-from-KVstore-%s", oo.deviceID)
}
return nil
}
@@ -595,8 +619,27 @@
oo.SOnuPersistentData.PersUniConfig = nil //releasing all UniConfig entries to garbage collector default entry
oo.SOnuPersistentData =
- onuPersistentData{0, 0, "", "", "", "", "", false, "", "", "", false, false, oo.mibAuditInterval, 0, 0,
- make([]uniPersConfig, 0), oo.alarmAuditInterval, make(map[uint16]uint16)}
+ onuPersistentData{
+ PersTcontMap: make(map[uint16]uint16),
+ PersSerialNumber: "",
+ PersMacAddress: "",
+ PersVendorID: "",
+ PersVersion: "",
+ PersEquipmentID: "",
+ PersActiveSwVersion: "",
+ PersAdminState: "",
+ PersOperState: "",
+ PersUniConfig: make([]uniPersConfig, 0),
+ PersMibAuditInterval: oo.mibAuditInterval,
+ PersAlarmAuditInterval: oo.alarmAuditInterval,
+ PersOnuID: 0,
+ PersIntfID: 0,
+ PersMibLastDbSync: 0,
+ PersIsExtOmciSupported: false,
+ PersUniUnlockDone: false,
+ PersUniDisableDone: false,
+ PersMibDataSyncAdpt: 0,
+ }
logger.Debugw(ctx, "delete ONU-data from KVStore", log.Fields{"device-id": oo.deviceID})
oo.mutexOnuKVStore.Lock()
err := oo.onuKVStore.Delete(ctx, oo.onuKVStorePath)
@@ -886,7 +929,7 @@
}
}
}
- return 0, false, fmt.Errorf(fmt.Sprintf("no-free-tcont-left-for-device-%s", oo.deviceID))
+ return 0, false, fmt.Errorf("no-free-tcont-left-for-device-%s", oo.deviceID)
}
// FreeTcont - TODO: add comment
diff --git a/internal/pkg/omcitst/omci_self_test_handler.go b/internal/pkg/omcitst/omci_self_test_handler.go
index c5148cb..cfa4536 100755
--- a/internal/pkg/omcitst/omci_self_test_handler.go
+++ b/internal/pkg/omcitst/omci_self_test_handler.go
@@ -55,23 +55,23 @@
// We initiate an fsmCb per Self Test Request
type fsmCb struct {
fsm *cmn.AdapterFsm
- reqMsg extension.SingleGetValueRequest
respChan chan extension.SingleGetValueResponse
stopOmciChan chan bool
+ reqMsg extension.SingleGetValueRequest
}
// SelfTestControlBlock - TODO: add comment
type SelfTestControlBlock struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pDevEntry cmn.IonuDeviceEntry
- selfTestFsmMap map[generated.ClassID]*fsmCb // The fsmCb is indexed by ME Class ID of the Test Action procedure
- selfTestFsmLock sync.RWMutex
+ selfTestFsmMap map[generated.ClassID]*fsmCb // The fsmCb is indexed by ME Class ID of the Test Action procedure
+ StopSelfTestModule chan bool
+ deviceID string
+ selfTestFsmLock sync.RWMutex
SelfTestHandlerLock sync.RWMutex
SelfTestHandlerActive bool
- StopSelfTestModule chan bool
}
// NewSelfTestMsgHandlerCb creates the SelfTestControlBlock
@@ -184,6 +184,7 @@
}()
}
+//nolint:unparam
func (selfTestCb *SelfTestControlBlock) submitFailureGetValueResponse(ctx context.Context, respChan chan extension.SingleGetValueResponse,
errorCode extension.GetValueResponse_ErrorReason, statusCode extension.GetValueResponse_Status, reqMsg extension.SingleGetValueRequest) {
meClassID, err := selfTestCb.getMeClassID(ctx, reqMsg)
diff --git a/internal/pkg/omcitst/omci_test_request.go b/internal/pkg/omcitst/omci_test_request.go
index dc79b27..2445855 100755
--- a/internal/pkg/omcitst/omci_test_request.go
+++ b/internal/pkg/omcitst/omci_test_request.go
@@ -33,15 +33,15 @@
// OmciTestRequest structure holds the information for the OMCI test
type OmciTestRequest struct {
- deviceID string
pDevOmciCC *cmn.OmciCC
+ verifyDone chan<- bool
+ deviceID string
+ txSeqNo uint16
extended bool
started bool
result bool
exclusiveCc bool
allowFailure bool
- txSeqNo uint16
- verifyDone chan<- bool
}
// CTestRequestOmciTimeout - Special OMCI timeout for low prio test request
@@ -52,6 +52,7 @@
deviceID string, omciCc *cmn.OmciCC, extended bool,
exclusive bool, allowFailure bool) *OmciTestRequest {
logger.Debug(ctx, "OmciTestRequest-init")
+ //nolint:govet
var OmciTestRequest OmciTestRequest
OmciTestRequest.deviceID = deviceID
OmciTestRequest.pDevOmciCC = omciCc
diff --git a/internal/pkg/pmmgr/onu_metrics_manager.go b/internal/pkg/pmmgr/onu_metrics_manager.go
index f7e43c5..11c6435 100755
--- a/internal/pkg/pmmgr/onu_metrics_manager.go
+++ b/internal/pkg/pmmgr/onu_metrics_manager.go
@@ -268,26 +268,27 @@
}
type groupMetric struct {
- groupName string
- Enabled bool
- Frequency uint32 // valid only if FrequencyOverride is enabled.
- metricMap map[string]voltha.PmConfig_PmType
NextCollectionInterval time.Time // valid only if FrequencyOverride is enabled.
- IsL2PMCounter bool // true for only L2 PM counters
- collectAttempts uint32 // number of attempts to collect L2 PM data
+ metricMap map[string]voltha.PmConfig_PmType
pmMEData *pmMEData
+ groupName string
+ Frequency uint32 // valid only if FrequencyOverride is enabled.
+ collectAttempts uint32 // number of attempts to collect L2 PM data
+ Enabled bool
+ IsL2PMCounter bool // true for only L2 PM counters
}
type standaloneMetric struct {
- metricName string
- Enabled bool
- Frequency uint32 // valid only if FrequencyOverride is enabled.
NextCollectionInterval time.Time // valid only if FrequencyOverride is enabled.
+ metricName string
+ Frequency uint32 // valid only if FrequencyOverride is enabled.
+ Enabled bool
}
// OnuMetricsManager - TODO: add comment
type OnuMetricsManager struct {
- deviceID string
+ NextGlobalMetricCollectionTime time.Time // valid only if pmConfig.FreqOverride is set to false.
+
pDeviceHandler cmn.IdeviceHandler
pOnuDeviceEntry cmn.IonuDeviceEntry
PAdaptFsm *cmn.AdapterFsm
@@ -300,41 +301,44 @@
l2PmCreateOrDeleteResponseChan chan bool // true is success, false is fail
extendedPMMeResponseChan chan me.Results // true is sucesss, false is fail
- activeL2Pms []string // list of active l2 pm MEs created on the ONU.
- l2PmToDelete []string // list of L2 PMs to delete
- l2PmToAdd []string // list of L2 PM to add
-
GroupMetricMap map[string]*groupMetric
StandaloneMetricMap map[string]*standaloneMetric
StopProcessingOmciResponses chan bool
- omciProcessingActive bool
- StopTicks chan bool
- tickGenerationActive bool
-
- deviceDeletionInProgress bool
+ StopTicks chan bool
GarbageCollectionComplete chan bool
- NextGlobalMetricCollectionTime time.Time // valid only if pmConfig.FreqOverride is set to false.
-
- OnuMetricsManagerLock sync.RWMutex
-
pmKvStore *db.Backend
- supportedEthernetFrameExtendedPMClass me.ClassID
ethernetFrameExtendedPmUpStreamMEByEntityID map[uint16]*me.ManagedEntity
ethernetFrameExtendedPmDownStreamMEByEntityID map[uint16]*me.ManagedEntity
extPmKvStore *db.Backend
- onuEthernetFrameExtendedPmLock sync.RWMutex
- isDeviceReadyToCollectExtendedPmStats bool
- isEthernetFrameExtendedPmOperationOngoing bool
- isExtendedOmci bool
- maxL2PMGetPayLoadSize int
onuOpticalMetricstimer *time.Timer
onuUniStatusMetricstimer *time.Timer
opticalMetricsDelCommChan chan bool
uniMetricsDelCommChan chan bool
+ deviceID string
+
+ activeL2Pms []string // list of active l2 pm MEs created on the ONU.
+ l2PmToDelete []string // list of L2 PMs to delete
+ l2PmToAdd []string // list of L2 PM to add
+
+ maxL2PMGetPayLoadSize int
+
+ OnuMetricsManagerLock sync.RWMutex
+
+ onuEthernetFrameExtendedPmLock sync.RWMutex
+
+ supportedEthernetFrameExtendedPMClass me.ClassID
+ omciProcessingActive bool
+
+ tickGenerationActive bool
+
+ deviceDeletionInProgress bool
+ isDeviceReadyToCollectExtendedPmStats bool
+ isEthernetFrameExtendedPmOperationOngoing bool
+ isExtendedOmci bool
}
// NewOnuMetricsManager returns a new instance of the NewOnuMetricsManager
@@ -1335,7 +1339,7 @@
}
// ** L2 PM FSM Handlers start **
-
+// nolint:unparam
func (mm *OnuMetricsManager) l2PMFsmStarting(ctx context.Context, e *fsm.Event) {
if mm.GetdeviceDeletionInProgress() {
logger.Infow(ctx, "device already deleted, return", log.Fields{"curr-state": mm.PAdaptFsm.PFsm.Current, "deviceID": mm.deviceID})
@@ -1388,6 +1392,7 @@
}()
}
+// nolint:unparam
func (mm *OnuMetricsManager) l2PMFsmSyncTime(ctx context.Context, e *fsm.Event) {
if mm.GetdeviceDeletionInProgress() {
logger.Infow(ctx, "device already deleted, return", log.Fields{"curr-state": mm.PAdaptFsm.PFsm.Current, "deviceID": mm.deviceID})
@@ -1441,6 +1446,8 @@
mm.GarbageCollectionComplete <- true
}
}
+
+// nolint:unparam
func (mm *OnuMetricsManager) l2PMFsmIdle(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "Enter state idle", log.Fields{"device-id": mm.deviceID})
if mm.GetdeviceDeletionInProgress() {
@@ -1470,6 +1477,7 @@
}
}
+// nolint:unparam
func (mm *OnuMetricsManager) l2PmFsmCollectData(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "state collect data", log.Fields{"device-id": mm.deviceID})
if mm.GetdeviceDeletionInProgress() {
@@ -1538,7 +1546,7 @@
}()
}
-// nolint: gocyclo
+// nolint: gocyclo,unparam
func (mm *OnuMetricsManager) l2PmFsmCreatePM(ctx context.Context, e *fsm.Event) error {
if mm.GetdeviceDeletionInProgress() {
logger.Infow(ctx, "device already deleted, return", log.Fields{"curr-state": mm.PAdaptFsm.PFsm.Current, "deviceID": mm.deviceID})
@@ -1577,8 +1585,8 @@
_ = p_pmFsm.PFsm.Event(L2PmEventFailure)
}(pPMFsm)
}
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteEthernetPerformanceMonitoringHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteEthernetPerformanceMonitoringHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
if resp = mm.waitForResponseOrTimeout(ctx, true, entityID, "EthernetFramePerformanceMonitoringHistoryData"); resp {
atLeastOneSuccess = true
@@ -1610,8 +1618,8 @@
logger.Errorw(ctx, "CreateOrDeleteEthernetUNIHistoryME failed, failure PM FSM!",
log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteEthernetUniHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteEthernetUniHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
if resp = mm.waitForResponseOrTimeout(ctx, true, entityID, "EthernetPerformanceMonitoringHistoryData"); resp {
atLeastOneSuccess = true
@@ -1637,8 +1645,8 @@
logger.Errorw(ctx, "CreateOrDeleteFecHistoryME failed, failure PM FSM!",
log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteFecHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteFecHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
_ = mm.updatePmData(ctx, n, anigInstID, cPmAdd) // TODO: ignore error for now
inner3:
@@ -1682,8 +1690,8 @@
logger.Errorw(ctx, "CreateOrDeleteGemPortHistoryME failed, failure PM FSM!",
log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteGemPortHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteGemPortHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
_ = mm.updatePmData(ctx, n, v, cPmAdd) // TODO: ignore error for now
inner4:
@@ -1746,7 +1754,7 @@
return nil
}
-// nolint: gocyclo
+// nolint: gocyclo,unparam
func (mm *OnuMetricsManager) l2PmFsmDeletePM(ctx context.Context, e *fsm.Event) error {
if mm.GetdeviceDeletionInProgress() {
logger.Infow(ctx, "device already deleted, return", log.Fields{"curr-state": mm.PAdaptFsm.PFsm.Current, "deviceID": mm.deviceID})
@@ -1795,12 +1803,13 @@
log.Fields{"device-id": mm.deviceID})
pPMFsm := mm.PAdaptFsm
if pPMFsm != nil {
+ //nolint: unparam
go func(p_pmFsm *cmn.AdapterFsm) {
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
}(pPMFsm)
}
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteEthernetPerformanceMonitoringHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteEthernetPerformanceMonitoringHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
_ = mm.updatePmData(ctx, n, entityID, cPmRemove) // TODO: ignore error for now
if resp = mm.waitForResponseOrTimeout(ctx, false, entityID, "EthernetFramePerformanceMonitoringHistoryData"); !resp {
@@ -1836,8 +1845,8 @@
}(pmFsm)
return err
}
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteEthernetUniHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteEthernetUniHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
if resp = mm.waitForResponseOrTimeout(ctx, false, entityID, "EthernetPerformanceMonitoringHistoryData"); !resp {
if mm.GetdeviceDeletionInProgress() {
@@ -1865,10 +1874,10 @@
logger.Errorw(ctx, "CreateOrDeleteFecHistoryME failed, failure PM FSM!",
log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteFecHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteFecHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
- if resp := mm.waitForResponseOrTimeout(ctx, false, entityID, "FecPerformanceMonitoringHistoryData"); !resp {
+ if resp = mm.waitForResponseOrTimeout(ctx, false, entityID, "FecPerformanceMonitoringHistoryData"); !resp {
if mm.GetdeviceDeletionInProgress() {
logger.Debugw(ctx, "device deleted, no more pm processing", log.Fields{"deviceID": mm.deviceID})
return nil
@@ -1894,8 +1903,8 @@
logger.Errorw(ctx, "CreateOrDeleteGemPortHistoryME failed, failure PM FSM!",
log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("CreateOrDeleteGemPortHistoryMe-failed-%s-%s",
- mm.deviceID, err))
+ return fmt.Errorf("CreateOrDeleteGemPortHistoryMe-failed-%s-%s",
+ mm.deviceID, err)
}
if resp = mm.waitForResponseOrTimeout(ctx, false, entityID, "GemPortNetworkCtpPerformanceMonitoringHistoryData"); !resp {
if mm.GetdeviceDeletionInProgress() {
@@ -2138,7 +2147,7 @@
}(pmFsm)
return err
}
- return fmt.Errorf(fmt.Sprintf("GetME-failed-%s-%s", mm.deviceID, err))
+ return fmt.Errorf("GetME-failed-%s-%s", mm.deviceID, err)
}
if meInstance != nil {
select {
@@ -2241,7 +2250,7 @@
if err != nil {
logger.Errorw(ctx, "GetMe failed, failure PM FSM!", log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("GetME-failed-%s-%s", mm.deviceID, err))
+ return fmt.Errorf("GetME-failed-%s-%s", mm.deviceID, err)
}
if meInstance != nil {
select {
@@ -2344,7 +2353,7 @@
if err != nil {
logger.Errorw(ctx, "GetMe failed, failure PM FSM!", log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("GetME-failed-%s-%s", mm.deviceID, err))
+ return fmt.Errorf("GetME-failed-%s-%s", mm.deviceID, err)
}
if meInstance != nil {
select {
@@ -2411,7 +2420,7 @@
if err != nil {
logger.Errorw(ctx, "GetMe failed", log.Fields{"device-id": mm.deviceID})
_ = mm.PAdaptFsm.PFsm.Event(L2PmEventFailure)
- return fmt.Errorf(fmt.Sprintf("GetME-failed-%s-%s", mm.deviceID, err))
+ return fmt.Errorf("GetME-failed-%s-%s", mm.deviceID, err)
}
if meInstance != nil {
select {
@@ -2572,6 +2581,7 @@
}
}
+// nolint: unparam
func (mm *OnuMetricsManager) populateGroupSpecificMetrics(ctx context.Context, mEnt *me.ManagedEntity, classID me.ClassID, entityID uint16,
meAttributes me.AttributeValueMap, data map[string]float32, intervalEndTime *int) error {
var grpFunc groupMetricPopulateFunc
@@ -2684,6 +2694,7 @@
return false
}
+// nolint: unparam
func (mm *OnuMetricsManager) initializeGroupMetric(grpMtrcs map[string]voltha.PmConfig_PmType, grpName string, grpEnabled bool, grpFreq uint32) {
var pmConfigSlice []*voltha.PmConfig
for k, v := range grpMtrcs {
@@ -2910,7 +2921,7 @@
logger.Debugw(ctx, "restorePmData - start", log.Fields{"device-id": mm.deviceID})
if mm.pmKvStore == nil {
logger.Errorw(ctx, "pmKvStore not set - abort", log.Fields{"device-id": mm.deviceID})
- return fmt.Errorf(fmt.Sprintf("pmKvStore-not-set-abort-%s", mm.deviceID))
+ return fmt.Errorf("pmKvStore-not-set-abort-%s", mm.deviceID)
}
var errorsList []error
for groupName, group := range mm.GroupMetricMap {
@@ -2924,7 +2935,7 @@
if err = json.Unmarshal(tmpBytes, &group.pmMEData); err != nil {
logger.Errorw(ctx, "unable to unmarshal PM data", log.Fields{"error": err, "device-id": mm.deviceID})
- errorsList = append(errorsList, fmt.Errorf(fmt.Sprintf("unable-to-unmarshal-PM-data-%s-for-group-%s", mm.deviceID, groupName)))
+ errorsList = append(errorsList, fmt.Errorf("unable-to-unmarshal-PM-data-%s-for-group-%s", mm.deviceID, groupName))
continue
}
logger.Debugw(ctx, "restorePmData - success", log.Fields{"pmData": group.pmMEData, "groupName": groupName, "device-id": mm.deviceID})
@@ -2934,7 +2945,7 @@
}
} else {
logger.Errorw(ctx, "restorePmData - fail", log.Fields{"device-id": mm.deviceID, "groupName": groupName, "err": err})
- errorsList = append(errorsList, fmt.Errorf(fmt.Sprintf("unable-to-read-from-KVstore-%s-for-group-%s", mm.deviceID, groupName)))
+ errorsList = append(errorsList, fmt.Errorf("unable-to-read-from-KVstore-%s-for-group-%s", mm.deviceID, groupName))
continue
}
}
@@ -2990,7 +3001,7 @@
if mm.pmKvStore == nil {
logger.Errorw(ctx, "pmKvStore not set - abort", log.Fields{"device-id": mm.deviceID})
- return fmt.Errorf(fmt.Sprintf("pmKvStore-not-set-abort-%s", mm.deviceID))
+ return fmt.Errorf("pmKvStore-not-set-abort-%s", mm.deviceID)
}
pmMEData, err := mm.getPmData(ctx, groupName)
@@ -3017,7 +3028,7 @@
pmMEData.InstancesActive = mm.removeIfFoundUint16(pmMEData.InstancesActive, meInstanceID)
default:
logger.Errorw(ctx, "unknown pm action", log.Fields{"device-id": mm.deviceID, "pmAction": pmAction, "groupName": groupName})
- return fmt.Errorf(fmt.Sprintf("unknown-pm-action-deviceid-%s-groupName-%s-pmaction-%s", mm.deviceID, groupName, pmAction))
+ return fmt.Errorf("unknown-pm-action-deviceid-%s-groupName-%s-pmaction-%s", mm.deviceID, groupName, pmAction)
}
// write through cache
mm.GroupMetricMap[groupName].pmMEData = pmMEData
@@ -3047,7 +3058,7 @@
logger.Debugw(ctx, "clearPmGroupData - start", log.Fields{"device-id": mm.deviceID})
if mm.pmKvStore == nil {
logger.Errorw(ctx, "pmKvStore not set - abort", log.Fields{"device-id": mm.deviceID})
- return fmt.Errorf(fmt.Sprintf("pmKvStore-not-set-abort-%s", mm.deviceID))
+ return fmt.Errorf("pmKvStore-not-set-abort-%s", mm.deviceID)
}
for n := range mm.GroupMetricMap {
@@ -3069,7 +3080,7 @@
logger.Debugw(ctx, "ClearAllPmData - start", log.Fields{"device-id": mm.deviceID})
if mm.pmKvStore == nil {
logger.Errorw(ctx, "pmKvStore not set - abort", log.Fields{"device-id": mm.deviceID})
- return fmt.Errorf(fmt.Sprintf("pmKvStore-not-set-abort-%s", mm.deviceID))
+ return fmt.Errorf("pmKvStore-not-set-abort-%s", mm.deviceID)
}
var value error
for n := range mm.GroupMetricMap {
@@ -3290,6 +3301,7 @@
}
if exist {
// we have the me type, go ahead with the me type supported.
+ //nolint:govet
if _, err := mm.tryCreateExtPmMe(ctx, mm.supportedEthernetFrameExtendedPMClass); err != nil {
logger.Errorw(ctx, "unable-to-create-me-type", log.Fields{"device-id": mm.deviceID,
"meClassID": mm.supportedEthernetFrameExtendedPMClass})
@@ -3306,6 +3318,7 @@
log.Fields{"device-id": mm.deviceID, "meClassID": me.EthernetFrameExtendedPm64BitClassID,
"supported": supported64Bit})
// Then Try with 32 bit type
+ //nolint:govet
if supported32Bit, err := mm.tryCreateExtPmMe(ctx, me.EthernetFrameExtendedPmClassID); err != nil {
logger.Errorw(ctx, "unable-to-create-me-type", log.Fields{"device-id": mm.deviceID,
"meClassID": me.EthernetFrameExtendedPmClassID, "supported": supported32Bit})
@@ -3540,6 +3553,7 @@
return &singleValResp
}
+// nolint:unparam
func (mm *OnuMetricsManager) collectEthernetFrameExtendedPMData(ctx context.Context, meEnt *me.ManagedEntity, entityID uint16, upstream bool, receivedMask *uint16) (map[string]uint64, extension.GetValueResponse_ErrorReason, error) {
var classID me.ClassID
logger.Debugw(ctx, "collecting-data-for-ethernet-frame-extended-pm", log.Fields{"device-id": mm.deviceID, "entityID": entityID, "upstream": upstream})
@@ -3616,7 +3630,7 @@
}
}
-// nolint: gocyclo
+// nolint: gocyclo,unparam
func (mm *OnuMetricsManager) getEthFrameExtPMDataFromResponse(ctx context.Context, ethFrameExtPMData map[string]uint64, meAttributes me.AttributeValueMap, requestedAttributesMask uint16) uint16 {
receivedMask := uint16(0)
switch requestedAttributesMask {
@@ -3751,7 +3765,7 @@
return receivedMask
}
-// nolint: gocyclo
+// nolint: gocyclo,unparam
func (mm *OnuMetricsManager) getEthFrameExtPM64BitDataFromResponse(ctx context.Context, ethFrameExtPMData map[string]uint64, meAttributes me.AttributeValueMap, requestedAttributesMask uint16) uint16 {
receivedMask := uint16(0)
switch requestedAttributesMask {
@@ -3993,6 +4007,7 @@
return pmDataOut
}
+//nolint:unparam
func (mm *OnuMetricsManager) getControlBlockForExtendedPMDirection(ctx context.Context, upstream bool, entityID uint16, reset bool) []uint16 {
controlBlock := make([]uint16, 8)
// Control Block First two bytes are for threshold data 1/2 id - does not matter here
diff --git a/internal/pkg/swupg/adapter_download_manager.go b/internal/pkg/swupg/adapter_download_manager.go
index 4c6f291..8dabf08 100755
--- a/internal/pkg/swupg/adapter_download_manager.go
+++ b/internal/pkg/swupg/adapter_download_manager.go
@@ -45,8 +45,8 @@
// AdapterDownloadManager structure holds information needed for downloading to and storing images within the adapter
type AdapterDownloadManager struct {
- mutexDownloadImageDsc sync.RWMutex
downloadImageDscSlice []*voltha.ImageDownload
+ mutexDownloadImageDsc sync.RWMutex
}
// NewAdapterDownloadManager constructor returns a new instance of a AdapterDownloadManager
@@ -200,7 +200,7 @@
}
// Create the file
- aLocalPathName := aFilePath + "/" + aFileName
+ aLocalPathName := filepath.Clean(filepath.Join(aFilePath, aFileName))
file, err := os.Create(aLocalPathName)
if err != nil {
logger.Errorw(ctx, "could not create local file", log.Fields{"path_file": aLocalPathName, "error": err})
@@ -269,7 +269,7 @@
return nil, err
}
defer func() {
- err := file.Close()
+ err = file.Close()
if err != nil {
logger.Errorw(ctx, "failed to close file", log.Fields{"error": err})
}
diff --git a/internal/pkg/swupg/file_download_manager.go b/internal/pkg/swupg/file_download_manager.go
index 05ffcf9..1893b4d 100755
--- a/internal/pkg/swupg/file_download_manager.go
+++ b/internal/pkg/swupg/file_download_manager.go
@@ -52,24 +52,24 @@
)
type downloadImageParams struct {
+ downloadContextCancelFn context.CancelFunc
downloadImageName string
downloadImageURL string
- downloadImageState FileState
downloadImageLen int64
+ downloadImageState FileState
downloadImageCRC uint32
downloadActive bool
- downloadContextCancelFn context.CancelFunc
}
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
type FileDownloadManager struct {
+ dnldImgReadyWaiting map[string]requesterChannelMap
+ downloadImageDscSlice []downloadImageParams
+ dlToAdapterTimeout time.Duration
mutexFileState sync.RWMutex
mutexDownloadImageDsc sync.RWMutex
- downloadImageDscSlice []downloadImageParams
- dnldImgReadyWaiting map[string]requesterChannelMap
- dlToAdapterTimeout time.Duration
}
// NewFileDownloadManager constructor returns a new instance of a FileDownloadManager
@@ -163,7 +163,7 @@
return nil, err
}
defer func() {
- err := file.Close()
+ err = file.Close()
if err != nil {
logger.Errorw(ctx, "failed to close file", log.Fields{"error": err})
}
@@ -376,13 +376,14 @@
//trying to download - do it in background as it may take some time ...
go func() {
+ var cancel context.CancelFunc
req, err2 := http.NewRequest("GET", urlBase.String(), nil)
if err2 != nil {
logger.Errorw(ctx, "could not generate http request", log.Fields{"url": urlBase.String(), "error": err2})
dm.removeImage(ctx, aFileName, false) //wo FileSystem access
return
}
- ctx, cancel := context.WithDeadline(ctx, time.Now().Add(dm.dlToAdapterTimeout)) //timeout as given from SetDownloadTimeout()
+ ctx, cancel = context.WithDeadline(ctx, time.Now().Add(dm.dlToAdapterTimeout)) //timeout as given from SetDownloadTimeout()
dm.updateDownloadCancel(ctx, aFileName, cancel)
defer cancel()
_ = req.WithContext(ctx)
@@ -406,7 +407,7 @@
}()
// Create the file
- aLocalPathName := aFilePath + "/" + aFileName
+ aLocalPathName := filepath.Clean(filepath.Join(aFilePath, aFileName))
file, err := os.Create(aLocalPathName)
if err != nil {
logger.Errorw(ctx, "could not create local file", log.Fields{"path_file": aLocalPathName, "error": err})
diff --git a/internal/pkg/swupg/omci_onu_upgrade.go b/internal/pkg/swupg/omci_onu_upgrade.go
index 3da4913..5c54762 100755
--- a/internal/pkg/swupg/omci_onu_upgrade.go
+++ b/internal/pkg/swupg/omci_onu_upgrade.go
@@ -140,58 +140,58 @@
// 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
+ pDevEntry cmn.IonuDeviceEntry
pDownloadManager *AdapterDownloadManager
pFileManager *FileDownloadManager //used from R2.8 with new API version
- deviceID string
- pDevEntry cmn.IonuDeviceEntry
pOmciCC *cmn.OmciCC
pOnuDB *devdb.OnuDeviceDB
- requestEvent cmn.OnuDeviceEvent
//omciMIdsResponseReceived chan bool //seperate channel needed for checking multiInstance OMCI message responses
PAdaptFsm *cmn.AdapterFsm
pImageDsc *voltha.ImageDownload
- imageBuffer []byte
- origImageLength uint32 //as also limited by OMCI
- imageCRC uint32 //as per OMCI - ITU I.363.5 crc
- imageLength uint32 //including last bytes padding
- omciDownloadWindowSizeLimit uint8 //windowSize-1 in sections
- omciDownloadWindowSizeLast uint8 //number of sections in last window
- noOfSections uint32 //uint32 range for sections should be sufficient for very long images
- nextDownloadSectionsAbsolute uint32 //number of next section to download in overall image
- nextDownloadSectionsWindow uint8 //number of next section to download within current window
- noOfWindows uint32 //uint32 range for windows should be sufficient for very long images
- nextDownloadWindow uint32 //number of next window to download
- InactiveImageMeID uint16 //ME-ID of the inactive image
- downloadToOnuTimeout4MB time.Duration //timeout for downloading the image to the ONU for a 4MB image slice
- omciSectionInterleaveDelay time.Duration //DownloadSectionInterleave delay in milliseconds
- delayEndSwDl bool //flag to provide a delay between last section and EndSwDl
- repeatAbort bool //flag to indicate if OMCI EndSwDownload (abort) is to be repeated
pLastTxMeInstance *me.ManagedEntity
- waitCountEndSwDl uint8 //number, how often is waited for EndSwDl at maximum
- waitDelayEndSwDl time.Duration //duration, how long is waited before next request on EndSwDl
chReceiveExpectedResponse chan bool
- useAPIVersion43 bool //flag for indication on which API version is used (and accordingly which specific methods)
- mutexUpgradeParams sync.RWMutex //mutex to protect members for parallel function requests and omci response processing
- imageVersion string //name of the image as used within OMCI (and on extrenal API interface)
- imageIdentifier string //name of the image as used in the adapter
- mutexIsAwaitingAdapterDlResponse sync.RWMutex
chAdapterDlReady chan bool
chAbortDelayEndSwDl chan struct{}
- isWaitingForAdapterDlResponse bool
chOnuDlReady chan bool
- activateImage bool
- commitImage bool
+ chReceiveAbortEndSwDlResponse chan tEndSwDlResponseResult
+ deviceID string
+ imageVersion string //name of the image as used within OMCI (and on extrenal API interface)
+ imageIdentifier string //name of the image as used in the adapter
+ imageBuffer []byte
+ requestEvent cmn.OnuDeviceEvent
+ downloadToOnuTimeout4MB time.Duration //timeout for downloading the image to the ONU for a 4MB image slice
+ omciSectionInterleaveDelay time.Duration //DownloadSectionInterleave delay in milliseconds
+ waitDelayEndSwDl time.Duration //duration, how long is waited before next request on EndSwDl
+ omciDownloadSectionSize int64
+ mutexUpgradeParams sync.RWMutex //mutex to protect members for parallel function requests and omci response processing
+ mutexIsAwaitingAdapterDlResponse sync.RWMutex
mutexAbortRequest sync.RWMutex
+ origImageLength uint32 //as also limited by OMCI
+ imageCRC uint32 //as per OMCI - ITU I.363.5 crc
+ imageLength uint32 //including last bytes padding
+ noOfSections uint32 //uint32 range for sections should be sufficient for very long images
+ nextDownloadSectionsAbsolute uint32 //number of next section to download in overall image
+ noOfWindows uint32 //uint32 range for windows should be sufficient for very long images
+ nextDownloadWindow uint32 //number of next window to download
abortRequested voltha.ImageState_ImageFailureReason
- conditionalCancelRequested bool
- upgradePhase tUpgradePhase
volthaDownloadState voltha.ImageState_ImageDownloadState
volthaDownloadReason voltha.ImageState_ImageFailureReason
volthaImageState voltha.ImageState_ImageActivationState
+ InactiveImageMeID uint16 //ME-ID of the inactive image
+ omciDownloadWindowSizeLimit uint8 //windowSize-1 in sections
+ omciDownloadWindowSizeLast uint8 //number of sections in last window
+ nextDownloadSectionsWindow uint8 //number of next section to download within current window
+ delayEndSwDl bool //flag to provide a delay between last section and EndSwDl
+ repeatAbort bool //flag to indicate if OMCI EndSwDownload (abort) is to be repeated
+ waitCountEndSwDl uint8 //number, how often is waited for EndSwDl at maximum
+ useAPIVersion43 bool //flag for indication on which API version is used (and accordingly which specific methods)
+ isWaitingForAdapterDlResponse bool
+ activateImage bool
+ commitImage bool
+ conditionalCancelRequested bool
+ upgradePhase tUpgradePhase
isEndSwDlOpen bool
- chReceiveAbortEndSwDlResponse chan tEndSwDlResponseResult
isExtendedOmci bool
- omciDownloadSectionSize int64
}
// NewOnuUpgradeFsm is the 'constructor' for the state machine to config the PON ANI ports
@@ -341,7 +341,7 @@
}
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer or state", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("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
@@ -374,7 +374,7 @@
oFsm.mutexUpgradeParams.Unlock()
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer or state", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("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
@@ -391,8 +391,8 @@
logger.Errorw(ctx, "OnuUpgradeFsm abort: mismatching upgrade image", log.Fields{
"device-id": oFsm.deviceID, "request-image": aImageIdentifier, "fsm-image": oFsm.imageIdentifier})
oFsm.mutexUpgradeParams.Unlock()
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm params ignored: requested image-name not used in current upgrade for device-id: %s",
- oFsm.deviceID))
+ return fmt.Errorf("OnuUpgradeFsm params ignored: requested image-name not used in current upgrade for device-id: %s",
+ oFsm.deviceID)
}
oFsm.activateImage = true
oFsm.commitImage = aCommit
@@ -413,7 +413,7 @@
}
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID)
}
// SetActivationParamsStart starts upgrade processing with immediate activation
@@ -443,7 +443,7 @@
oFsm.mutexUpgradeParams.Unlock()
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer or state", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("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
@@ -461,8 +461,8 @@
"device-id": oFsm.deviceID, "request-identifier": aImageIdentifier, "fsm-identifier": oFsm.imageIdentifier,
"request-version": aImageVersion, "fsm-version": oFsm.imageVersion})
oFsm.mutexUpgradeParams.Unlock()
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm params ignored: requested image-name not used in current upgrade for device-id: %s",
- oFsm.deviceID))
+ return fmt.Errorf("OnuUpgradeFsm params ignored: requested image-name not used in current upgrade for device-id: %s",
+ oFsm.deviceID)
}
oFsm.commitImage = true
oFsm.mutexUpgradeParams.Unlock()
@@ -480,7 +480,7 @@
//should never occur
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("OnuUpgradeFsm abort: invalid FSM base pointer for device-id: %s", oFsm.deviceID)
}
// SetCommitmentParamsStart starts upgrade processing with immediate commitment
@@ -508,7 +508,7 @@
oFsm.mutexUpgradeParams.Unlock()
logger.Errorw(ctx, "OnuUpgradeFsm abort: invalid FSM base pointer or state", log.Fields{
"device-id": oFsm.deviceID})
- return fmt.Errorf(fmt.Sprintf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID))
+ return fmt.Errorf("OnuUpgradeFsm abort: invalid FSM base pointer or state for device-id: %s", oFsm.deviceID)
}
// GetCommitFlag delivers the commit flag that was configured here
@@ -733,6 +733,7 @@
oFsm.isEndSwDlOpen = true
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterDownloadSection(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm start downloading sections", log.Fields{
"device-id": oFsm.deviceID, "absolute window": oFsm.nextDownloadWindow})
@@ -866,12 +867,13 @@
}
}
} //runSwDlSectionWindow
-
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterVerifyWindow(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm verify DL window ack", log.Fields{
"for window": oFsm.nextDownloadWindow, "device-id": oFsm.deviceID})
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterFinalizeDL(ctx context.Context, e *fsm.Event) {
logger.Infow(ctx, "OnuUpgradeFsm finalize DL", log.Fields{
"device-id": oFsm.deviceID, "crc": strconv.FormatInt(int64(oFsm.imageCRC), 16), "delay": oFsm.delayEndSwDl})
@@ -931,6 +933,7 @@
_ = pBaseFsm.PFsm.Event(UpgradeEvWaitEndDownload)
} //delayAndSendEndSwDl
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterWaitEndDL(ctx context.Context, e *fsm.Event) {
logger.Infow(ctx, "OnuUpgradeFsm WaitEndDl", log.Fields{
"device-id": oFsm.deviceID, "wait delay": oFsm.waitDelayEndSwDl * time.Second, "wait count": oFsm.waitCountEndSwDl})
@@ -1008,6 +1011,7 @@
}
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterCheckImageName(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm checking downloaded image name", log.Fields{
"device-id": oFsm.deviceID, "me-id": oFsm.InactiveImageMeID})
@@ -1024,6 +1028,7 @@
oFsm.pLastTxMeInstance = meInstance
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterActivateSw(ctx context.Context, e *fsm.Event) {
logger.Infow(ctx, "OnuUpgradeFsm activate SW", log.Fields{
"device-id": oFsm.deviceID, "me-id": oFsm.InactiveImageMeID})
@@ -1042,6 +1047,7 @@
oFsm.mutexUpgradeParams.Unlock()
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterCommitSw(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm start commit SW", log.Fields{
"device-id": oFsm.deviceID, "me-id": oFsm.InactiveImageMeID})
@@ -1086,6 +1092,7 @@
}(pBaseFsm)
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterCheckCommitted(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm checking committed SW", log.Fields{
"device-id": oFsm.deviceID, "me-id": oFsm.InactiveImageMeID})
@@ -1102,6 +1109,7 @@
oFsm.pLastTxMeInstance = meInstance
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterResetting(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm resetting", log.Fields{"device-id": oFsm.deviceID})
@@ -1143,6 +1151,7 @@
}
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterAbortingDL(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm aborting download to ONU", log.Fields{"device-id": oFsm.deviceID})
@@ -1218,6 +1227,7 @@
return false
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterRestarting(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm restarting", log.Fields{"device-id": oFsm.deviceID})
pConfigUpgradeStateAFsm := oFsm.PAdaptFsm
@@ -1241,6 +1251,7 @@
}
}
+//nolint:unparam
func (oFsm *OnuUpgradeFsm) enterDisabled(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "OnuUpgradeFsm enters disabled state", log.Fields{"device-id": oFsm.deviceID})
// no need to flush possible channels here, Upgrade FSM will be completely removed, garbage collector should find its way
@@ -1959,6 +1970,8 @@
}
// stateUpdateOnReset writes the download and/or image state on entering the reset state according to FSM internal indications
+//
+//nolint:unparam
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 4423e2c..e432c58 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -33,16 +33,16 @@
// OnuImageStatus implements methods to get status info of onu images
type OnuImageStatus struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pDevEntry cmn.IonuDeviceEntry
pOmciCC *cmn.OmciCC
requestedAttributes me.AttributeValueMap
- mutexWaitingForResp sync.RWMutex
- waitingForResp bool
respChannel chan cmn.Message
- mutexPLastTxMeInstance sync.RWMutex
pLastTxMeInstance *me.ManagedEntity
+ deviceID string
+ mutexWaitingForResp sync.RWMutex
+ mutexPLastTxMeInstance sync.RWMutex
+ waitingForResp bool
isExtendedOmci bool
}
diff --git a/internal/pkg/uniprt/uniportadmin.go b/internal/pkg/uniprt/uniportadmin.go
index 0461ac5..2910f2e 100755
--- a/internal/pkg/uniprt/uniportadmin.go
+++ b/internal/pkg/uniprt/uniportadmin.go
@@ -33,17 +33,17 @@
// LockStateFsm defines the structure for the state machine to lock/unlock the ONU UNI ports via OMCI
type LockStateFsm struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pOnuDeviceEntry cmn.IonuDeviceEntry
pOmciCC *cmn.OmciCC
- mutexAdminState sync.RWMutex
- adminState bool
- requestEvent cmn.OnuDeviceEvent
omciLockResponseReceived chan bool //seperate channel needed for checking UNI port OMCi message responses
PAdaptFsm *cmn.AdapterFsm
- mutexPLastTxMeInstance sync.RWMutex
pLastTxMeInstance *me.ManagedEntity
+ deviceID string
+ requestEvent cmn.OnuDeviceEvent
+ mutexAdminState sync.RWMutex
+ mutexPLastTxMeInstance sync.RWMutex
+ adminState bool
}
// events of lock/unlock UNI port FSM
@@ -439,11 +439,12 @@
if (omciAdminState == 1) || (1<<uniPort.UniID)&oFsm.pDeviceHandler.GetUniPortMask() == (1<<uniPort.UniID) {
var meInstance *me.ManagedEntity
+ var err error
if uniPort.PortType == cmn.UniPPTP {
logger.Debugw(ctx, "Setting PPTP admin state", log.Fields{
"device-id": oFsm.deviceID, "for PortNo": uniNo, "state (0-unlock)": omciAdminState})
oFsm.mutexPLastTxMeInstance.Lock()
- meInstance, err := oFsm.pOmciCC.SendSetPptpEthUniLS(log.WithSpanFromContext(context.TODO(), ctx),
+ meInstance, err = oFsm.pOmciCC.SendSetPptpEthUniLS(log.WithSpanFromContext(context.TODO(), ctx),
uniPort.EntityID, oFsm.pDeviceHandler.GetOmciTimeout(),
true, requestedAttributes, oFsm.PAdaptFsm.CommChan)
if err != nil {
@@ -463,7 +464,7 @@
logger.Debugw(ctx, "Setting VEIP admin state", log.Fields{
"device-id": oFsm.deviceID, "for PortNo": uniNo, "state (0-unlock)": omciAdminState})
oFsm.mutexPLastTxMeInstance.Lock()
- meInstance, err := oFsm.pOmciCC.SendSetVeipLS(log.WithSpanFromContext(context.TODO(), ctx),
+ meInstance, err = oFsm.pOmciCC.SendSetVeipLS(log.WithSpanFromContext(context.TODO(), ctx),
uniPort.EntityID, oFsm.pDeviceHandler.GetOmciTimeout(),
true, requestedAttributes, oFsm.PAdaptFsm.CommChan)
if err != nil {
@@ -501,7 +502,7 @@
oFsm.mutexPLastTxMeInstance.RUnlock()
//verify response
- err := oFsm.waitforOmciResponse(ctx, meInstance)
+ err = oFsm.waitforOmciResponse(ctx, meInstance)
if err != nil {
logger.Errorw(ctx, "UniTP Admin State set failed, aborting LockState set!",
log.Fields{"device-id": oFsm.deviceID, "Port": uniNo})
@@ -520,6 +521,7 @@
_ = oFsm.PAdaptFsm.PFsm.Event(UniEvRxUnisResp)
}
+//nolint:unparam
func (oFsm *LockStateFsm) waitforOmciResponse(ctx context.Context, apMeInstance *me.ManagedEntity) error {
select {
// maybe be also some outside cancel (but no context modeled for the moment ...)
diff --git a/internal/pkg/uniprt/uniportstatus.go b/internal/pkg/uniprt/uniportstatus.go
index 5dc9d1b..a680f56 100755
--- a/internal/pkg/uniprt/uniportstatus.go
+++ b/internal/pkg/uniprt/uniportstatus.go
@@ -32,11 +32,11 @@
// UniPortStatus implements methods to get uni port status info
type UniPortStatus struct {
- deviceID string
pDeviceHandler cmn.IdeviceHandler
pOmiCC *cmn.OmciCC
omciRespChn chan cmn.Message
pLastTxMeInstance *me.ManagedEntity
+ deviceID string
}
// NewUniPortStatus creates a new instance of UniPortStatus
@@ -78,6 +78,7 @@
return PostUniStatusErrResponse(extension.GetValueResponse_INVALID_PORT_TYPE)
}
+//nolint:unparam // ctx and apMeInstance are required by interface
func (portStatus *UniPortStatus) waitforGetUniPortStatus(ctx context.Context, apMeInstance *me.ManagedEntity) *extension.SingleGetValueResponse {
select {