[VOL-5475] upgrade go to 1.24.5 and golangci-lint version to 2.2.2

Change-Id: Ife0505678221ac9769b3443bedfdf1ef4387ae31
Signed-off-by: mgouda <madhumati.gouda@radisys.com>
diff --git a/.golangci.yml b/.golangci.yml
index aca3874..1147894 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -11,7 +11,40 @@
 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #See the License for the specific language governing permissions and
 #limitations under the License.
+version: "2"
 
+linters:
+  enable:
+    #- gocritic
+    #- gochecknoglobals
+    #- gochecknoinits
+    - gocyclo
+    - govet
+    - ineffassign
+    - misspell
+    - gosec
+    - errcheck
+    - whitespace
+    - staticcheck
+    - unused
+    - unparam
+  exclusions:
+    rules:
+      - text: "weak cryptographic primitive"
+        linters:
+          - gosec
+      - path: ".*_test.go"
+        linters:
+          - govet
+          - fieldalignment
+          - staticcheck
+      - text: "SA1019:"
+        linters:
+          - staticcheck
+      - text: 'G115: integer overflow conversion'
+        linters:
+          - gosec
+          
 linters-settings:
   govet:
     settings:
@@ -33,39 +66,9 @@
   misspell:
     locale: US
 
-linters:
+formatters:
   enable:
-    #- gocritic
-    #- gochecknoglobals
-    #- gochecknoinits
-    - gocyclo
     - gofmt
-    - govet
-    - ineffassign
-    - misspell
-    - gosec
-    - errcheck
-    - whitespace
     - goimports
-    - gosimple
-    - staticcheck
-    - unused
-    - unparam
-
 run:
-  modules-download-mode: vendor
-
-issues:
-  exclude-rules:
-    - text: "weak cryptographic primitive"
-      linters:
-        - gosec
-    - path: ".*_test.go"
-      linters:
-        - govet
-        - fieldalignment
-  exclude-use-default: false
-  exclude:
-    - "SA1019: voltha.ImageDownloads is deprecated"
-    - "SA1019: voltha.ImageDownload is deprecated"
-    - 'G115: integer overflow conversion'
+  modules-download-mode: vendor
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 4882fe7..2415f90 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@
 	--build-arg org_opencord_vcs_dirty="${DOCKER_LABEL_VCS_DIRTY}"
 
 # tool containers
-VOLTHA_TOOLS_VERSION ?= 3.1.1
+VOLTHA_TOOLS_VERSION ?= 3.1.3
 
 ## TODO: Verify / migrate to repo:onf-make
 # GO                = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang go
@@ -269,7 +269,7 @@
 	@$(RM) -r ./sca-report
 	@mkdir -p ./sca-report
 	@echo "Running static code analysis..."
-	@${GOLANGCI_LINT} run --out-format junit-xml ./... | tee ./sca-report/sca-report.xml
+	@${GOLANGCI_LINT} run --output.text.path=stdout --output.junit-xml.path=./sca-report/sca-report.xml ./...
 	@echo ""
 	@echo "Static code analysis OK"
 
diff --git a/VERSION b/VERSION
index 910b97b..195a8c7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.5.19
+4.5.20
diff --git a/docker/Dockerfile.openolt b/docker/Dockerfile.openolt
index 8b80103..a1a8d26 100644
--- a/docker/Dockerfile.openolt
+++ b/docker/Dockerfile.openolt
@@ -15,7 +15,7 @@
 # -------------
 # Build stage
 
-FROM golang:1.23.1-alpine3.20 AS dev
+FROM golang:1.24.5-alpine3.22 AS dev
 
 # Install required packages
 RUN apk add --no-cache build-base=0.5-r3
diff --git a/go.mod b/go.mod
index 2cad67d..0e57ce1 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/opencord/voltha-openolt-adapter
 
