[VOL-5374] Upgrade go version to v1.23

Change-Id: I11655451672cc7bae9cc92cddcaa563ac50d7de4
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
diff --git a/internal/pkg/application/application.go b/internal/pkg/application/application.go
index 7c61725..f0fa05e 100644
--- a/internal/pkg/application/application.go
+++ b/internal/pkg/application/application.go
@@ -209,20 +209,26 @@
 	MigratingServices            *util.ConcurrentMap //<vnetID,<RequestID, MigrateServicesRequest>>
 	VpvsBySvlan                  *util.ConcurrentMap // map[svlan]map[vnet_port]*VoltPortVnet
 	ConfiguredVlanForDeviceFlows *util.ConcurrentMap //map[string]map[string]bool
-	IgmpDsFlowAppliedForMvlan    map[uint16]bool
-	State                        controller.DeviceState
-	SouthBoundID                 string
-	NniPort                      string
-	Name                         string
-	SerialNum                    string
-	Ports                        sync.Map
-	VlanPortStatus               sync.Map
-	ActiveChannelsPerPon         sync.Map   // [PonPortID]*PonPortCfg
-	PonPortList                  sync.Map   // [PonPortID]map[string]string
-	ActiveChannelCountLock       sync.Mutex // This lock is used to update ActiveIGMPChannels
-	NniDhcpTrapVid               of.VlanType
-	GlobalDhcpFlowAdded          bool
-	icmpv6GroupAdded             bool
+
+	IgmpDsFlowAppliedForMvlan map[uint16]bool
+
+	Ports                sync.Map
+	VlanPortStatus       sync.Map
+	ActiveChannelsPerPon sync.Map // [PonPortID]*PonPortCfg
+	PonPortList          sync.Map // [PonPortID]map[string]string
+
+	State        controller.DeviceState
+	SouthBoundID string
+	NniPort      string
+	Name         string
+	SerialNum    string
+
+	ActiveChannelCountLock sync.Mutex // This lock is used to update ActiveIGMPChannels
+
+	NniDhcpTrapVid of.VlanType
+
+	GlobalDhcpFlowAdded bool
+	icmpv6GroupAdded    bool
 }
 
 type VoltDevInterface interface {
@@ -413,13 +419,13 @@
 type VoltAppInterface interface {
 	AddVnet(cntx context.Context, cfg VnetConfig, oper *VnetOper) error
 	AddService(cntx context.Context, cfg VoltServiceCfg, oper *VoltServiceOper) error
-	AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress, uplinkPort string, nniDhcpTrapID int) error
+	AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress, uplinkPort string, nniDhcpTrapID uint16) error
 	GetFlowProvisionStatus(portNo string) FlowProvisionStatus
 	DelServiceWithPrefix(cntx context.Context, prefix string) error
 	GetDevice(device string) *VoltDevice
 	GetTaskList(device string) map[int]*TaskInfo
 	AddMeterProf(cntx context.Context, cfg VoltMeter)
-	AddMvlanProfile(cntx context.Context, name string, mvlan of.VlanType, ponVlan of.VlanType, groups map[string][]string, isChannelBasedGroup bool, OLTSerialNum []string, activeChannelsPerPon int, proxy map[string]common.MulticastGroupProxy) error
+	AddMvlanProfile(cntx context.Context, name string, mvlan of.VlanType, ponVlan of.VlanType, groups map[string][]string, isChannelBasedGroup bool, OLTSerialNum []string, activeChannelsPerPon uint32, proxy map[string]common.MulticastGroupProxy) error
 	DelMvlanProfile(cntx context.Context, name string) error
 	GetMvlanProfileByTag(vlan of.VlanType) *MvlanProfile
 	AddMcastConfig(cntx context.Context, MvlanProfileID string, IgmpProfileID string, IgmpProxyIP string, OltSerialNum string) error
@@ -498,7 +504,7 @@
 	IPAddress          string `json:"ipAddress"`
 	UplinkPort         string `json:"uplinkPort"`
 	NasID              string `json:"nasId"`
-	NniDhcpTrapVid     int    `json:"nniDhcpTrapVid"`
+	NniDhcpTrapVid     uint16 `json:"nniDhcpTrapVid"`
 }
 
 // PonPortCfg contains NB port config and activeIGMPChannels count
@@ -537,7 +543,10 @@
 			continue
 		}
 		logger.Debugw(ctx, "Port recovered", log.Fields{"port": port})
