[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: Ic9fe6b74bdb86f8313a04559b59991d66307d5bb
diff --git a/internal/pkg/application/application.go b/internal/pkg/application/application.go
index de67c02..e8bc663 100644
--- a/internal/pkg/application/application.go
+++ b/internal/pkg/application/application.go
@@ -37,7 +37,6 @@
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/intf"
 	"voltha-go-controller/internal/pkg/of"
@@ -1666,7 +1665,8 @@
 	if ipv4l != nil {
 		ip := ipv4l.(*layers.IPv4)
 
-		if ip.Protocol == layers.IPProtocolUDP {
+		switch ip.Protocol {
+		case layers.IPProtocolUDP:
 			logger.Debugw(ctx, "Received Southbound UDP ipv4 packet in", log.Fields{"StreamSide": packetSide})
 			dhcpl := gopkt.Layer(layers.LayerTypeDHCPv4)
 			if dhcpl != nil {
@@ -1676,7 +1676,7 @@
 					logger.Debugw(ctx, "DHCPv4 handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 				}
 			}
-		} else if ip.Protocol == layers.IPProtocolIGMP {
+		case layers.IPProtocolIGMP:
 			logger.Debugw(ctx, "Received Southbound IGMP packet in", log.Fields{"StreamSide": packetSide})
 			if callBack, ok := PacketHandlers[IGMP]; ok {
 				callBack(cntx, device, port, gopkt)
@@ -1924,7 +1924,7 @@
 // GetTaskList to get task list information.
 func (va *VoltApplication) GetTaskList(device string) map[int]*TaskInfo {
 	logger.Debugw(ctx, "Received Get Task List", log.Fields{"device": device})
-	taskList := cntlr.GetController().GetTaskList(device)
+	taskList := controller.GetController().GetTaskList(device)
 	taskMap := make(map[int]*TaskInfo)
 	for i, task := range taskList {
 		taskID := strconv.Itoa(int(task.TaskID()))
@@ -1947,8 +1947,8 @@
 	} else {
 		logger.Infow(ctx, "No device present with old serial number", log.Fields{"Serial Number": oldOltSlNo})
 		// Add Serial Number to Blocked Devices List.
-		cntlr.GetController().AddBlockedDevices(oldOltSlNo)
-		cntlr.GetController().AddBlockedDevices(newOltSlNo)
+		controller.GetController().AddBlockedDevices(oldOltSlNo)
+		controller.GetController().AddBlockedDevices(newOltSlNo)
 
 		updateSlNoForVnet := func(key, value interface{}) bool {
 			vnet := value.(*VoltVnet)
@@ -1979,8 +1979,8 @@
 		va.MvlanProfilesByName.Range(updateSlNoforMvlan)
 
 		// Clear the serial number from Blocked Devices List
-		cntlr.GetController().DelBlockedDevices(oldOltSlNo)
-		cntlr.GetController().DelBlockedDevices(newOltSlNo)
+		controller.GetController().DelBlockedDevices(oldOltSlNo)
+		controller.GetController().DelBlockedDevices(newOltSlNo)
 	}
 }
 
diff --git a/internal/pkg/application/dhcprelay.go b/internal/pkg/application/dhcprelay.go
index ef499bb..0e1f138 100644
--- a/internal/pkg/application/dhcprelay.go
+++ b/internal/pkg/application/dhcprelay.go
@@ -713,25 +713,20 @@
 	}
 
 	switch msgType {
-	case layers.DHCPMsgTypeDiscover, layers.DHCPMsgTypeRequest:
-		if msgType == layers.DHCPMsgTypeDiscover {
-			vpv.SetDhcpState(DhcpRelayStateDiscover)
-		} else if msgType == layers.DHCPMsgTypeRequest {
-			vpv.SetDhcpState(DhcpRelayStateRequest)
-		}
-	// Reset learnt mac address in case of DHCPv4 release
+	case layers.DHCPMsgTypeDiscover:
+		vpv.SetDhcpState(DhcpRelayStateDiscover)
+	case layers.DHCPMsgTypeRequest:
+		vpv.SetDhcpState(DhcpRelayStateRequest)
 	case layers.DHCPMsgTypeRelease:
 		vpv.LearntMacAddr, _ = net.ParseMAC("00:00:00:00:00:00")
 		vpv.services.Range(matchServiceAndRaiseInd)
 		vpv.SetDhcpState(DhcpRelayStateRelease)
-
-	case layers.DHCPMsgTypeAck, layers.DHCPMsgTypeNak:
+	case layers.DHCPMsgTypeAck:
 		vpv.services.Range(matchServiceAndRaiseInd)
-		if msgType == layers.DHCPMsgTypeAck {
-			vpv.SetDhcpState(DhcpRelayStateAck)
-		} else if msgType == layers.DHCPMsgTypeNak {
-			vpv.SetDhcpState(DhcpRelayStateNAK)
-		}
+		vpv.SetDhcpState(DhcpRelayStateAck)
+	case layers.DHCPMsgTypeNak:
+		vpv.services.Range(matchServiceAndRaiseInd)
+		vpv.SetDhcpState(DhcpRelayStateNAK)
 	case layers.DHCPMsgTypeOffer:
 		vpv.SetDhcpState(DhcpRelayStateOffer)
 	}
diff --git a/internal/pkg/application/igmp.go b/internal/pkg/application/igmp.go
index 4ce9849..9ab5e8e 100644
--- a/internal/pkg/application/igmp.go
+++ b/internal/pkg/application/igmp.go
@@ -812,7 +812,8 @@
 
 	logger.Debugw(ctx, "Received IGMPv2 Type", log.Fields{"Type": igmpv2.Type})
 
-	if igmpv2.Type == layers.IGMPMembershipReportV2 || igmpv2.Type == layers.IGMPMembershipReportV1 {
+	switch igmpv2.Type {
+	case layers.IGMPMembershipReportV2, layers.IGMPMembershipReportV1:
 		logger.Infow(ctx, "IGMP Join received: v2", log.Fields{"Addr": igmpv2.GroupAddress, "Port": port})
 
 		// This is a report coming from the PON. We must be able to first find the
@@ -884,7 +885,7 @@
 				return
 			}
 		}
-	} else if igmpv2.Type == layers.IGMPLeaveGroup {
+	case layers.IGMPLeaveGroup:
 		// This is a IGMP leave coming from one of the receivers. We essentially remove the
 		// the receiver.
 		logger.Infow(ctx, "IGMP Leave received: v2", log.Fields{"Addr": igmpv2.GroupAddress, "Port": port})
@@ -911,7 +912,7 @@
 				va.DelIgmpGroup(cntx, ig)
 			}
 		}
-	} else {
+	default:
 		// This must be a query on the NNI port. However, we dont make that assumption.
 		// Need to look for the IGMP group based on the VLAN in the packet as
 		// the MVLAN
diff --git a/internal/pkg/application/igmpgroup.go b/internal/pkg/application/igmpgroup.go
index 2dab424..ec4fbf0 100644
--- a/internal/pkg/application/igmpgroup.go
+++ b/internal/pkg/application/igmpgroup.go
@@ -515,7 +515,7 @@
 			// During vgc upgrade from old version, igd.NextQueryTime and igd.QueryExpiryTime will not be present in db.
 			// hence they are initialized with current time offset.
 			emptyTime := time.Time{}
-			if emptyTime == igd.NextQueryTime {
+			if emptyTime.Equal(igd.NextQueryTime) {
 				logger.Debugw(ctx, "VGC igd upgrade", log.Fields{"igd grp name": igd.GroupName})
 				igd.NextQueryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
 				igd.QueryExpiryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
diff --git a/internal/pkg/application/major_upgrade.go b/internal/pkg/application/major_upgrade.go
index 66408ca..55ea239 100644
--- a/internal/pkg/application/major_upgrade.go
+++ b/internal/pkg/application/major_upgrade.go
@@ -301,7 +301,7 @@
 
 		presentParams := migrationMap[module](cntx, b)
 		logger.Infow(ctx, "Migrated data", log.Fields{"presentParams": presentParams})
-		if "" == presentParams {
+		if presentParams == "" {
 			return errors.New("Error-in-migration")
 		} else if ModuleToBeDeleted == presentParams {
 			return nil
diff --git a/internal/pkg/application/meters.go b/internal/pkg/application/meters.go
index 1f6b41b..00ecd84 100644
--- a/internal/pkg/application/meters.go
+++ b/internal/pkg/application/meters.go
@@ -205,7 +205,7 @@
 	var aggVM *VoltMeter
 	vm, err := m.GetMeterByProfID(meterID)
 	if err == nil {
-		if 0 != aggMeterID { //Assuming valid meter id will never be 0
+		if aggMeterID != 0 { //Assuming valid meter id will never be 0
 			if aggVM, err = m.GetMeterByProfID(aggMeterID); err != nil {
 				logger.Warnw(ctx, "Aggregated Meter not found", log.Fields{"Id": aggMeterID})
 			}
diff --git a/internal/pkg/application/pppoeia.go b/internal/pkg/application/pppoeia.go
index 6459d4c..5920751 100644
--- a/internal/pkg/application/pppoeia.go
+++ b/internal/pkg/application/pppoeia.go
@@ -317,11 +317,12 @@
 	if vpv.PppoeIa {
 		// Delete the IA option that may be included in the response
 		DelIaOption(pppoe)
-		if pppoe.Code == layers.PPPoECodePADO {
+		switch pppoe.Code {
+		case layers.PPPoECodePADO:
 			vpv.SetPppoeIaState(PppoeIaStatePADO)
-		} else if pppoe.Code == layers.PPPoECodePADS {
+		case layers.PPPoECodePADS:
 			vpv.SetPppoeIaState(PppoeIaStatePADS)
-		} else if pppoe.Code == layers.PPPoECodePADT {
+		case layers.PPPoECodePADT:
 			vpv.SetPppoeIaState(PppoeIaStatePADT)
 		}
 		vpv.WriteToDb(cntx)
@@ -452,9 +453,10 @@
 			vpv.SetMacAddr(cntx, eth.SrcMAC)
 		}
 
-		if pppoe.Code == layers.PPPoECodePADI {
+		switch pppoe.Code {
+		case layers.PPPoECodePADI:
 			vpv.SetPppoeIaState(PppoeIaStatePADI)
-		} else if pppoe.Code == layers.PPPoECodePADR {
+		case layers.PPPoECodePADR:
 			vpv.SetPppoeIaState(PppoeIaStatePADR)
 		}
 		vpv.WriteToDb(cntx)
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index 3fd1a4e..b36cb8f 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -32,13 +32,11 @@
 	"strconv"
 	"strings"
 	"sync"
-	infraerrorCodes "voltha-go-controller/internal/pkg/errorcodes"
 
 	"github.com/google/gopacket/layers"
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/of"
 	"voltha-go-controller/internal/pkg/util"
@@ -304,12 +302,12 @@
 	logger.Debugw(ctx, "Add US & DS HSIA Flows for the service", log.Fields{"ServiceName": vs.Name})
 	if err := vs.AddUsHsiaFlows(cntx); err != nil {
 		logger.Errorw(ctx, "Error adding US HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 	if err := vs.AddDsHsiaFlows(cntx); err != nil {
 		logger.Errorw(ctx, "Error adding DS HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
@@ -319,13 +317,13 @@
 	logger.Debugw(ctx, "Delete US & DS HSIA Flows for the service", log.Fields{"ServiceName": vs.Name})
 	if err := vs.DelUsHsiaFlows(cntx, false); err != nil {
 		logger.Errorw(ctx, "Error deleting US HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 
 	if err := vs.DelDsHsiaFlows(cntx, false); err != nil {
 		logger.Errorw(ctx, "Error deleting DS HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
@@ -384,14 +382,14 @@
 			usflows, err := vs.BuildUsHsiaFlows(pbits)
 			if err != nil {
 				logger.Errorw(ctx, "Error Building HSIA US flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
 			if err := vs.AddFlows(cntx, device, usflows); err != nil {
 				logger.Errorw(ctx, "Error adding HSIA US flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		}
@@ -432,7 +430,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.AddFlows(cntx, device, dsflows); err != nil {
 				logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else {
@@ -446,7 +444,7 @@
 				dsflows.MigrateCookie = vgcRebooted
 				if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 					logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 				}
 			} else {
@@ -454,14 +452,14 @@
 					dsflows, err := vs.BuildDsHsiaFlows(of.PbitType(matchPbit))
 					if err != nil {
 						logger.Errorw(ctx, "Error Building HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-						statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+						statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 						vs.triggerServiceFailureInd(statusCode, statusMessage)
 						continue
 					}
 					dsflows.MigrateCookie = vgcRebooted
 					if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 						logger.Errorw(ctx, "Failed to Add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-						statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+						statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 						vs.triggerServiceFailureInd(statusCode, statusMessage)
 					}
 				}
@@ -493,14 +491,14 @@
 			usflows, err := vs.BuildUsHsiaFlows(pbits)
 			if err != nil {
 				logger.Errorw(ctx, "Error Building HSIA US flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, usflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA US flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		}
@@ -530,7 +528,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else if _, ok := vs.DsRemarkPbitsMap[int(PbitMatchAll)]; ok {
@@ -541,7 +539,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else {
@@ -549,14 +547,14 @@
 				dsflows, err := vs.BuildDsHsiaFlows(of.PbitType(matchPbit))
 				if err != nil {
 					logger.Errorw(ctx, "Error Building HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 					continue
 				}
 				dsflows.MigrateCookie = vgcRebooted
 				if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 					logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 				}
 			}
@@ -807,10 +805,11 @@
 		subflow1.SetGoToTable(1)
 		subflow1.SetInPort(inport)
 
-		if vs.ServiceType == DpuMgmtTraffic {
+		switch vs.ServiceType {
+		case DpuMgmtTraffic:
 			subflow1.SetMatchPbit(vs.UsPonCTagPriority)
 			subflow1.SetPcp(vs.UsPonSTagPriority)
-		} else if vs.ServiceType == DpuAncpTraffic {
+		case DpuAncpTraffic:
 			subflow1.SetPcp(vs.UsPonSTagPriority)
 		}
 		if err := vs.setUSMatchActionVlanT0(subflow1); err != nil {
@@ -1334,7 +1333,7 @@
 		device.RegisterFlowAddEvent(cookie, fe)
 		vs.PendingFlows[cookie] = true
 	}
-	return cntlr.GetController().AddFlows(cntx, vs.Port, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, vs.Port, device.Name, flow)
 }
 
 // FlowInstallSuccess - Called when corresponding service flow installation is success
@@ -1424,7 +1423,7 @@
 			device.RegisterFlowDelEvent(cookie, fe)
 		}
 	}
-	return cntlr.GetController().DelFlows(cntx, vs.Port, device.Name, flow, delFlowsInDevice)
+	return controller.GetController().DelFlows(cntx, vs.Port, device.Name, flow, delFlowsInDevice)
 }
 
 // CheckAndDeleteService - remove service from DB is there are no pending flows to be removed
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index 2bbcd14..8a23636 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -34,7 +34,6 @@
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/of"
@@ -663,9 +662,10 @@
 func (vpv *VoltPortVnet) ProcessDhcpResult(cntx context.Context, res *layers.DHCPv4) {
 	logger.Debug(ctx, "Process Dhcp Result")
 	msgType := DhcpMsgType(res)
-	if msgType == layers.DHCPMsgTypeAck {
+	switch msgType {
+	case layers.DHCPMsgTypeAck:
 		vpv.ProcessDhcpSuccess(cntx, res)
-	} else if msgType == layers.DHCPMsgTypeNak {
+	case layers.DHCPMsgTypeNak:
 		vpv.DhcpStatus = DhcpStatusNacked
 	}
 	vpv.WriteToDb(cntx)
@@ -1816,7 +1816,7 @@
 					vd.RegisterFlowAddEvent(cookie, fe)
 				}
 			}
-			if err1 := cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flows); err1 != nil {
+			if err1 := controller.GetController().AddFlows(cntx, vpv.Port, device.Name, flows); err1 != nil {
 				return err1
 			}
 		} else {
@@ -2718,14 +2718,14 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping Dev Flow Configuration - Port Down", log.Fields{"Device": device})
 				return true
 			}
 
 			// Pushing ICMPv6 Flow
 			flow := BuildICMPv6Flow(portID, vnet)
-			err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+			err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2734,7 +2734,7 @@
 
 			// Pushing ARP Flow
 			flow = BuildDSArpFlow(portID, vnet)
-			err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+			err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2752,7 +2752,7 @@
 
 func (va *VoltApplication) PushTrapFlows(cntx context.Context, device *VoltDevice, nniPort string, flow *of.VoltFlow) error {
 	logger.Debugw(ctx, "Push NNI DHCP Trap Flows", log.Fields{"DeviceName": device.Name, "Flow port": flow.PortID})
-	return cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 }
 
 // PushDevFlowForDevice to push icmpv6 flows for device
@@ -2786,7 +2786,7 @@
 			return true
 		}
 		flow := BuildICMPv6Flow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+		err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2794,7 +2794,7 @@
 		logger.Infow(ctx, "ICMP Flow Added to Queue", log.Fields{"flow": flow})
 
 		flow = BuildDSArpFlow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+		err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2830,7 +2830,7 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping ICMPv6 Flow Deletion - Port Down", log.Fields{"Device": device})
 				return true
 			}
@@ -2951,7 +2951,7 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping ICMPv6 Flow Deletion - Port Down", log.Fields{"Device": device})
 				return false
 			}
@@ -3087,7 +3087,7 @@
 	}
 	logger.Infow(ctx, "ICMPv6 MC Group Action", log.Fields{"Device": device, "Delete": delete})
 	port, _ := GetApplication().GetNniPort(device)
-	err := cntlr.GetController().GroupUpdate(port, device, group)
+	err := controller.GetController().GroupUpdate(port, device, group)
 	return err
 }
 
@@ -3124,7 +3124,7 @@
 		}
 		device.RegisterFlowAddEvent(cookie, fe)
 	}
-	return cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, vpv.Port, device.Name, flow)
 }
 
 // FlowInstallFailure - Process flow failure indication and triggers HSIA failure for all associated services
@@ -3156,7 +3156,7 @@
 		device.RegisterFlowDelEvent(cookie, fe)
 		vpv.PendingDeleteFlow[cookie] = true
 	}
-	return cntlr.GetController().DelFlows(cntx, vpv.Port, device.Name, flow, false)
+	return controller.GetController().DelFlows(cntx, vpv.Port, device.Name, flow, false)
 }
 
 // CheckAndDeleteVpv - remove VPV from DB is there are no pending flows to be removed
@@ -3240,7 +3240,7 @@
 		logger.Errorw(ctx, "Error getting NNI port", log.Fields{"Error": err})
 		return err
 	}
-	return cntlr.GetController().DelFlows(cntx, nniPort, device.Name, flow, false)
+	return controller.GetController().DelFlows(cntx, nniPort, device.Name, flow, false)
 }
 
 // CheckAndDeleteVnet - remove Vnet from DB is there are no pending flows to be removed
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index c146f23..54b6d22 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -73,14 +73,15 @@
 		portName := status.PortStatus.Desc.Name
 		state := status.PortStatus.Desc.State
 		logger.Infow(ctx, "Process Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
-		if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_ADD {
+		switch status.PortStatus.Reason {
+		case ofp.OfpPortReason_OFPPR_ADD:
 			_ = cet.device.AddPort(ctx, status.PortStatus.Desc)
 			if state == uint32(ofp.OfpPortState_OFPPS_LIVE) {
 				cet.device.ProcessPortState(ctx, portNo, state, portName)
 			}
-		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_DELETE {
+		case ofp.OfpPortReason_OFPPR_DELETE:
 			cet.device.CheckAndDeletePort(ctx, portNo, portName)
-		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_MODIFY {
+		case ofp.OfpPortReason_OFPPR_MODIFY:
 			cet.device.ProcessPortUpdate(ctx, portName, portNo, state)
 		}
 		logger.Debugw(ctx, "Processed Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index 73fc348..0748fa7 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -881,10 +881,11 @@
 	if p := d.GetPortByID(port); p != nil {
 		logger.Infow(ctx, "Port State Processing after Reboot", log.Fields{"Received": state, "Current": p.State, "port": port, "Device": d.ID})
 		p.Tasks.Initialize(d.ctx)
-		if p.State == PortStateUp {
+		switch p.State {
+		case PortStateUp:
 			logger.Debugw(ctx, "Port State: UP", log.Fields{"Device": d.ID, "Port": port})
 			GetController().PortUpInd(cntx, d.ID, p.Name)
-		} else if p.State == PortStateDown {
+		case PortStateDown:
 			logger.Debugw(ctx, "Port State: Down", log.Fields{"Device": d.ID, "Port": port})
 			GetController().PortDownInd(cntx, d.ID, p.Name)
 		}
diff --git a/internal/pkg/of/flows.go b/internal/pkg/of/flows.go
index e681752..48bb427 100644
--- a/internal/pkg/of/flows.go
+++ b/internal/pkg/of/flows.go
@@ -933,13 +933,14 @@
 			}
 		}
 
-		if f.Action.Output == OutputTypeToController {
+		switch f.Output {
+		case OutputTypeToController:
 			action := NewOutputAction(0xfffffffd)
 			actions.Actions = append(actions.Actions, action)
-		} else if f.Action.Output == OutputTypeToNetwork {
+		case OutputTypeToNetwork:
 			action := NewOutputAction(f.OutPort)
 			actions.Actions = append(actions.Actions, action)
-		} else if f.Action.Output == OutputTypeToGroup {
+		case OutputTypeToGroup:
 			action := NewGroupAction(f.OutPort)
 			actions.Actions = append(actions.Actions, action)
 		}
diff --git a/internal/pkg/vpagent/connection.go b/internal/pkg/vpagent/connection.go
index 971b8b4..738f88c 100644
--- a/internal/pkg/vpagent/connection.go
+++ b/internal/pkg/vpagent/connection.go
@@ -32,7 +32,7 @@
 
 func (vpa *VPAgent) establishConnectionToVoltha(ctx context.Context) error {
 	if vpa.volthaConnection != nil {
-		vpa.volthaConnection.Close()
+		_ = vpa.volthaConnection.Close()
 	}
 
 	vpa.volthaConnection = nil
@@ -74,5 +74,5 @@
 func (vpa *VPAgent) CloseConnectionToVoltha() {
 	// Close the grpc connection to voltha
 	logger.Debug(ctx, "Closing voltha grpc connection")
-	vpa.volthaConnection.Close()
+	_ = vpa.volthaConnection.Close()
 }