-go 1.23
+go 1.24.5
 
 replace (
 	github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index c866695..9f9b187 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -2800,11 +2800,12 @@
 
 	egressPortType := plt.IntfIDToPortTypeName(uint32(egressPortNo))
 	var err error
-	if egressPortType == voltha.Port_ETHERNET_UNI {
+	switch egressPortType {
+	case voltha.Port_ETHERNET_UNI:
 		err = dh.PacketOutUNI(ctx, egressPortNo, packet)
-	} else if egressPortType == voltha.Port_ETHERNET_NNI {
+	case voltha.Port_ETHERNET_NNI:
 		err = dh.PacketOutNNI(ctx, egressPortNo, packet)
-	} else {
+	default:
 		logger.Warnw(ctx, "packet-out-to-this-interface-type-not-implemented", log.Fields{
 			"egress-port-no": egressPortNo,
 			"egressPortType": egressPortType,
@@ -3506,21 +3507,22 @@
 					*mcastFlowOrGroupCb.errChan <- err
 				}
 			} else { // mcast group
-				if mcastFlowOrGroupCb.flowOrGroupAction == McastFlowOrGroupAdd {
+				switch mcastFlowOrGroupCb.flowOrGroupAction {
+				case McastFlowOrGroupAdd:
 					logger.Debugw(mcastFlowOrGroupCb.ctx, "adding-mcast-group",
 						log.Fields{"device-id": dh.device.Id,
 							"groupToAdd": mcastFlowOrGroupCb.group})
 					err := dh.groupMgr.AddGroup(mcastFlowOrGroupCb.ctx, mcastFlowOrGroupCb.group)
 					// Pass the return value over the return channel
 					*mcastFlowOrGroupCb.errChan <- err
-				} else if mcastFlowOrGroupCb.flowOrGroupAction == McastFlowOrGroupModify { // group modify
+				case McastFlowOrGroupModify: // group modify
 					logger.Debugw(mcastFlowOrGroupCb.ctx, "modifying-mcast-group",
 						log.Fields{"device-id": dh.device.Id,
 							"groupToModify": mcastFlowOrGroupCb.group})
 					err := dh.groupMgr.ModifyGroup(mcastFlowOrGroupCb.ctx, mcastFlowOrGroupCb.group)
 					// Pass the return value over the return channel
 					*mcastFlowOrGroupCb.errChan <- err
-				} else { // group remove
+				default: // group remove
 					logger.Debugw(mcastFlowOrGroupCb.ctx, "removing-mcast-group",
 						log.Fields{"device-id": dh.device.Id,
 							"groupToRemove": mcastFlowOrGroupCb.group})
@@ -3608,7 +3610,8 @@
 		logger.Debugw(ctx, "getOltPortCounters ctx Done ", log.Fields{"oltPortInfo": oltPortInfo})
 		return errResp(extension.GetValueResponse_ERROR, extension.GetValueResponse_TIMEOUT)
 	}
-	if oltPortInfo.PortType == extension.GetOltPortCounters_Port_ETHERNET_NNI {
+	switch oltPortInfo.PortType {
+	case extension.GetOltPortCounters_Port_ETHERNET_NNI:
 		// get nni stats
 		intfID := plt.PortNoToIntfID(oltPortInfo.PortNo, voltha.Port_ETHERNET_NNI)
 		logger.Debugw(ctx, "getOltPortCounters intfID  ", log.Fields{"intfID": intfID})
@@ -3619,7 +3622,7 @@
 		}
 		dh.portStats.updateGetOltPortCountersResponse(ctx, &singleValResp, cmnni)
 		return &singleValResp
-	} else if oltPortInfo.PortType == extension.GetOltPortCounters_Port_PON_OLT {
+	case extension.GetOltPortCounters_Port_PON_OLT:
 		// get pon stats
 		intfID := plt.PortNoToIntfID(oltPortInfo.PortNo, voltha.Port_PON_OLT)
 		if val, ok := dh.activePorts.Load(intfID); ok && val == true {
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index 7a7ec52..6f670e0 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -40,7 +40,7 @@
 	cmn "github.com/opencord/voltha-protos/v5/go/common"
 	ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
 	of "github.com/opencord/voltha-protos/v5/go/openflow_13"
-	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
+
 	oop "github.com/opencord/voltha-protos/v5/go/openolt"
 	"github.com/opencord/voltha-protos/v5/go/voltha"
 	"github.com/stretchr/testify/assert"
@@ -1106,12 +1106,12 @@
 func TestDeviceHandler_PacketOut(t *testing.T) {
 	dh1 := newMockDeviceHandler()
 	dh2 := negativeDeviceHandler()
-	acts := []*ofp.OfpAction{
-		fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA))),
-		fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 101)),
+	acts := []*of.OfpAction{
+		fu.SetField(fu.Metadata_ofp(uint64(of.OfpInstructionType_OFPIT_WRITE_METADATA))),
+		fu.SetField(fu.VlanVid(uint32(of.OfpVlanId_OFPVID_PRESENT) | 101)),
 		fu.Output(1),
 	}
-	pktout := &ofp.OfpPacketOut{BufferId: 0, InPort: 1, Actions: acts, Data: []byte("AYDCAAAOAODsSE5TiMwCBwQA4OxITlIEBQUwLzUxBgIAFAgEMC81MQoJbG9jYWxob3N0EBwFAawbqqACAAAAoRAxLjMuNi4xLjQuMS40NDEz/gYAgMILAgD+GQCAwgkDAAAAAGQAAAAAAAAAAgICAgICAgL+GQCAwgoDAAAAAGQAAAAAAAAAAgICAgICAgIAAA==")}
+	pktout := &of.OfpPacketOut{BufferId: 0, InPort: 1, Actions: acts, Data: []byte("AYDCAAAOAODsSE5TiMwCBwQA4OxITlIEBQUwLzUxBgIAFAgEMC81MQoJbG9jYWxob3N0EBwFAawbqqACAAAAoRAxLjMuNi4xLjQuMS40NDEz/gYAgMILAgD+GQCAwgkDAAAAAGQAAAAAAAAAAgICAgICAgL+GQCAwgoDAAAAAGQAAAAAAAAAAgICAgICAgIAAA==")}
 	type args struct {
 		egressPortNo int
 		packet       *of.OfpPacketOut
@@ -1470,17 +1470,17 @@
 
 	// Upstream flow DHCP flow - ONU1 UNI0 PON0
 	fa0 := &fu.FlowArgs{
-		MatchFields: []*ofp.OfpOxmOfbField{
+		MatchFields: []*of.OfpOxmOfbField{
 			fu.InPort(536870912),
 			fu.Metadata_ofp(1),
 			fu.IpProto(17), // dhcp
 			fu.VlanPcp(0),
-			fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT)),
+			fu.VlanVid(uint32(of.OfpVlanId_OFPVID_PRESENT)),
 			fu.TunnelId(256),
 		},
-		Actions: []*ofp.OfpAction{
+		Actions: []*of.OfpAction{
 			// fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA | 2))),
-			fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 257)),
+			fu.SetField(fu.VlanVid(uint32(of.OfpVlanId_OFPVID_PRESENT) | 257)),
 			fu.Output(2147483645),
 			fu.PushVlan(0x8100),
 		},
@@ -1491,7 +1491,7 @@
 	flowAdd := of.Flows{Items: make([]*of.OfpFlowStats, 0)}
 	flowAdd.Items = append(flowAdd.Items, flow0)
 	flowRemove := of.Flows{Items: make([]*of.OfpFlowStats, 0)}
-	flowChanges := &ofp.FlowChanges{ToAdd: &flowAdd, ToRemove: &flowRemove}
+	flowChanges := &of.FlowChanges{ToAdd: &flowAdd, ToRemove: &flowRemove}
 
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index a8bc359..c2c5b5e 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -257,9 +257,10 @@
 	/* Populating device event body */
 	de.Context = context
 	de.ResourceId = deviceID
-	if oltIndication.OperState == operationStateDown {
+	switch oltIndication.OperState {
+	case operationStateDown:
 		de.DeviceEventName = fmt.Sprintf("%s_%s", oltIndicationDown, "RAISE_EVENT")
-	} else if oltIndication.OperState == operationStateUp {
+	case operationStateUp:
 		de.DeviceEventName = fmt.Sprintf("%s_%s", oltIndicationDown, "CLEAR_EVENT")
 	}
 	/* Send event to KAFKA */
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 5b4a474..c64b4bc 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -389,9 +389,10 @@
 	}
 
 	var SchedCfg *tp_pb.SchedulerConfig
-	if sq.direction == tp_pb.Direction_UPSTREAM {
+	switch sq.direction {
+	case tp_pb.Direction_UPSTREAM:
 		SchedCfg = f.techprofile.GetUsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
-	} else if sq.direction == tp_pb.Direction_DOWNSTREAM {
+	case tp_pb.Direction_DOWNSTREAM:
 		SchedCfg = f.techprofile.GetDsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
 	}
 	TrafficSched := []*tp_pb.TrafficScheduler{f.techprofile.GetTrafficScheduler(sq.tpInst.(*tp_pb.TechProfileInstance), SchedCfg, TrafficShaping)}
@@ -662,10 +663,11 @@
 			"uni-id":    sq.uniID,
 			"uni-port":  sq.uniPort,
 			"device-id": f.deviceHandler.device.Id})
-	if sq.direction == tp_pb.Direction_UPSTREAM {
+	switch sq.direction {
+	case tp_pb.Direction_UPSTREAM:
 		SchedCfg = f.techprofile.GetUsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
 		Direction = "upstream"
-	} else if sq.direction == tp_pb.Direction_DOWNSTREAM {
+	case tp_pb.Direction_DOWNSTREAM:
 		SchedCfg = f.techprofile.GetDsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
 		Direction = "downstream"
 	}
@@ -732,9 +734,10 @@
 			"uni-port":  sq.uniPort,
 			"tp-id":     sq.tpID,
 			"device-id": f.deviceHandler.device.Id})
-	if sq.direction == tp_pb.Direction_UPSTREAM {
+	switch sq.direction {
+	case tp_pb.Direction_UPSTREAM:
 		schedCfg = f.techprofile.GetUsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
-	} else if sq.direction == tp_pb.Direction_DOWNSTREAM {
+	case tp_pb.Direction_DOWNSTREAM:
 		schedCfg = f.techprofile.GetDsScheduler(sq.tpInst.(*tp_pb.TechProfileInstance))
 	}
 
@@ -2114,13 +2117,14 @@
 
 	var ethType, ipProto, inPort uint32
 	for _, field := range flows.GetOfbFields(flow) {
-		if field.Type == flows.IP_PROTO {
+		switch field.Type {
+		case flows.IP_PROTO:
 			ipProto = field.GetIpProto()
 			logger.Debugw(ctx, "field-type-ip-proto", log.Fields{"ipProto": ipProto})
-		} else if field.Type == flows.ETH_TYPE {
+		case flows.ETH_TYPE:
 			ethType = field.GetEthType()
 			logger.Debugw(ctx, "field-type-eth-type", log.Fields{"ethType": ethType})
-		} else if field.Type == flows.IN_PORT {
+		case flows.IN_PORT:
 			inPort = field.GetPort()
 			logger.Debugw(ctx, "field-type-in-port", log.Fields{"inPort": inPort})
 		}
@@ -2563,7 +2567,8 @@
 func (f *OpenOltFlowMgr) GetLogicalPortFromPacketIn(ctx context.Context, packetIn *openoltpb2.PacketIndication) (uint32, error) {
 	var logicalPortNum uint32
 
-	if packetIn.IntfType == "pon" {
+	switch packetIn.IntfType {
+	case "pon":
 		// packet indication does not have serial number , so sending as nil
 		// get onu and uni ids associated with the given pon and gem ports
 		onuID, uniID := packetIn.OnuId, packetIn.UniId
@@ -2576,7 +2581,7 @@
 		}
 		// Store the gem port through which the packet_in came. Use the same gem port for packet_out
 		f.UpdateGemPortForPktIn(ctx, packetIn.IntfId, onuID, logicalPortNum, packetIn.GemportId, packetIn.Pkt)
-	} else if packetIn.IntfType == "nni" {
+	case "nni":
 		logicalPortNum = plt.IntfIDToPortNo(packetIn.IntfId, voltha.Port_ETHERNET_NNI)
 	}
 
@@ -2821,9 +2826,10 @@
 	if MeterID == 0 { // This should never happen
 		return "", olterrors.NewErrInvalidValue(log.Fields{"meter-id": MeterID}, nil).Log()
 	}
-	if Dir == tp_pb.Direction_UPSTREAM {
+	switch Dir {
+	case tp_pb.Direction_UPSTREAM:
 		return "upstream", nil
-	} else if Dir == tp_pb.Direction_DOWNSTREAM {
+	case tp_pb.Direction_DOWNSTREAM:
 		return "downstream", nil
 	}
 	return "", nil
@@ -2895,7 +2901,8 @@
 	}
 
 	if ipProto, ok := classifierInfo[IPProto]; ok {
-		if ipProto.(uint32) == IPProtoDhcp {
+		switch ipProto.(uint32) {
+		case IPProtoDhcp:
 			logger.Infow(ctx, "adding-dhcp-flow", log.Fields{
 				"tp-id":    tpID,
 				"alloc-id": allocID,
@@ -2910,7 +2917,7 @@
 				_ = f.clearResources(ctx, intfID, int32(onuID), int32(uniID), flow.Id, portNo, tpID, false, nni_port)
 				return err
 			}
-		} else if ipProto.(uint32) == IgmpProto {
+		case IgmpProto:
 			logger.Infow(ctx, "adding-us-igmp-flow",
 				log.Fields{
 					"intf-id":          intfID,
@@ -2923,12 +2930,13 @@
 				_ = f.clearResources(ctx, intfID, int32(onuID), int32(uniID), flow.Id, portNo, tpID, false, nni_port)
 				return err
 			}
-		} else {
+		default:
 			logger.Errorw(ctx, "invalid-classifier-to-handle", log.Fields{"classifier": classifierInfo, "action": actionInfo})
 			return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifierInfo, "action": actionInfo}, nil)
 		}
 	} else if ethType, ok := classifierInfo[EthType]; ok {
-		if ethType.(uint32) == EapEthType {
+		switch ethType.(uint32) {
+		case EapEthType:
 			logger.Infow(ctx, "adding-eapol-flow", log.Fields{
 				"intf-id": intfID,
 				"onu-id":  onuID,
@@ -2947,7 +2955,7 @@
 				_ = f.clearResources(ctx, intfID, int32(onuID), int32(uniID), flow.Id, portNo, tpID, false, nni_port)
 				return err
 			}
-		} else if ethType.(uint32) == PPPoEDEthType {
+		case PPPoEDEthType:
 			logger.Infow(ctx, "adding-pppoed-flow", log.Fields{
 				"tp-id":    tpID,
 				"alloc-id": allocID,
@@ -3033,49 +3041,50 @@
 
 func formulateClassifierInfoFromFlow(ctx context.Context, classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) {
 	for _, field := range flows.GetOfbFields(flow) {
-		if field.Type == flows.ETH_TYPE {
+		switch field.Type {
+		case flows.ETH_TYPE:
 			classifierInfo[EthType] = field.GetEthType()
 			logger.Debug(ctx, "field-type-eth-type", log.Fields{"classifierInfo[ETH_TYPE]": classifierInfo[EthType].(uint32)})
-		} else if field.Type == flows.ETH_DST {
+		case flows.ETH_DST:
 			classifierInfo[EthDst] = field.GetEthDst()
 			logger.Debug(ctx, "field-type-eth-dst", log.Fields{"classifierInfo[ETH_DST]": classifierInfo[EthDst].([]uint8)})
-		} else if field.Type == flows.ETH_SRC {
+		case flows.ETH_SRC:
 			classifierInfo[EthSrc] = field.GetEthSrc()
 			logger.Debug(ctx, "field-type-eth-src", log.Fields{"classifierInfo[ETH_SRC]": classifierInfo[EthSrc].([]uint8)})
-		} else if field.Type == flows.IP_PROTO {
+		case flows.IP_PROTO:
 			classifierInfo[IPProto] = field.GetIpProto()
 			logger.Debug(ctx, "field-type-ip-proto", log.Fields{"classifierInfo[IP_PROTO]": classifierInfo[IPProto].(uint32)})
-		} else if field.Type == flows.IN_PORT {
+		case flows.IN_PORT:
 			classifierInfo[InPort] = field.GetPort()
 			logger.Debug(ctx, "field-type-in-port", log.Fields{"classifierInfo[IN_PORT]": classifierInfo[InPort].(uint32)})
-		} else if field.Type == flows.VLAN_VID {
+		case flows.VLAN_VID:
 			// The ReservedVlan is used to signify transparent vlan. Do not do any classification when we see ReservedVlan
 			if field.GetVlanVid() != ReservedVlan {
 				classifierInfo[VlanVid] = field.GetVlanVid() & 0xfff
 				logger.Debug(ctx, "field-type-vlan-vid", log.Fields{"classifierInfo[VLAN_VID]": classifierInfo[VlanVid].(uint32)})
 			}
-		} else if field.Type == flows.VLAN_PCP {
+		case flows.VLAN_PCP:
 			classifierInfo[VlanPcp] = field.GetVlanPcp()
 			logger.Debug(ctx, "field-type-vlan-pcp", log.Fields{"classifierInfo[VLAN_PCP]": classifierInfo[VlanPcp].(uint32)})
-		} else if field.Type == flows.UDP_DST {
+		case flows.UDP_DST:
 			classifierInfo[UDPDst] = field.GetUdpDst()
 			logger.Debug(ctx, "field-type-udp-dst", log.Fields{"classifierInfo[UDP_DST]": classifierInfo[UDPDst].(uint32)})
-		} else if field.Type == flows.UDP_SRC {
+		case flows.UDP_SRC:
 			classifierInfo[UDPSrc] = field.GetUdpSrc()
 			logger.Debug(ctx, "field-type-udp-src", log.Fields{"classifierInfo[UDP_SRC]": classifierInfo[UDPSrc].(uint32)})
-		} else if field.Type == flows.IPV4_DST {
+		case flows.IPV4_DST:
 			classifierInfo[Ipv4Dst] = field.GetIpv4Dst()
 			logger.Debug(ctx, "field-type-ipv4-dst", log.Fields{"classifierInfo[IPV4_DST]": classifierInfo[Ipv4Dst].(uint32)})
-		} else if field.Type == flows.IPV4_SRC {
+		case flows.IPV4_SRC:
 			classifierInfo[Ipv4Src] = field.GetIpv4Src()
 			logger.Debug(ctx, "field-type-ipv4-src", log.Fields{"classifierInfo[IPV4_SRC]": classifierInfo[Ipv4Src].(uint32)})
-		} else if field.Type == flows.METADATA {
+		case flows.METADATA:
 			classifierInfo[Metadata] = field.GetTableMetadata()
 			logger.Debug(ctx, "field-type-metadata", log.Fields{"classifierInfo[Metadata]": classifierInfo[Metadata].(uint64)})
-		} else if field.Type == flows.TUNNEL_ID {
+		case flows.TUNNEL_ID:
 			classifierInfo[TunnelID] = field.GetTunnelId()
 			logger.Debug(ctx, "field-type-tunnelId", log.Fields{"classifierInfo[TUNNEL_ID]": classifierInfo[TunnelID].(uint64)})
-		} else {
+		default:
 			logger.Errorw(ctx, "un-supported-field-type", log.Fields{"type": field.Type})
 			return
 		}
@@ -3084,17 +3093,18 @@
 
 func formulateActionInfoFromFlow(ctx context.Context, actionInfo, classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) error {
 	for _, action := range flows.GetActions(flow) {
-		if action.Type == flows.OUTPUT {
+		switch action.Type {
+		case flows.OUTPUT:
 			if out := action.GetOutput(); out != nil {
 				actionInfo[Output] = out.GetPort()
 				logger.Debugw(ctx, "action-type-output", log.Fields{"out-port": actionInfo[Output].(uint32)})
 			} else {
 				return olterrors.NewErrInvalidValue(log.Fields{"output-port": nil}, nil)
 			}
-		} else if action.Type == flows.POP_VLAN {
+		case flows.POP_VLAN:
 			actionInfo[PopVlan] = true
 			logger.Debugw(ctx, "action-type-pop-vlan", log.Fields{"in_port": classifierInfo[InPort].(uint32)})
-		} else if action.Type == flows.PUSH_VLAN {
+		case flows.PUSH_VLAN:
 			if out := action.GetPush(); out != nil {
 				if tpid := out.GetEthertype(); tpid != 0x8100 {
 					logger.Errorw(ctx, "invalid ethertype in push action", log.Fields{"ethertype": actionInfo[PushVlan].(int32)})
@@ -3107,7 +3117,7 @@
 							"in-port":   classifierInfo[InPort].(uint32)})
 				}
 			}
-		} else if action.Type == flows.SET_FIELD {
+		case flows.SET_FIELD:
 			if out := action.GetSetField(); out != nil {
 				if field := out.GetField(); field != nil {
 					if ofClass := field.GetOxmClass(); ofClass != ofp.OfpOxmClass_OFPXMC_OPENFLOW_BASIC {
@@ -3117,9 +3127,9 @@
 					formulateSetFieldActionInfoFromFlow(ctx, field, actionInfo)
 				}
 			}
-		} else if action.Type == flows.GROUP {
+		case flows.GROUP:
 			formulateGroupActionInfoFromFlow(ctx, action, actionInfo)
-		} else {
+		default:
 			return olterrors.NewErrInvalidValue(log.Fields{"action-type": action.Type}, nil)
 		}
 	}
@@ -3129,18 +3139,19 @@
 func formulateSetFieldActionInfoFromFlow(ctx context.Context, field *ofp.OfpOxmField, actionInfo map[string]interface{}) {
 	if ofbField := field.GetOfbField(); ofbField != nil {
 		fieldtype := ofbField.GetType()
-		if fieldtype == ofp.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID {
+		switch fieldtype {
+		case ofp.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID:
 			if vlan := ofbField.GetVlanVid(); vlan != 0 {
 				actionInfo[VlanVid] = vlan & 0xfff
 				logger.Debugw(ctx, "action-set-vlan-vid", log.Fields{"actionInfo[VLAN_VID]": actionInfo[VlanVid].(uint32)})
 			} else {
 				logger.Error(ctx, "no-invalid-vlan-id-in-set-vlan-vid-action")
 			}
-		} else if fieldtype == ofp.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP {
+		case ofp.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP:
 			pcp := ofbField.GetVlanPcp()
 			actionInfo[VlanPcp] = pcp
 			logger.Debugw(ctx, "action-set-vlan-pcp", log.Fields{"actionInfo[VLAN_PCP]": actionInfo[VlanPcp].(uint32)})
-		} else {
+		default:
 			logger.Errorw(ctx, "unsupported-action-set-field-type", log.Fields{"type": fieldtype})
 		}
 	}
@@ -3247,7 +3258,8 @@
 // getNniIntfID gets nni intf id from the flow classifier/action
 func getNniIntfID(ctx context.Context, classifier map[string]interface{}, action map[string]interface{}) (uint32, error) {
 	portType := plt.IntfIDToPortTypeName(classifier[InPort].(uint32))
-	if portType == voltha.Port_PON_OLT {
+	switch portType {
+	case voltha.Port_PON_OLT:
 		intfID, err := plt.IntfIDFromNniPortNum(ctx, action[Output].(uint32))
 		if err != nil {
 			logger.Debugw(ctx, "invalid-action-port-number",
@@ -3258,7 +3270,7 @@
 		}
 		logger.Infow(ctx, "output-nni-intfId-is", log.Fields{"intf-id": intfID})
 		return intfID, nil
-	} else if portType == voltha.Port_ETHERNET_NNI {
+	case voltha.Port_ETHERNET_NNI:
 		intfID, err := plt.IntfIDFromNniPortNum(ctx, classifier[InPort].(uint32))
 		if err != nil {
 			logger.Debugw(ctx, "invalid-classifier-port-number",
@@ -3269,7 +3281,7 @@
 		}
 		logger.Infow(ctx, "input-nni-intfId-is", log.Fields{"intf-id": intfID})
 		return intfID, nil
-	} else if portType == voltha.Port_ETHERNET_UNI {
+	case voltha.Port_ETHERNET_UNI:
 		if _, ok := action[Output]; ok {
 			intfID, err := plt.IntfIDFromNniPortNum(ctx, action[Output].(uint32))
 			if err != nil {
@@ -3327,7 +3339,7 @@
 
 // getCTagFromPacket retrieves and returns c-tag and priority value from a packet.
 func getCTagFromPacket(ctx context.Context, packet []byte) (uint16, uint8, error) {
-	if packet == nil || len(packet) < 18 {
+	if len(packet) < 18 {
 		logger.Error(ctx, "unable-get-c-tag-from-the-packet--invalid-packet-length ")
 		return 0, 0, errors.New("invalid packet length")
 	}
diff --git a/internal/pkg/core/openolt_test.go b/internal/pkg/core/openolt_test.go
index b2bcfb4..720861e 100644
--- a/internal/pkg/core/openolt_test.go
+++ b/internal/pkg/core/openolt_test.go
@@ -39,7 +39,6 @@
 	"github.com/opencord/voltha-openolt-adapter/internal/pkg/config"
 	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	ca "github.com/opencord/voltha-protos/v5/go/core_adapter"
-	"github.com/opencord/voltha-protos/v5/go/openflow_13"
 	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
 	"github.com/opencord/voltha-protos/v5/go/voltha"
 )
@@ -336,12 +335,12 @@
 		wantErr error
 	}{
 		{"get_ofp_device_info-1", mockOlt(), args{mockDevice()}, &ca.SwitchCapability{
-			Desc: &openflow_13.OfpDesc{
+			Desc: &ofp.OfpDesc{
 				MfrDesc: "VOLTHA Project",
 				HwDesc:  "open_pon",
 				SwDesc:  "open_pon",
 			},
-			SwitchFeatures: &openflow_13.OfpSwitchFeatures{
+			SwitchFeatures: &ofp.OfpSwitchFeatures{
 				NBuffers:     uint32(256),
 				NTables:      uint32(2),
 				Capabilities: uint32(15),
@@ -395,7 +394,7 @@
 	type args struct {
 		deviceID     string
 		egressPortNo int
-		packet       *openflow_13.OfpPacketOut
+		packet       *ofp.OfpPacketOut
 	}
 	pktout := &ofp.OfpPacketOut{BufferId: 0, InPort: 1, Actions: acts, Data: []byte("AYDCAAAOAODsSE5TiMwCBwQA4OxITlIEBQUwLzUx" +
 		"BgIAFAgEMC81MQoJbG9jYWxob3N0EBwFAawbqqACAAAAoRAxLjMuNi4xLjQuMS40NDEz/gYAgMILAgD+GQCAwgkDAAAAAGQAAAAAAAAAAgICAgICAgL+" +
@@ -655,8 +654,8 @@
 func TestOpenOLT_UpdateFlowsIncrementally(t *testing.T) {
 	type args struct {
 		device       *voltha.Device
-		flows        *openflow_13.FlowChanges
-		groups       *openflow_13.FlowGroupChanges
+		flows        *ofp.FlowChanges
+		groups       *ofp.FlowGroupChanges
 		flowMetadata *ofp.FlowMetadata
 	}
 
diff --git a/internal/pkg/core/statsmanager.go b/internal/pkg/core/statsmanager.go
index 1169904..3e1db2e 100644
--- a/internal/pkg/core/statsmanager.go
+++ b/internal/pkg/core/statsmanager.go
@@ -316,21 +316,22 @@
 	   :return:
 	*/
 	var i uint32
-	if Intftype == "nni" {
+	switch Intftype {
+	case "nni":
 		NniPorts := make(map[uint32]*NniPort)
 		for i = 0; i < numOfPorts; i++ {
 			Port := BuildPortObject(ctx, i, "nni", DeviceID).(*NniPort)
 			NniPorts[Port.IntfID] = Port
 		}
 		return NniPorts, nil
-	} else if Intftype == "pon" {
+	case "pon":
 		PONPorts := make(map[uint32]*PonPort)
 		for i = 0; i < numOfPorts; i++ {
 			PONPort := BuildPortObject(ctx, i, "pon", DeviceID).(*PonPort)
 			PONPorts[plt.PortNoToIntfID(PONPort.IntfID, voltha.Port_PON_OLT)] = PONPort
 		}
 		return PONPorts, nil
-	} else {
+	default:
 		logger.Errorw(ctx, "invalid-type-of-interface", log.Fields{"interface-type": Intftype})
 		return nil, olterrors.NewErrInvalidValue(log.Fields{"interface-type": Intftype}, nil)
 	}
@@ -349,7 +350,8 @@
 
 	// This builds a port object which is added to the
 	// appropriate northbound or southbound values
-	if IntfType == "nni" {
+	switch IntfType {
+	case "nni":
 		IntfID := plt.IntfIDToPortNo(PortNum, voltha.Port_ETHERNET_NNI)
 		nniID := plt.PortNoToIntfID(IntfID, voltha.Port_ETHERNET_NNI)
 		logger.Debugw(ctx, "interface-type-nni",
@@ -357,7 +359,7 @@
 				"nni-id":    nniID,
 				"intf-type": IntfType})
 		return NewNniPort(PortNum, nniID)
-	} else if IntfType == "pon" {
+	case "pon":
 		// PON ports require a different configuration
 		//  intf_id and pon_id are currently equal.
 		IntfID := plt.IntfIDToPortNo(PortNum, voltha.Port_PON_OLT)
@@ -367,7 +369,7 @@
 				"pon-id":    PONID,
 				"intf-type": IntfType})
 		return NewPONPort(PONID, DeviceID, IntfID, PortNum)
-	} else {
+	default:
 		logger.Errorw(ctx, "invalid-type-of-interface", log.Fields{"intf-type": IntfType})
 		return nil
 	}
@@ -589,11 +591,12 @@
 	metricsContext["devicetype"] = devType
 	metricsContext["portlabel"] = port.Label
 
-	if statType == NNIStats {
+	switch statType {
+	case NNIStats:
 		volthaEventSubCatgry = voltha.EventSubCategory_NNI
-	} else if statType == PONStats {
+	case PONStats:
 		volthaEventSubCatgry = voltha.EventSubCategory_PON
-	} else if statType == GEMStats || statType == ONUStats {
+	case GEMStats, ONUStats:
 		volthaEventSubCatgry = voltha.EventSubCategory_ONT
 	}
 
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index bc0524d..6d50348 100644
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -355,15 +355,16 @@
 	})
 	for _, RangePool := range techRange.Pools {
 		// FIXME: Remove hardcoding
-		if RangePool.Type == openolt.DeviceInfo_DeviceResourceRanges_Pool_ONU_ID {
+		switch RangePool.Type {
+		case openolt.DeviceInfo_DeviceResourceRanges_Pool_ONU_ID:
 			ONUIDStart = RangePool.Start
 			ONUIDEnd = RangePool.End
 			ONUIDShared = uint32(RangePool.Sharing)
-		} else if RangePool.Type == openolt.DeviceInfo_DeviceResourceRanges_Pool_ALLOC_ID {
+		case openolt.DeviceInfo_DeviceResourceRanges_Pool_ALLOC_ID:
 			AllocIDStart = RangePool.Start
 			AllocIDEnd = RangePool.End
 			AllocIDShared = uint32(RangePool.Sharing)
-		} else if RangePool.Type == openolt.DeviceInfo_DeviceResourceRanges_Pool_GEMPORT_ID {
+		case openolt.DeviceInfo_DeviceResourceRanges_Pool_GEMPORT_ID:
 			GEMPortIDStart = RangePool.Start
 			GEMPortIDEnd = RangePool.End
 			GEMPortIDShared = uint32(RangePool.Sharing)
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
index 7d12d9f..c1ef409 100644
--- a/makefiles/docker/include.mk
+++ b/makefiles/docker/include.mk
@@ -17,7 +17,7 @@
 
 $(if $(DEBUG),$(warning ENTER))
 
-VOLTHA_TOOLS_VERSION ?= 3.1.1
+VOLTHA_TOOLS_VERSION ?= 3.1.3
 
 # ---------------------------
 # Macros: command refactoring
diff --git a/pkg/mocks/mockTechprofile.go b/pkg/mocks/mockTechprofile.go
index 3972145..cbff422 100644
--- a/pkg/mocks/mockTechprofile.go
+++ b/pkg/mocks/mockTechprofile.go
@@ -87,7 +87,8 @@
 func (m MockTechProfile) CreateTechProfileInstance(ctx context.Context, techProfiletblID uint32, uniPortName string, intfID uint32) (interface{}, error) {
 	var usGemPortAttributeList []*tp_pb.GemPortAttributes
 	var dsGemPortAttributeList []*tp_pb.GemPortAttributes
-	if techProfiletblID == 64 {
+	switch techProfiletblID {
+	case 64:
 		usGemPortAttributeList = append(usGemPortAttributeList, &tp_pb.GemPortAttributes{
 			GemportId: 1,
 			PbitMap:   "0b11111111",
@@ -126,7 +127,7 @@
 			UpstreamGemPortAttributeList:   usGemPortAttributeList,
 			DownstreamGemPortAttributeList: dsGemPortAttributeList,
 		}, nil
-	} else if techProfiletblID == 65 {
+	case 65:
 		return &tp_pb.EponTechProfileInstance{
 			Name:                         "mock-epon-profile",
 			SubscriberIdentifier:         "257",
@@ -136,7 +137,7 @@
 			UpstreamQueueAttributeList:   nil,
 			DownstreamQueueAttributeList: nil,
 		}, nil
-	} else {
+	default:
 		return nil, nil
 	}
 }