-		ponPortID, _ := strconv.Atoi(key)
+		ponPortID, err := strconv.ParseUint(key, 10, 32)
+		if err != nil {
+			logger.Errorw(ctx, "Error converting string to uint32:", log.Fields{"deviceID": deviceID, "error": err})
+		}
 		nbDevice.PonPorts.Store(uint32(ponPortID), &port)
 	}
 	va.NbDevice.Store(deviceID, nbDevice)
@@ -612,7 +621,7 @@
 	return nil
 }
 
-func (va *VoltApplication) AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress, uplinkPort string, nniDhcpTrapID int) error {
+func (va *VoltApplication) AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress, uplinkPort string, nniDhcpTrapID uint16) error {
 	logger.Debugw(ctx, "Received Add device config", log.Fields{"SerialNumber": serialNum, "HardwareIdentifier": hardwareIdentifier, "NasID": nasID, "IPAddress": ipAddress, "UplinkPort": uplinkPort, "NniDhcpTrapID": nniDhcpTrapID})
 	var dc *DeviceConfig
 
@@ -754,11 +763,12 @@
 // AddIgmpGroups to add Igmp groups.
 func (va *VoltApplication) AddIgmpGroups(numOfGroups uint32) {
 	logger.Debugw(ctx, "AddIgmpGroups", log.Fields{"NumOfGroups": numOfGroups})
+	var i uint32
 	//TODO: Temp change to resolve group id issue in pOLT
 	//for i := 1; uint32(i) <= numOfGroups; i++ {
-	for i := 2; uint32(i) <= (numOfGroups + 1); i++ {
+	for i = 2; i <= (numOfGroups + 1); i++ {
 		ig := IgmpGroup{}
-		ig.GroupID = uint32(i)
+		ig.GroupID = i
 		va.IgmpGroupIds = append(va.IgmpGroupIds, &ig)
 	}
 }
@@ -1788,7 +1798,7 @@
 // CheckAndDeactivateService - check if the attempts for flow delete has reached threshold or not
 func (va *VoltApplication) CheckAndDeactivateService(ctx context.Context, flow *of.VoltSubFlow, devSerialNum string, devID string) {
 	logger.Debugw(ctx, "Check and Deactivate service", log.Fields{"Cookie": flow.Cookie, "FlowCount": flow.FlowCount, "DeviceSerial": devSerialNum})
-	if flow.FlowCount >= controller.GetController().GetMaxFlowRetryAttempt() {
+	if flow.FlowCount >= uint32(controller.GetController().GetMaxFlowRetryAttempt()) {
 		devConfig := va.GetDeviceConfig(devSerialNum)
 		if devConfig != nil {
 			portNo := util.GetUniPortFromFlow(devConfig.UplinkPort, flow)
diff --git a/internal/pkg/application/application_test.go b/internal/pkg/application/application_test.go
index 4c2fe4c..3372266 100644
--- a/internal/pkg/application/application_test.go
+++ b/internal/pkg/application/application_test.go
@@ -1307,7 +1307,7 @@
 		nasID              string
 		ipAddress          string
 		uplinkPort         string
-		nniDhcpTrapID      int
+		nniDhcpTrapID      uint16
 	}
 	dvcConfg := &DeviceConfig{
 		SerialNumber:       "SDX6320031",
diff --git a/internal/pkg/application/flowevent_test.go b/internal/pkg/application/flowevent_test.go
index 8621521..9736ac3 100644
--- a/internal/pkg/application/flowevent_test.go
+++ b/internal/pkg/application/flowevent_test.go
@@ -162,6 +162,7 @@
 		flowStatus   intf.FlowStatus
 		flowEventMap *util.ConcurrentMap
 	}
+
 	vs := &VoltService{
 		VoltServiceCfg: VoltServiceCfg{},
 	}
@@ -249,6 +250,7 @@
 		flowStatus   intf.FlowStatus
 		flowEventMap *util.ConcurrentMap
 	}
+
 	vs := &VoltService{
 		VoltServiceCfg: VoltServiceCfg{},
 	}
diff --git a/internal/pkg/application/igmp.go b/internal/pkg/application/igmp.go
index a531619..4ce9849 100644
--- a/internal/pkg/application/igmp.go
+++ b/internal/pkg/application/igmp.go
@@ -659,7 +659,12 @@
 		}
 		if portChannels, ok := igd.PortChannelMap.Load(uniPort); ok {
 			channelList := portChannels.([]net.IP)
-			activeChannelCount += uint32(len(channelList))
+			channelLength := len(channelList)
+			// Check if the length exceeds uint32's maximum value
+			if channelLength > int(^uint32(0)) {
+				logger.Error(ctx, "Error converting string to uint32")
+			}
+			activeChannelCount += uint32(channelLength)
 		}
 		return true
 	}
@@ -1207,7 +1212,7 @@
 }
 
 // UpdateMvlanProfile - only channel groups be updated
-func (va *VoltApplication) UpdateMvlanProfile(cntx context.Context, name string, vlan of.VlanType, groups map[string][]string, activeChannelCount int, proxy map[string]common.MulticastGroupProxy) error {
+func (va *VoltApplication) UpdateMvlanProfile(cntx context.Context, name string, vlan of.VlanType, groups map[string][]string, activeChannelCount uint32, proxy map[string]common.MulticastGroupProxy) error {
 	mvpIntf, ok := va.MvlanProfilesByName.Load(name)
 	if !ok {
 		logger.Error(ctx, "Update Mvlan Failed: Profile does not exist")
@@ -1485,7 +1490,7 @@
 
 // AddMvlanProfile for addition of a MVLAN profile
 func (va *VoltApplication) AddMvlanProfile(cntx context.Context, name string, mvlan of.VlanType, ponVlan of.VlanType,
-	groups map[string][]string, isChannelBasedGroup bool, OLTSerialNum []string, activeChannelsPerPon int, proxy map[string]common.MulticastGroupProxy) error {
+	groups map[string][]string, isChannelBasedGroup bool, OLTSerialNum []string, activeChannelsPerPon uint32, proxy map[string]common.MulticastGroupProxy) error {
 	var mvp *MvlanProfile
 
 	if mvp = va.GetMvlanProfileByTag(mvlan); mvp != nil {
@@ -1504,7 +1509,7 @@
 	}
 
 	if mvp == nil {
-		mvp = NewMvlanProfile(name, mvlan, ponVlan, isChannelBasedGroup, OLTSerialNum, uint32(activeChannelsPerPon))
+		mvp = NewMvlanProfile(name, mvlan, ponVlan, isChannelBasedGroup, OLTSerialNum, activeChannelsPerPon)
 	}
 
 	va.storeMvlansMap(mvlan, name, mvp)
@@ -1712,10 +1717,10 @@
 	}
 
 	igmpProfile.ProfileID = igmpProfileConfig.ProfileID
-	igmpProfile.UnsolicitedTimeOut = uint32(igmpProfileConfig.UnsolicitedTimeOut)
-	igmpProfile.MaxResp = uint32(igmpProfileConfig.MaxResp)
+	igmpProfile.UnsolicitedTimeOut = igmpProfileConfig.UnsolicitedTimeOut
+	igmpProfile.MaxResp = igmpProfileConfig.MaxResp
 
-	keepAliveInterval := uint32(igmpProfileConfig.KeepAliveInterval)
+	keepAliveInterval := igmpProfileConfig.KeepAliveInterval
 
 	// KeepAliveInterval should have a min of 10 seconds
 	if keepAliveInterval < MinKeepAliveInterval {
@@ -1724,12 +1729,12 @@
 	}
 	igmpProfile.KeepAliveInterval = keepAliveInterval
 
-	igmpProfile.KeepAliveCount = uint32(igmpProfileConfig.KeepAliveCount)
-	igmpProfile.LastQueryInterval = uint32(igmpProfileConfig.LastQueryInterval)
-	igmpProfile.LastQueryCount = uint32(igmpProfileConfig.LastQueryCount)
+	igmpProfile.KeepAliveCount = igmpProfileConfig.KeepAliveCount
+	igmpProfile.LastQueryInterval = igmpProfileConfig.LastQueryInterval
+	igmpProfile.LastQueryCount = igmpProfileConfig.LastQueryCount
 	igmpProfile.FastLeave = *igmpProfileConfig.FastLeave
 	igmpProfile.PeriodicQuery = *igmpProfileConfig.PeriodicQuery
-	igmpProfile.IgmpCos = uint8(igmpProfileConfig.IgmpCos)
+	igmpProfile.IgmpCos = igmpProfileConfig.IgmpCos
 	igmpProfile.WithRAUpLink = *igmpProfileConfig.WithRAUpLink
 	igmpProfile.WithRADownLink = *igmpProfileConfig.WithRADownLink
 
diff --git a/internal/pkg/application/igmpgroupchannel.go b/internal/pkg/application/igmpgroupchannel.go
index d8a2644..56f189c 100644
--- a/internal/pkg/application/igmpgroupchannel.go
+++ b/internal/pkg/application/igmpgroupchannel.go
@@ -674,6 +674,7 @@
 }
 
 // NumReceivers returns total number of receivers left on the group
+// #nosec G115
 func (igc *IgmpGroupChannel) NumReceivers() uint32 {
 	return uint32(len(igc.CurReceivers) + len(igc.NewReceivers))
 }
diff --git a/internal/pkg/application/igmpponportchannel.go b/internal/pkg/application/igmpponportchannel.go
index 4f858e8..22ef806 100644
--- a/internal/pkg/application/igmpponportchannel.go
+++ b/internal/pkg/application/igmpponportchannel.go
@@ -56,6 +56,7 @@
 
 // GetActiveChannelCount returns the number of active channel count
 // for this pon port in the current group.
+// #nosec G115
 func (ponPortChannels *PonPortChannels) GetActiveChannelCount() uint32 {
 	return uint32(ponPortChannels.ChannelList.Length())
 }
diff --git a/internal/pkg/application/minor_upgrade.go b/internal/pkg/application/minor_upgrade.go
index 096d7b5..428ca5e 100644
--- a/internal/pkg/application/minor_upgrade.go
+++ b/internal/pkg/application/minor_upgrade.go
@@ -79,7 +79,7 @@
 		}
 	}
 	param.Name = newKey
-	if param.DevicesList == nil || len(param.DevicesList) == 0 {
+	if len(param.DevicesList) == 0 {
 		param.DevicesList = append(param.DevicesList, "") // Empty OLT serial number as of now since submgr won't have proper serial num
 	}
 	return nil
@@ -115,7 +115,7 @@
 func updateMvlans(cntx context.Context, hash string, value interface{}) error {
 	logger.Debugw(ctx, "Update Mvlans", log.Fields{"Hash": hash})
 	param := value.(*MvlanProfile)
-	if param.DevicesList == nil || len(param.DevicesList) == 0 {
+	if len(param.DevicesList) == 0 {
 		param.DevicesList = make(map[string]OperInProgress) // Empty OLT serial number as of now since submgr won't have proper serial num
 		if err := param.WriteToDb(cntx); err != nil {
 			logger.Errorw(ctx, "Mvlan profile write to DB failed", log.Fields{"ProfileName": param.Name})
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index e060548..ae6f313 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -82,7 +82,8 @@
 // MacAddress -	The MAC hardware address learnt on the UNI interface
 // MacAddresses - Not yet implemented. To be used to learn more MAC addresses
 type VoltServiceCfg struct {
-	DsRemarkPbitsMap           map[int]int // Ex: Remark case {0:0,1:0} and No-remark case {1:1}
+	FlowPushCount              map[string]int64 // Tracks the number of flow install/delete failure attempts per cookie in order to throttle flow auditing
+	DsRemarkPbitsMap           map[int]int      // Ex: Remark case {0:0,1:0} and No-remark case {1:1}
 	Name                       string
 	CircuitID                  string
 	Port                       string
@@ -94,9 +95,9 @@
 	RemoteIDType               string
 	DataRateAttr               string
 	ServiceType                string
-	MacAddr                    net.HardwareAddr
-	RemoteID                   []byte
 	Pbits                      []of.PbitType
+	RemoteID                   []byte
+	MacAddr                    net.HardwareAddr
 	Trigger                    ServiceTrigger
 	MacLearning                MacLearningType
 	ONTEtherTypeClassification int
@@ -155,8 +156,8 @@
 
 // VoltService structure
 type VoltService struct {
-	VoltServiceOper
 	Version string
+	VoltServiceOper
 	VoltServiceCfg
 }
 
@@ -214,6 +215,7 @@
 	vs.Ipv6Addr = net.ParseIP("::")
 	vs.PendingFlows = make(map[string]bool)
 	vs.AssociatedFlows = make(map[string]bool)
+	vs.FlowPushCount = make(map[string]int64)
 	return &vs
 }
 
diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go
index d04e00e..65b435e 100644
--- a/internal/pkg/controller/controller.go
+++ b/internal/pkg/controller/controller.go
@@ -62,6 +62,8 @@
 }
 
 // VoltController structure
+//
+//nolint:govet
 type VoltController struct {
 	ctx                     context.Context
 	app                     intf.App
@@ -74,7 +76,7 @@
 	rebootLock              sync.Mutex
 	deviceTableSyncDuration time.Duration // Time interval between each cycle of audit task
 	maxFlowRetryDuration    time.Duration // Maximum duration for which flows will be retried upon failures
-	maxFlowRetryAttempts    uint32        // maxFlowRetryAttempt = maxFlowRetryDuration / deviceTableSyncDuration
+	maxFlowRetryAttempts    int64         // maxFlowRetryAttempt = maxFlowRetryDuration / deviceTableSyncDuration
 	RebootFlow              bool
 }
 
@@ -108,7 +110,7 @@
 
 // SetMaxFlowRetryAttempts - sets max flow retry attempts
 func (v *VoltController) SetMaxFlowRetryAttempts() {
-	v.maxFlowRetryAttempts = uint32((v.maxFlowRetryDuration / v.deviceTableSyncDuration))
+	v.maxFlowRetryAttempts = int64((v.maxFlowRetryDuration / v.deviceTableSyncDuration))
 }
 
 // GetDeviceTableSyncDuration - returns configured device table sync duration
@@ -117,7 +119,7 @@
 }
 
 // GetMaxFlowRetryAttempt - returns max flow retry attempst
-func (v *VoltController) GetMaxFlowRetryAttempt() uint32 {
+func (v *VoltController) GetMaxFlowRetryAttempt() int64 {
 	return v.maxFlowRetryAttempts
 }
 
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index c8caddd..497339b 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -1080,13 +1080,13 @@
 // IsFlowDelThresholdReached - check if the attempts for flow delete has reached threshold or not
 func (d *Device) IsFlowDelThresholdReached(flowCount uint32, cookie uint64) bool {
 	logger.Debugw(ctx, "Check flow delete threshold", log.Fields{"Cookie": cookie, "FlowCount": flowCount})
-	return flowCount >= GetController().GetMaxFlowRetryAttempt()
+	return flowCount >= uint32(GetController().GetMaxFlowRetryAttempt())
 }
 
 // IsFlowAddThresholdReached - check if the attempts for flow add has reached threshold or not
 func (d *Device) IsFlowAddThresholdReached(flowCount uint32, cookie uint64) bool {
 	logger.Debugw(ctx, "Check flow add threshold", log.Fields{"Cookie": cookie, "FlowCount": flowCount})
-	return flowCount >= GetController().GetMaxFlowRetryAttempt()
+	return flowCount >= uint32(GetController().GetMaxFlowRetryAttempt())
 }
 
 func (d *Device) UpdateFlowCount(cntx context.Context, cookie uint64) {
diff --git a/internal/pkg/of/flows.go b/internal/pkg/of/flows.go
index c0666d9..e681752 100644
--- a/internal/pkg/of/flows.go
+++ b/internal/pkg/of/flows.go
@@ -30,7 +30,7 @@
 )
 
 // PbitType type
-type PbitType uint16
+type PbitType uint8
 
 // TODO: Port related constants - OF specifies a different value
 // for controller. Need to make sure this is correct
diff --git a/internal/pkg/types/multicast.go b/internal/pkg/types/multicast.go
index e270554..be3febe 100755
--- a/internal/pkg/types/multicast.go
+++ b/internal/pkg/types/multicast.go
@@ -34,19 +34,19 @@
 	IgmpSourceIP string `json:"igmpSourceIp"`
 	// FastLeave represents IGMP fast leave enabled or not.
 	// UnsolicitedTimeOut represents unsolicited timeout.
-	UnsolicitedTimeOut int `json:"UnsolicitedTimeOut"`
+	UnsolicitedTimeOut uint32 `json:"UnsolicitedTimeOut"`
 	// MaxResp represents IGMP max response time.
-	MaxResp int `json:"MaxResp"`
+	MaxResp uint32 `json:"MaxResp"`
 	// KeepAliveInterval represents IGMP keep alive interval.
-	KeepAliveInterval int `json:"KeepAliveInterval"`
+	KeepAliveInterval uint32 `json:"KeepAliveInterval"`
 	// KeepAliveCount represents IGMP keep alive count.
-	KeepAliveCount int `json:"KeepAliveCount"`
+	KeepAliveCount uint32 `json:"KeepAliveCount"`
 	// LastQueryInterval represents IGMP last query interval.
-	LastQueryInterval int `json:"LastQueryInterval"`
+	LastQueryInterval uint32 `json:"LastQueryInterval"`
 	// LastQueryCount represents IGMP last query count.
-	LastQueryCount int `json:"LastQueryCount"`
+	LastQueryCount uint32 `json:"LastQueryCount"`
 	// IgmpCos represents IGMP COS value(0-7).
-	IgmpCos int `json:"IgmpCos"`
+	IgmpCos uint8 `json:"IgmpCos"`
 }
 
 // MulticastSrcListMode represents mode of source list