[VOL-5475] upgrade go to 1.24.5 and golangci-lint version to 2.2.2
Signed-off-by: mgouda <madhumati.gouda@radisys.com>
Change-Id: I0d7ded6f836ae4a579d0167b491f01e10ada4b13
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index aeeef16..337a97b 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -45,13 +45,10 @@
"github.com/opencord/voltha-openonu-adapter-go/internal/pkg/swupg"
uniprt "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/uniprt"
"github.com/opencord/voltha-protos/v5/go/common"
- vc "github.com/opencord/voltha-protos/v5/go/common"
ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
"github.com/opencord/voltha-protos/v5/go/extension"
- "github.com/opencord/voltha-protos/v5/go/inter_adapter"
ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
of "github.com/opencord/voltha-protos/v5/go/openflow_13"
- "github.com/opencord/voltha-protos/v5/go/openolt"
oop "github.com/opencord/voltha-protos/v5/go/openolt"
"github.com/opencord/voltha-protos/v5/go/tech_profile"
"github.com/opencord/voltha-protos/v5/go/voltha"
@@ -3157,7 +3154,7 @@
// only if this port is validated for operState transfer
if (1<<uniPort.UniID)&dh.pOpenOnuAc.config.UniPortMask == (1 << uniPort.UniID) {
logger.Infow(ctx, "OnuUniPort-forced-OperState-ACTIVE", log.Fields{"for PortNo": uniNo, "device-id": dh.DeviceID})
- uniPort.SetOperState(vc.OperStatus_ACTIVE)
+ uniPort.SetOperState(common.OperStatus_ACTIVE)
if !dh.IsReconciling() {
//maybe also use getter functions on uniPort - perhaps later ...
go func(port *cmn.OnuUniPort) {
@@ -3186,7 +3183,7 @@
if (1<<uniPort.UniID)&dh.pOpenOnuAc.config.UniPortMask == (1 << uniPort.UniID) {
logger.Infow(ctx, "OnuUniPort-forced-OperState-UNKNOWN", log.Fields{"for PortNo": uniNo, "device-id": dh.DeviceID})
- uniPort.SetOperState(vc.OperStatus_UNKNOWN)
+ uniPort.SetOperState(common.OperStatus_UNKNOWN)
if !dh.IsReconciling() {
//maybe also use getter functions on uniPort - perhaps later ...
go func(port *cmn.OnuUniPort) {
@@ -3209,7 +3206,7 @@
// ONU_Active/Inactive announcement on system KAFKA bus
// tried to re-use procedure of oltUpDownIndication from openolt_eventmgr.go with used values from Py code
-func (dh *deviceHandler) sendOnuOperStateEvent(ctx context.Context, aOperState vc.OperStatus_Types, aDeviceID string, raisedTs int64) {
+func (dh *deviceHandler) sendOnuOperStateEvent(ctx context.Context, aOperState common.OperStatus_Types, aDeviceID string, raisedTs int64) {
var de voltha.DeviceEvent
eventContext := make(map[string]string)
//Populating event context
@@ -3544,8 +3541,8 @@
{
*loMatchVlan = uint16(field.GetVlanVid())
loMatchVlanMask := uint16(field.GetVlanVidMask())
- if !(*loMatchVlan == uint16(of.OfpVlanId_OFPVID_PRESENT) &&
- loMatchVlanMask == uint16(of.OfpVlanId_OFPVID_PRESENT)) {
+ if *loMatchVlan != uint16(of.OfpVlanId_OFPVID_PRESENT) ||
+ loMatchVlanMask != uint16(of.OfpVlanId_OFPVID_PRESENT) {
*loMatchVlan = *loMatchVlan & 0xFFF // not transparent: copy only ID bits
}
logger.Debugw(ctx, "flow field type", log.Fields{"device-id": dh.DeviceID,
@@ -3640,8 +3637,8 @@
// addFlowItemToUniPort parses the actual flow item to add it to the UniPort
func (dh *deviceHandler) addFlowItemToUniPort(ctx context.Context, apFlowItem *of.OfpFlowStats, apUniPort *cmn.OnuUniPort,
apFlowMetaData *of.FlowMetadata, respChan *chan error) {
- var loSetVlan uint16 = uint16(of.OfpVlanId_OFPVID_NONE) //noValidEntry
- var loMatchVlan uint16 = uint16(of.OfpVlanId_OFPVID_PRESENT) //reserved VLANID entry
+ var loSetVlan = uint16(of.OfpVlanId_OFPVID_NONE) //noValidEntry
+ var loMatchVlan = uint16(of.OfpVlanId_OFPVID_PRESENT) //reserved VLANID entry
var loSetPcp uint8
var loMatchPcp uint8 = 8 // could the const 'cPrioDoNotFilter' be used from omci_vlan_config.go ?
var loIPProto uint32
@@ -4541,7 +4538,8 @@
log.Fields{"device-id": dh.DeviceID})
} else {
onuDevEntry.MutexPersOnuConfig.RLock()
- if onuDevEntry.SOnuPersistentData.PersOperState == "up" {
+ switch onuDevEntry.SOnuPersistentData.PersOperState {
+ case "up":
connectStatus = voltha.ConnectStatus_REACHABLE
if !onuDevEntry.SOnuPersistentData.PersUniDisableDone {
if onuDevEntry.SOnuPersistentData.PersUniUnlockDone {
@@ -4550,9 +4548,7 @@
operState = voltha.OperStatus_ACTIVATING
}
}
- } else if onuDevEntry.SOnuPersistentData.PersOperState == "down" ||
- onuDevEntry.SOnuPersistentData.PersOperState == "unknown" ||
- onuDevEntry.SOnuPersistentData.PersOperState == "" {
+ case "down", "unknown", "":
operState = voltha.OperStatus_DISCOVERED
}
onuDevEntry.MutexPersOnuConfig.RUnlock()
@@ -4613,7 +4609,7 @@
logger.Errorw(ctx, "No valid OnuDevice", log.Fields{"device-id": dh.DeviceID})
} else {
onuDevEntry.MutexReconciledTpInstances.Lock()
- onuDevEntry.ReconciledTpInstances = make(map[uint8]map[uint8]inter_adapter.TechProfileDownloadMessage)
+ onuDevEntry.ReconciledTpInstances = make(map[uint8]map[uint8]ia.TechProfileDownloadMessage)
onuDevEntry.MutexReconciledTpInstances.Unlock()
}
}()
@@ -4745,7 +4741,7 @@
subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), dh.config.RPCTimeout)
defer cancel()
logger.Debugw(subCtx, "get-device-from-core", log.Fields{"device-id": deviceID})
- return cClient.GetDevice(subCtx, &vc.ID{Id: deviceID})
+ return cClient.GetDevice(subCtx, &common.ID{Id: deviceID})
}
func (dh *deviceHandler) updateDeviceStateInCore(ctx context.Context, deviceStateFilter *ca.DeviceStateFilter) error {
@@ -5101,7 +5097,7 @@
}
// GetOnuIndication - TODO: add comment
-func (dh *deviceHandler) GetOnuIndication() *openolt.OnuIndication {
+func (dh *deviceHandler) GetOnuIndication() *oop.OnuIndication {
return dh.pOnuIndication
}
diff --git a/internal/pkg/core/openonu.go b/internal/pkg/core/openonu.go
index 3135a94..0f6a887 100755
--- a/internal/pkg/core/openonu.go
+++ b/internal/pkg/core/openonu.go
@@ -929,6 +929,7 @@
onuIndication := onuInd.OnuIndication
onuOperstate := onuIndication.GetOperState()
+ //nolint:staticcheck
waitForDhInstPresent := false
if onuOperstate == "up" {
//Race condition (relevant in BBSIM-environment only): Due to unsynchronized processing of olt-adapter and rw_core,
@@ -943,17 +944,18 @@
"AdminState": onuIndication.GetAdminState(), "OperState": onuOperstate,
"SNR": onuIndication.GetSerialNumber()})
- if onuOperstate == "up" {
+ switch onuOperstate {
+ case "up":
if err := handler.createInterface(ctx, onuIndication); err != nil {
return nil, err
}
return &empty.Empty{}, nil
- } else if (onuOperstate == "down") || (onuOperstate == "unreachable") {
+ case "down", "unreachable":
if err := handler.UpdateInterface(ctx); err != nil {
return nil, err
}
return &empty.Empty{}, nil
- } else {
+ default:
logger.Errorw(ctx, "unknown-onu-ind-request operState", log.Fields{"OnuId": onuIndication.GetOnuId()})
return nil, fmt.Errorf("invalidOperState: %s, %s", onuOperstate, onuInd.DeviceId)
}