VOL-2639: Creation of common errors package

Change-Id: Iac2ab83826bf072c84af81e9e2bccf61d40c07ed
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 0695af6..03391a4 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -36,6 +36,7 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/adapters/adapterif"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/opencord/voltha-lib-go/v3/pkg/pmmetrics"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	rsrcMgr "github.com/opencord/voltha-openolt-adapter/internal/pkg/resourcemanager"
 	"github.com/opencord/voltha-protos/v3/go/common"
 	ic "github.com/opencord/voltha-protos/v3/go/inter_container"
@@ -180,13 +181,13 @@
 		if ips, err = net.LookupHost(host); err == nil {
 			log.Debugw("dns-result-ips", log.Fields{"ips": ips})
 			if addr = net.ParseIP(ips[0]); addr == nil {
-				return "", NewErrInvalidValue(log.Fields{"ip": ips[0]}, nil).Log()
+				return "", olterrors.NewErrInvalidValue(log.Fields{"ip": ips[0]}, nil).Log()
 			}
 			genmac = macifyIP(addr)
 			log.Debugw("using-ip-as-mac", log.Fields{"host": ips[0], "mac": genmac})
 			return genmac, nil
 		}
-		return "", NewErrAdapter("cannot-resolve-hostname-to-ip", nil, err).Log()
+		return "", olterrors.NewErrAdapter("cannot-resolve-hostname-to-ip", nil, err).Log()
 	}
 
 	genmac = macifyIP(addr)
@@ -218,7 +219,7 @@
 		return fmt.Sprintf("pon-%d", portNum), nil
 	}
 
-	return "", NewErrInvalidValue(log.Fields{"port-type": portType}, nil).Log()
+	return "", olterrors.NewErrInvalidValue(log.Fields{"port-type": portType}, nil).Log()
 }
 
 func (dh *DeviceHandler) addPort(intfID uint32, portType voltha.Port_PortType, state string) error {
@@ -234,19 +235,19 @@
 	portNum := IntfIDToPortNo(intfID, portType)
 	label, err := GetportLabel(portNum, portType)
 	if err != nil {
-		return NewErrNotFound("port-label", log.Fields{"port-number": portNum, "port-type": portType}, nil).Log()
+		return olterrors.NewErrNotFound("port-label", log.Fields{"port-number": portNum, "port-type": portType}, nil).Log()
 	}
 
 	device, err := dh.coreProxy.GetDevice(context.TODO(), dh.device.Id, dh.device.Id)
 	if err != nil || device == nil {
-		return NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	if device.Ports != nil {
 		for _, dPort := range device.Ports {
 			if dPort.Type == portType && dPort.PortNo == portNum {
 				log.Debug("port-already-exists-updating-oper-status-of-port")
 				if err := dh.coreProxy.PortStateUpdate(context.TODO(), dh.device.Id, portType, portNum, operStatus); err != nil {
-					return NewErrAdapter("failed-to-update-port-state", log.Fields{
+					return olterrors.NewErrAdapter("failed-to-update-port-state", log.Fields{
 						"device-id":   dh.device.Id,
 						"port-type":   portType,
 						"port-number": portNum,
@@ -267,7 +268,7 @@
 	log.Debugw("Sending-port-update-to-core", log.Fields{"port": port})
 	// Synchronous call to update device - this method is run in its own go routine
 	if err := dh.coreProxy.PortCreated(context.TODO(), dh.device.Id, port); err != nil {
-		return NewErrAdapter("Error-creating-port", log.Fields{
+		return olterrors.NewErrAdapter("Error-creating-port", log.Fields{
 			"device-id": dh.device.Id,
 			"port-type": portType}, err).Log()
 	}
@@ -279,16 +280,16 @@
 	defer log.Debugw("indications-ended", log.Fields{"device-id": dh.device.Id})
 	indications, err := dh.Client.EnableIndication(ctx, new(oop.Empty))
 	if err != nil {
-		return NewErrCommunication("fail-to-read-indications", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrCommunication("fail-to-read-indications", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	if indications == nil {
-		return NewErrInvalidValue(log.Fields{"indications": nil, "device-id": dh.device.Id}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"indications": nil, "device-id": dh.device.Id}, nil).Log()
 	}
 	/* get device state */
 	device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
 	if err != nil || device == nil {
 		/*TODO: needs to handle error scenarios */
-		return NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	// When the device is in DISABLED and Adapter container restarts, we need to
 	// rebuild the locally maintained admin state.
@@ -321,7 +322,7 @@
 			time.Sleep(indicationBackoff.NextBackOff())
 			indications, err = dh.Client.EnableIndication(ctx, new(oop.Empty))
 			if err != nil {
-				return NewErrCommunication("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
+				return olterrors.NewErrCommunication("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
 			}
 			continue
 		}
@@ -333,7 +334,7 @@
 			}
 			dh.transitionMap.Handle(ctx, DeviceDownInd)
 			dh.transitionMap.Handle(ctx, DeviceInit)
-			return NewErrCommunication("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
+			return olterrors.NewErrCommunication("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
 		}
 		// Reset backoff if we have a successful receive
 		indicationBackoff.Reset()
@@ -361,7 +362,7 @@
 	}
 	// Send or clear Alarm
 	if err := dh.eventMgr.oltUpDownIndication(oltIndication, dh.deviceID, raisedTs); err != nil {
-		return NewErrAdapter("failed-indication", log.Fields{
+		return olterrors.NewErrAdapter("failed-indication", log.Fields{
 			"device_id":  dh.deviceID,
 			"indication": oltIndication,
 			"timestamp":  raisedTs}, err).Log()
@@ -375,13 +376,13 @@
 	switch indication.Data.(type) {
 	case *oop.Indication_OltInd:
 		if err := dh.handleOltIndication(ctx, indication.GetOltInd()); err != nil {
-			NewErrAdapter("handle-indication-error", log.Fields{"type": "olt"}, err).Log()
+			olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "olt"}, err).Log()
 		}
 	case *oop.Indication_IntfInd:
 		intfInd := indication.GetIntfInd()
 		go func() {
 			if err := dh.addPort(intfInd.GetIntfId(), voltha.Port_PON_OLT, intfInd.GetOperState()); err != nil {
-				NewErrAdapter("handle-indication-error", log.Fields{"type": "interface"}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface"}, err).Log()
 			}
 		}()
 		log.Infow("Received interface indication ", log.Fields{"InterfaceInd": intfInd})
@@ -390,7 +391,7 @@
 		if intfOperInd.GetType() == "nni" {
 			go func() {
 				if err := dh.addPort(intfOperInd.GetIntfId(), voltha.Port_ETHERNET_NNI, intfOperInd.GetOperState()); err != nil {
-					NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-nni"}, err).Log()
+					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-nni"}, err).Log()
 				}
 			}()
 			dh.resourceMgr.AddNNIToKVStore(ctx, intfOperInd.GetIntfId())
@@ -399,7 +400,7 @@
 			// Handle pon port update
 			go func() {
 				if err := dh.addPort(intfOperInd.GetIntfId(), voltha.Port_PON_OLT, intfOperInd.GetOperState()); err != nil {
-					NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-pon"}, err).Log()
+					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-pon"}, err).Log()
 				}
 			}()
 			go dh.eventMgr.oltIntfOperIndication(indication.GetIntfOperInd(), dh.deviceID, raisedTs)
@@ -411,7 +412,7 @@
 		sn := dh.stringifySerialNumber(onuDiscInd.SerialNumber)
 		go func() {
 			if err := dh.onuDiscIndication(ctx, onuDiscInd, sn); err != nil {
-				NewErrAdapter("handle-indication-error", log.Fields{"type": "onu-discovery"}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu-discovery"}, err).Log()
 			}
 		}()
 	case *oop.Indication_OnuInd:
@@ -419,7 +420,7 @@
 		log.Infow("Received Onu indication ", log.Fields{"OnuInd": onuInd})
 		go func() {
 			if err := dh.onuIndication(onuInd); err != nil {
-				NewErrAdapter("handle-indication-error", log.Fields{"type": "onu"}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu"}, err).Log()
 			}
 		}()
 	case *oop.Indication_OmciInd:
@@ -427,7 +428,7 @@
 		log.Debugw("Received Omci indication ", log.Fields{"IntfId": omciInd.IntfId, "OnuId": omciInd.OnuId, "pkt": hex.EncodeToString(omciInd.Pkt)})
 		go func() {
 			if err := dh.omciIndication(omciInd); err != nil {
-				NewErrAdapter("handle-indication-error", log.Fields{"type": "omci"}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "omci"}, err).Log()
 			}
 		}()
 	case *oop.Indication_PktInd:
@@ -435,7 +436,7 @@
 		log.Infow("Received pakcet indication ", log.Fields{"PktInd": pktInd})
 		go func() {
 			if err := dh.handlePacketIndication(ctx, pktInd); err != nil {
-				NewErrAdapter("handle-indication-error", log.Fields{"type": "packet"}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "packet"}, err).Log()
 			}
 		}()
 	case *oop.Indication_PortStats:
@@ -456,7 +457,7 @@
 	// Synchronous call to update device state - this method is run in its own go routine
 	if err := dh.coreProxy.DeviceStateUpdate(ctx, dh.device.Id, voltha.ConnectStatus_REACHABLE,
 		voltha.OperStatus_ACTIVE); err != nil {
-		return NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	return nil
 }
@@ -470,13 +471,13 @@
 	device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
 	if err != nil || device == nil {
 		/*TODO: needs to handle error scenarios */
-		return NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 
 	cloned := proto.Clone(device).(*voltha.Device)
 	// Update the all ports state on that device to disable
 	if err = dh.coreProxy.PortsStateUpdate(ctx, cloned.Id, voltha.OperStatus_UNKNOWN); err != nil {
-		return NewErrAdapter("port-update-failed", log.Fields{"device-id": device.Id}, err).Log()
+		return olterrors.NewErrAdapter("port-update-failed", log.Fields{"device-id": device.Id}, err).Log()
 	}
 
 	//Update the device oper state and connection status
@@ -485,13 +486,13 @@
 	dh.device = cloned
 
 	if err = dh.coreProxy.DeviceStateUpdate(ctx, cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
-		return NewErrAdapter("state-update-failed", log.Fields{"device-id": device.Id}, err).Log()
+		return olterrors.NewErrAdapter("state-update-failed", log.Fields{"device-id": device.Id}, err).Log()
 	}
 
 	//get the child device for the parent device
 	onuDevices, err := dh.coreProxy.GetChildDevices(ctx, dh.device.Id)
 	if err != nil {
-		return NewErrAdapter("child-device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrAdapter("child-device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	for _, onuDevice := range onuDevices.Items {
 
@@ -501,7 +502,7 @@
 		err := dh.AdapterProxy.SendInterAdapterMessage(ctx, &onuInd, ic.InterAdapterMessageType_ONU_IND_REQUEST,
 			"openolt", onuDevice.Type, onuDevice.Id, onuDevice.ProxyAddress.DeviceId, "")
 		if err != nil {
-			NewErrCommunication("inter-adapter-send-failed", log.Fields{
+			olterrors.NewErrCommunication("inter-adapter-send-failed", log.Fields{
 				"source":        "openolt",
 				"onu-indicator": onuInd,
 				"device-type":   onuDevice.Type,
@@ -520,7 +521,7 @@
 func (dh *DeviceHandler) doStateInit(ctx context.Context) error {
 	var err error
 	if dh.clientCon, err = grpc.Dial(dh.device.GetHostAndPort(), grpc.WithInsecure(), grpc.WithBlock()); err != nil {
-		return NewErrCommunication("dial-failure", log.Fields{
+		return olterrors.NewErrCommunication("dial-failure", log.Fields{
 			"device-id":     dh.deviceID,
 			"host-and-port": dh.device.GetHostAndPort()}, err).Log()
 	}
@@ -544,7 +545,7 @@
 		device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
 		if err != nil || device == nil {
 			/*TODO: needs to handle error scenarios */
-			NewErrAdapter("device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+			olterrors.NewErrAdapter("device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 		}
 
 		cloned := proto.Clone(device).(*voltha.Device)
@@ -552,19 +553,19 @@
 		cloned.OperStatus = voltha.OperStatus_UNKNOWN
 		dh.device = cloned
 		if er := dh.coreProxy.DeviceStateUpdate(ctx, cloned.Id, cloned.ConnectStatus, cloned.OperStatus); er != nil {
-			NewErrAdapter("device-state-update-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+			olterrors.NewErrAdapter("device-state-update-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 		}
 
 		// Since the device was disabled before the OLT was rebooted, enforce the OLT to be Disabled after re-connection.
 		_, err = dh.Client.DisableOlt(ctx, new(oop.Empty))
 		if err != nil {
-			NewErrAdapter("olt-disable-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+			olterrors.NewErrAdapter("olt-disable-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 		}
 
 		// Start reading indications
 		go func() {
 			if err := dh.readIndications(ctx); err != nil {
-				NewErrAdapter("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+				olterrors.NewErrAdapter("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 			}
 		}()
 		return nil
@@ -572,27 +573,27 @@
 
 	deviceInfo, err := dh.populateDeviceInfo()
 	if err != nil {
-		return NewErrAdapter("populate-device-info-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrAdapter("populate-device-info-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 
 	device, err := dh.coreProxy.GetDevice(context.TODO(), dh.device.Id, dh.device.Id)
 	if err != nil || device == nil {
 		/*TODO: needs to handle error scenarios */
-		return NewErrAdapter("fetch-device-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return olterrors.NewErrAdapter("fetch-device-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 	dh.populateActivePorts(device)
 	if err := dh.disableAdminDownPorts(device); err != nil {
-		return NewErrAdapter("port-status-update-failed", log.Fields{"device": device}, err).Log()
+		return olterrors.NewErrAdapter("port-status-update-failed", log.Fields{"device": device}, err).Log()
 	}
 
 	KVStoreHostPort := fmt.Sprintf("%s:%d", dh.openOLT.KVStoreHost, dh.openOLT.KVStorePort)
 	// Instantiate resource manager
 	if dh.resourceMgr = rsrcMgr.NewResourceMgr(ctx, dh.deviceID, KVStoreHostPort, dh.openOLT.KVStoreType, dh.deviceType, deviceInfo); dh.resourceMgr == nil {
-		return ErrResourceManagerInstantiating.Log()
+		return olterrors.ErrResourceManagerInstantiating.Log()
 	}
 	// Instantiate flow manager
 	if dh.flowMgr = NewFlowManager(ctx, dh, dh.resourceMgr); dh.flowMgr == nil {
-		return ErrResourceManagerInstantiating.Log()
+		return olterrors.ErrResourceManagerInstantiating.Log()
 	}
 	/* TODO: Instantiate Alarm , stats , BW managers */
 	/* Instantiating Event Manager to handle Alarms and KPIs */
@@ -603,7 +604,7 @@
 	// Start reading indications
 	go func() {
 		if err := dh.readIndications(ctx); err != nil {
-			NewErrAdapter("read-indications-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
+			olterrors.NewErrAdapter("read-indications-failure", log.Fields{"device-id": dh.device.Id}, err).Log()
 		}
 	}()
 	return nil
@@ -616,10 +617,10 @@
 	deviceInfo, err = dh.Client.GetDeviceInfo(context.Background(), new(oop.Empty))
 
 	if err != nil {
-		return nil, NewErrPersistence("get", "device", 0, nil, err).Log()
+		return nil, olterrors.NewErrPersistence("get", "device", 0, nil, err).Log()
 	}
 	if deviceInfo == nil {
-		return nil, NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
+		return nil, olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
 	}
 
 	log.Debugw("Fetched device info", log.Fields{"deviceInfo": deviceInfo})
@@ -635,7 +636,7 @@
 		host := strings.Split(dh.device.GetHostAndPort(), ":")[0]
 		genmac, err := generateMacFromHost(host)
 		if err != nil {
-			return nil, NewErrAdapter("failed-to-generate-mac-host", log.Fields{"host": host}, err).Log()
+			return nil, olterrors.NewErrAdapter("failed-to-generate-mac-host", log.Fields{"host": host}, err).Log()
 		}
 		log.Debugw("using-host-for-mac-address", log.Fields{"host": host, "mac": genmac})
 		dh.device.MacAddress = genmac
@@ -645,7 +646,7 @@
 
 	// Synchronous call to update device - this method is run in its own go routine
 	if err := dh.coreProxy.DeviceUpdate(context.TODO(), dh.device); err != nil {
-		return nil, NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+		return nil, olterrors.NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 	}
 
 	return deviceInfo, nil
@@ -694,7 +695,7 @@
 
 	// Now, set the initial PM configuration for that device
 	if err := dh.coreProxy.DevicePMConfigUpdate(nil, dh.metrics.ToPmConfigs()); err != nil {
-		NewErrAdapter("error-updating-performance-metrics", log.Fields{"device-id": device.Id}, err).LogAt(log.ErrorLevel)
+		olterrors.NewErrAdapter("error-updating-performance-metrics", log.Fields{"device-id": device.Id}, err).LogAt(log.ErrorLevel)
 	}
 
 	go startCollector(dh)
@@ -760,7 +761,7 @@
 
 		onuDevice, err := dh.coreProxy.GetChildDevice(context.TODO(), dh.device.Id, kwargs)
 		if err != nil {
-			return NewErrNotFound("onu", log.Fields{
+			return olterrors.NewErrNotFound("onu", log.Fields{
 				"interface-id": omciInd.IntfId,
 				"onu-id":       omciInd.OnuId}, err).Log()
 		}
@@ -781,7 +782,7 @@
 	if err := dh.AdapterProxy.SendInterAdapterMessage(context.Background(), omciMsg,
 		ic.InterAdapterMessageType_OMCI_REQUEST, dh.deviceType, deviceType,
 		deviceID, proxyDeviceID, ""); err != nil {
-		return NewErrCommunication("omci-request", log.Fields{
+		return olterrors.NewErrCommunication("omci-request", log.Fields{
 			"source":          dh.deviceType,
 			"destination":     deviceType,
 			"onu-id":          deviceID,
@@ -815,27 +816,27 @@
 		if omciMsg.GetProxyAddress() == nil {
 			onuDevice, err := dh.coreProxy.GetDevice(context.TODO(), dh.device.Id, toDeviceID)
 			if err != nil {
-				return NewErrNotFound("onu", log.Fields{
+				return olterrors.NewErrNotFound("onu", log.Fields{
 					"device-id":     dh.device.Id,
 					"onu-device-id": toDeviceID}, err).Log()
 			}
 			log.Debugw("device retrieved from core", log.Fields{"msgID": msgID, "fromTopic": fromTopic, "toTopic": toTopic, "toDeviceID": toDeviceID, "proxyDeviceID": proxyDeviceID})
 			if err := dh.sendProxiedMessage(onuDevice, omciMsg); err != nil {
-				return NewErrCommunication("send-failed", log.Fields{
+				return olterrors.NewErrCommunication("send-failed", log.Fields{
 					"device-id":     dh.device.Id,
 					"onu-device-id": toDeviceID}, err).Log()
 			}
 		} else {
 			log.Debugw("Proxy Address found in omci message", log.Fields{"msgID": msgID, "fromTopic": fromTopic, "toTopic": toTopic, "toDeviceID": toDeviceID, "proxyDeviceID": proxyDeviceID})
 			if err := dh.sendProxiedMessage(nil, omciMsg); err != nil {
-				return NewErrCommunication("send-failed", log.Fields{
+				return olterrors.NewErrCommunication("send-failed", log.Fields{
 					"device-id":     dh.device.Id,
 					"onu-device-id": toDeviceID}, err).Log()
 			}
 		}
 
 	} else {
-		return NewErrInvalidValue(log.Fields{"inter-adapter-message-type": msg.Header.Type}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"inter-adapter-message-type": msg.Header.Type}, nil).Log()
 	}
 	return nil
 }
@@ -856,7 +857,7 @@
 	if connectStatus != voltha.ConnectStatus_REACHABLE {
 		log.Debugw("ONU is not reachable, cannot send OMCI", log.Fields{"intfID": intfID, "onuID": onuID})
 
-		return NewErrCommunication("unreachable", log.Fields{
+		return olterrors.NewErrCommunication("unreachable", log.Fields{
 			"interface-id": intfID,
 			"onu-id":       onuID}, nil).Log()
 	}
@@ -880,7 +881,7 @@
 
 	_, err := dh.Client.OmciMsgOut(context.Background(), omciMessage)
 	if err != nil {
-		return NewErrCommunication("omci-send-failed", log.Fields{
+		return olterrors.NewErrCommunication("omci-send-failed", log.Fields{
 			"interface-id": intfID,
 			"onu-id":       onuID,
 			"message":      omciMessage}, err).Log()
@@ -900,7 +901,7 @@
 		if st.Code() == codes.AlreadyExists {
 			log.Debug("ONU activation is in progress", log.Fields{"SerialNumber": serialNumber})
 		} else {
-			return NewErrAdapter("onu-activate-failed", log.Fields{"onu": Onu}, err).Log()
+			return olterrors.NewErrAdapter("onu-activate-failed", log.Fields{"onu": Onu}, err).Log()
 		}
 	} else {
 		log.Infow("activated-onu", log.Fields{"SerialNumber": serialNumber})
@@ -919,7 +920,7 @@
 	if sn != "" {
 		kwargs["serial_number"] = sn
 	} else {
-		return NewErrInvalidValue(log.Fields{"serial-number": sn}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"serial-number": sn}, nil).Log()
 	}
 
 	if _, loaded := dh.discOnus.LoadOrStore(sn, true); loaded {
@@ -944,7 +945,7 @@
 			case codes.DeadlineExceeded:
 				// if the call times out, cleanup and exit
 				dh.discOnus.Delete(sn)
-				return NewErrTimeout("get-child-device", log.Fields{"device-id": dh.device.Id}, err).Log()
+				return olterrors.NewErrTimeout("get-child-device", log.Fields{"device-id": dh.device.Id}, err).Log()
 			}
 		}
 	}
@@ -964,7 +965,7 @@
 			// if we can't create an ID in resource manager,
 			// cleanup and exit
 			dh.discOnus.Delete(sn)
-			return NewErrAdapter("resource-manage-get-onu-id-failed", log.Fields{
+			return olterrors.NewErrAdapter("resource-manage-get-onu-id-failed", log.Fields{
 				"pon-interface-id": ponintfid,
 				"serial-number":    sn}, err).Log()
 		}
@@ -973,7 +974,7 @@
 			"", int(channelID), string(onuDiscInd.SerialNumber.GetVendorId()), sn, int64(onuID)); err != nil {
 			dh.discOnus.Delete(sn)
 			dh.resourceMgr.FreeonuID(ctx, ponintfid, []uint32{onuID}) // NOTE I'm not sure this method is actually cleaning up the right thing
-			return NewErrAdapter("core-proxy-child-device-detected-failed", log.Fields{
+			return olterrors.NewErrAdapter("core-proxy-child-device-detected-failed", log.Fields{
 				"pon-interface-id": ponintfid,
 				"serial-number":    sn}, err).Log()
 		}
@@ -995,13 +996,13 @@
 	log.Debugw("new-onu-device-discovered", log.Fields{"onu": onuDev, "sn": sn})
 
 	if err = dh.coreProxy.DeviceStateUpdate(ctx, onuDevice.Id, common.ConnectStatus_REACHABLE, common.OperStatus_DISCOVERED); err != nil {
-		return NewErrAdapter("failed-to-update-device-state", log.Fields{
+		return olterrors.NewErrAdapter("failed-to-update-device-state", log.Fields{
 			"device-id":     onuDevice.Id,
 			"serial-number": sn}, err).Log()
 	}
 	log.Infow("onu-discovered-reachable", log.Fields{"deviceId": onuDevice.Id, "sn": sn})
 	if err = dh.activateONU(ctx, onuDiscInd.IntfId, int64(onuID), onuDiscInd.SerialNumber, sn); err != nil {
-		return NewErrAdapter("onu-activation-failed", log.Fields{
+		return olterrors.NewErrAdapter("onu-activation-failed", log.Fields{
 			"device-id":     onuDevice.Id,
 			"serial-number": sn}, err).Log()
 	}
@@ -1043,7 +1044,7 @@
 	}
 
 	if err != nil || onuDevice == nil {
-		return NewErrNotFound("onu-device", errFields, err).Log()
+		return olterrors.NewErrNotFound("onu-device", errFields, err).Log()
 	}
 
 	if onuDevice.ParentPortNo != ponPort {
@@ -1064,7 +1065,7 @@
 
 	}
 	if err := dh.updateOnuStates(onuDevice, onuInd); err != nil {
-		return NewErrCommunication("state-update-failed", errFields, err).Log()
+		return olterrors.NewErrCommunication("state-update-failed", errFields, err).Log()
 	}
 	return nil
 }
@@ -1087,7 +1088,7 @@
 		err := dh.AdapterProxy.SendInterAdapterMessage(ctx, onuInd, ic.InterAdapterMessageType_ONU_IND_REQUEST,
 			"openolt", onuDevice.Type, onuDevice.Id, onuDevice.ProxyAddress.DeviceId, "")
 		if err != nil {
-			return NewErrCommunication("inter-adapter-send-failed", log.Fields{
+			return olterrors.NewErrCommunication("inter-adapter-send-failed", log.Fields{
 				"onu-indicator": onuInd,
 				"source":        "openolt",
 				"device-type":   onuDevice.Type,
@@ -1099,14 +1100,14 @@
 		err := dh.AdapterProxy.SendInterAdapterMessage(ctx, onuInd, ic.InterAdapterMessageType_ONU_IND_REQUEST,
 			"openolt", onuDevice.Type, onuDevice.Id, onuDevice.ProxyAddress.DeviceId, "")
 		if err != nil {
-			return NewErrCommunication("inter-adapter-send-failed", log.Fields{
+			return olterrors.NewErrCommunication("inter-adapter-send-failed", log.Fields{
 				"onu-indicator": onuInd,
 				"source":        "openolt",
 				"device-type":   onuDevice.Type,
 				"device-id":     onuDevice.Id}, err).Log()
 		}
 	default:
-		return NewErrInvalidValue(log.Fields{"oper-state": onuInd.OperState}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"oper-state": onuInd.OperState}, nil).Log()
 	}
 	return nil
 }
@@ -1142,7 +1143,7 @@
 
 //UpdateFlowsBulk upates the bulk flow
 func (dh *DeviceHandler) UpdateFlowsBulk() error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //GetChildDevice returns the child device for given parent port and onu id
@@ -1153,7 +1154,7 @@
 	kwargs["parent_port_no"] = parentPort
 	onuDevice, err := dh.coreProxy.GetChildDevice(context.TODO(), dh.device.Id, kwargs)
 	if err != nil {
-		return nil, NewErrNotFound("onu", log.Fields{
+		return nil, olterrors.NewErrNotFound("onu", log.Fields{
 			"interface-id": parentPort,
 			"onu-id":       onuID}, err).Log()
 	}
@@ -1170,7 +1171,7 @@
 		"packet": hex.EncodeToString(packetPayload),
 	})
 	if err := dh.coreProxy.SendPacketIn(context.TODO(), dh.device.Id, logicalPort, packetPayload); err != nil {
-		return NewErrCommunication("packet-send-failed", log.Fields{
+		return olterrors.NewErrCommunication("packet-send-failed", log.Fields{
 			"source":       "adapter",
 			"destination":  "core",
 			"device-id":    dh.device.Id,
@@ -1249,7 +1250,7 @@
 				dh.lockDevice.Lock()
 				dh.adminState = "up"
 				dh.lockDevice.Unlock()
-				return NewErrAdapter("olt-disable-failed", log.Fields{"device-id": device.Id}, err).Log()
+				return olterrors.NewErrAdapter("olt-disable-failed", log.Fields{"device-id": device.Id}, err).Log()
 			}
 		}
 	}
@@ -1315,7 +1316,7 @@
 			dh.lockDevice.Lock()
 			dh.adminState = "down"
 			dh.lockDevice.Unlock()
-			return NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
+			return olterrors.NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 		}
 	}
 	log.Debug("olt-reenabled")
@@ -1324,14 +1325,14 @@
 	// Update the all ports state on that device to enable
 
 	if err := dh.disableAdminDownPorts(device); err != nil {
-		return NewErrAdapter("port-status-update-failed-after-olt-reenable", log.Fields{"device": device}, err).Log()
+		return olterrors.NewErrAdapter("port-status-update-failed-after-olt-reenable", log.Fields{"device": device}, err).Log()
 	}
 	//Update the device oper status as ACTIVE
 	cloned.OperStatus = voltha.OperStatus_ACTIVE
 	dh.device = cloned
 
 	if err := dh.coreProxy.DeviceStateUpdate(context.TODO(), cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
-		return NewErrAdapter("state-update-failed", log.Fields{
+		return olterrors.NewErrAdapter("state-update-failed", log.Fields{
 			"device-id":      device.Id,
 			"connect-status": cloned.ConnectStatus,
 			"oper-status":    cloned.OperStatus}, err).Log()
@@ -1390,7 +1391,7 @@
 	//Free the flow-ids for the NNI port
 	nni, err := dh.resourceMgr.GetNNIFromKVStore(ctx)
 	if err != nil {
-		return NewErrPersistence("get", "nni", 0, nil, err).Log()
+		return olterrors.NewErrPersistence("get", "nni", 0, nil, err).Log()
 	}
 	log.Debugw("NNI are ", log.Fields{"nni": nni})
 	for _, nniIntfID := range nni {
@@ -1402,7 +1403,7 @@
 		dh.resourceMgr.RemoveResourceMap(ctx, nniIntfID, int32(nniOnuID), int32(nniUniID))
 	}
 	if err = dh.resourceMgr.DelNNiFromKVStore(ctx); err != nil {
-		return NewErrPersistence("clear", "nni", 0, nil, err).Log()
+		return olterrors.NewErrPersistence("clear", "nni", 0, nil, err).Log()
 	}
 	return nil
 }
@@ -1428,7 +1429,7 @@
 			var onuGemData []rsrcMgr.OnuGemInfo
 			err := dh.resourceMgr.ResourceMgrs[ponPort].GetOnuGemInfo(ctx, ponPort, &onuGemData)
 			if err != nil {
-				return NewErrNotFound("onu", log.Fields{
+				return olterrors.NewErrNotFound("onu", log.Fields{
 					"device-id": dh.device.Id,
 					"pon-port":  ponPort}, err).Log()
 			}
@@ -1477,14 +1478,14 @@
 	//Reset the state
 	if dh.Client != nil {
 		if _, err := dh.Client.Reboot(ctx, new(oop.Empty)); err != nil {
-			return NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err).Log()
+			return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err).Log()
 		}
 	}
 	cloned := proto.Clone(device).(*voltha.Device)
 	cloned.OperStatus = voltha.OperStatus_UNKNOWN
 	cloned.ConnectStatus = voltha.ConnectStatus_UNREACHABLE
 	if err := dh.coreProxy.DeviceStateUpdate(ctx, cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
-		return NewErrAdapter("device-state-update-failed", log.Fields{
+		return olterrors.NewErrAdapter("device-state-update-failed", log.Fields{
 			"device-id":      device.Id,
 			"connect-status": cloned.ConnectStatus,
 			"oper-status":    cloned.OperStatus}, err).Log()
@@ -1495,7 +1496,7 @@
 //RebootDevice reboots the given device
 func (dh *DeviceHandler) RebootDevice(device *voltha.Device) error {
 	if _, err := dh.Client.Reboot(context.Background(), new(oop.Empty)); err != nil {
-		return NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err).Log()
+		return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err).Log()
 	}
 	log.Debugw("rebooted-device-successfully", log.Fields{"deviceID": device.Id})
 	return nil
@@ -1508,14 +1509,14 @@
 	})
 	logicalPortNum, err := dh.flowMgr.GetLogicalPortFromPacketIn(ctx, packetIn)
 	if err != nil {
-		return NewErrNotFound("logical-port", log.Fields{"packet": hex.EncodeToString(packetIn.Pkt)}, err).Log()
+		return olterrors.NewErrNotFound("logical-port", log.Fields{"packet": hex.EncodeToString(packetIn.Pkt)}, err).Log()
 	}
 	log.Debugw("sending packet-in to core", log.Fields{
 		"logicalPortNum": logicalPortNum,
 		"packet":         hex.EncodeToString(packetIn.Pkt),
 	})
 	if err := dh.coreProxy.SendPacketIn(context.TODO(), dh.device.Id, logicalPortNum, packetIn.Pkt); err != nil {
-		return NewErrCommunication("send-packet-in", log.Fields{
+		return olterrors.NewErrCommunication("send-packet-in", log.Fields{
 			"destination": "core",
 			"source":      dh.deviceType,
 			"packet":      hex.EncodeToString(packetIn.Pkt)}, err).Log()
@@ -1581,7 +1582,7 @@
 		})
 
 		if _, err := dh.Client.OnuPacketOut(ctx, &onuPkt); err != nil {
-			return NewErrCommunication("packet-out-send", log.Fields{
+			return olterrors.NewErrCommunication("packet-out-send", log.Fields{
 				"source":             "adapter",
 				"destination":        "onu",
 				"egress-port-number": egressPortNo,
@@ -1594,7 +1595,7 @@
 	} else if egressPortType == voltha.Port_ETHERNET_NNI {
 		nniIntfID, err := IntfIDFromNniPortNum(uint32(egressPortNo))
 		if err != nil {
-			return NewErrInvalidValue(log.Fields{"egress-nni-port": egressPortNo}, err).Log()
+			return olterrors.NewErrInvalidValue(log.Fields{"egress-nni-port": egressPortNo}, err).Log()
 		}
 		uplinkPkt := oop.UplinkPacket{IntfId: nniIntfID, Pkt: packet.Data}
 
@@ -1604,7 +1605,7 @@
 		})
 
 		if _, err := dh.Client.UplinkPacketOut(ctx, &uplinkPkt); err != nil {
-			return NewErrCommunication("packet-out-to-nni", log.Fields{"packet": hex.EncodeToString(packet.Data)}, err).Log()
+			return olterrors.NewErrCommunication("packet-out-to-nni", log.Fields{"packet": hex.EncodeToString(packet.Data)}, err).Log()
 		}
 	} else {
 		log.Warnw("Packet-out-to-this-interface-type-not-implemented", log.Fields{
@@ -1664,7 +1665,7 @@
 
 	go dh.notifyChildDevices("unreachable")
 	if err := dh.coreProxy.DeviceStateUpdate(context.TODO(), dh.device.Id, voltha.ConnectStatus_UNREACHABLE, voltha.OperStatus_UNKNOWN); err != nil {
-		NewErrAdapter("device-state-update-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+		olterrors.NewErrAdapter("device-state-update-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 	}
 }
 
@@ -1688,7 +1689,7 @@
 		// Bug is opened for VOL-2505 to support NNI disable feature.
 		log.Infow("voltha-supports-single-nni-hence-disable-of-nni-not-allowed",
 			log.Fields{"Device": dh.device, "port": port})
-		return NewErrAdapter("illegal-port-request", log.Fields{
+		return olterrors.NewErrAdapter("illegal-port-request", log.Fields{
 			"port-type":    port.GetType,
 			"enable-state": enablePort}, nil).Log()
 	}
@@ -1701,7 +1702,7 @@
 		out, err := dh.Client.EnablePonIf(ctx, ponIntf)
 
 		if err != nil {
-			return NewErrAdapter("pon-port-enable-failed", log.Fields{
+			return olterrors.NewErrAdapter("pon-port-enable-failed", log.Fields{
 				"device-id": dh.device.Id,
 				"port":      port}, err).Log()
 		}
@@ -1712,7 +1713,7 @@
 		operStatus = voltha.OperStatus_UNKNOWN
 		out, err := dh.Client.DisablePonIf(ctx, ponIntf)
 		if err != nil {
-			return NewErrAdapter("pon-port-disable-failed", log.Fields{
+			return olterrors.NewErrAdapter("pon-port-disable-failed", log.Fields{
 				"device-id": dh.device.Id,
 				"port":      port}, err).Log()
 		}
@@ -1721,7 +1722,7 @@
 		log.Infow("disabled-pon-port", log.Fields{"out": out, "DeviceID": dh.device, "Port": port})
 	}
 	if err := dh.coreProxy.PortStateUpdate(ctx, dh.deviceID, voltha.Port_PON_OLT, port.PortNo, operStatus); err != nil {
-		return NewErrAdapter("port-state-update-failed", log.Fields{
+		return olterrors.NewErrAdapter("port-state-update-failed", log.Fields{
 			"device-id": dh.deviceID,
 			"port":      port.PortNo}, err).Log()
 	}
@@ -1736,7 +1737,7 @@
 	for _, port := range cloned.Ports {
 		if port.AdminState == common.AdminState_DISABLED {
 			if err := dh.DisablePort(port); err != nil {
-				return NewErrAdapter("port-disable-failed", log.Fields{
+				return olterrors.NewErrAdapter("port-disable-failed", log.Fields{
 					"device-id": dh.deviceID,
 					"port":      port}, err).Log()
 			}
@@ -1773,7 +1774,7 @@
 	onuKey := dh.formOnuKey(IntfID, onuID)
 	onuDevice, ok := dh.onus.Load(onuKey)
 	if !ok {
-		return NewErrAdapter("failed-to-load-onu-details",
+		return olterrors.NewErrAdapter("failed-to-load-onu-details",
 			log.Fields{
 				"device-id":    dh.deviceID,
 				"onu-id":       onuID,
@@ -1782,14 +1783,14 @@
 	var sn *oop.SerialNumber
 	var err error
 	if sn, err = dh.deStringifySerialNumber(onuDevice.(*OnuDevice).serialNumber); err != nil {
-		return NewErrAdapter("failed-to-destringify-serial-number",
+		return olterrors.NewErrAdapter("failed-to-destringify-serial-number",
 			log.Fields{
 				"devicer-id":    dh.deviceID,
 				"serial-number": onuDevice.(*OnuDevice).serialNumber}, err).Log()
 	}
 	onu := &oop.Onu{IntfId: IntfID, OnuId: onuID, SerialNumber: sn}
 	if _, err := dh.Client.DeleteOnu(context.Background(), onu); err != nil {
-		return NewErrAdapter("failed-to-delete-onu", log.Fields{
+		return olterrors.NewErrAdapter("failed-to-delete-onu", log.Fields{
 			"device-id": dh.deviceID,
 			"onu-id":    onuID}, err).Log()
 	}
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index 1d1192e..07ada8c 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -33,6 +33,7 @@
 	fu "github.com/opencord/voltha-lib-go/v3/pkg/flows"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	ponrmgr "github.com/opencord/voltha-lib-go/v3/pkg/ponresourcemanager"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	"github.com/opencord/voltha-openolt-adapter/internal/pkg/resourcemanager"
 	"github.com/opencord/voltha-openolt-adapter/pkg/mocks"
 	ic "github.com/opencord/voltha-protos/v3/go/inter_container"
@@ -333,7 +334,7 @@
 			args{parentPort: 1,
 				onuID: 1},
 			nil,
-			reflect.TypeOf(&ErrNotFound{}),
+			reflect.TypeOf(&olterrors.ErrNotFound{}),
 		},
 	}
 
@@ -356,7 +357,7 @@
 }
 
 func TestGetportLabel(t *testing.T) {
-	invalid := reflect.TypeOf(&ErrInvalidValue{})
+	invalid := reflect.TypeOf(&olterrors.ErrInvalidValue{})
 	type args struct {
 		portNum  uint32
 		portType voltha.Port_PortType
@@ -419,7 +420,7 @@
 	type args struct {
 		msg *ic.InterAdapterMessage
 	}
-	invalid := reflect.TypeOf(&ErrInvalidValue{})
+	invalid := reflect.TypeOf(&olterrors.ErrInvalidValue{})
 	tests := []struct {
 		name    string
 		args    args
@@ -445,7 +446,7 @@
 				Type: ic.InterAdapterMessageType_OMCI_REQUEST,
 			},
 			Body: marshalledData,
-		}}, reflect.TypeOf(&ErrCommunication{})},
+		}}, reflect.TypeOf(&olterrors.ErrCommunication{})},
 		{"ProcessInterAdapterMessage-4", args{msg: &ic.InterAdapterMessage{
 			Header: &ic.InterAdapterHeader{
 				Id:   "012345",
diff --git a/internal/pkg/core/olt_platform.go b/internal/pkg/core/olt_platform.go
index 747cccf..6b0610c 100644
--- a/internal/pkg/core/olt_platform.go
+++ b/internal/pkg/core/olt_platform.go
@@ -20,6 +20,7 @@
 import (
 	"github.com/opencord/voltha-lib-go/v3/pkg/flows"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 )
@@ -171,7 +172,7 @@
 func IntfIDFromNniPortNum(portNum uint32) (uint32, error) {
 	if portNum < minNniIntPortNum || portNum > maxNniPortNum {
 		log.Errorw("NNIPortNumber is not in valid range", log.Fields{"portNum": portNum})
-		return uint32(0), ErrInvalidPortRange
+		return uint32(0), olterrors.ErrInvalidPortRange
 	}
 	return (portNum & 0xFFFF), nil
 }
@@ -260,7 +261,7 @@
 	}
 
 	if uniPortNo == 0 {
-		return 0, 0, 0, 0, 0, 0, NewErrNotFound("pon-interface", log.Fields{
+		return 0, 0, 0, 0, 0, 0, olterrors.NewErrNotFound("pon-interface", log.Fields{
 			"flow-direction": flowDirection}, nil)
 	}
 
diff --git a/internal/pkg/core/olt_platform_test.go b/internal/pkg/core/olt_platform_test.go
index 4f3d5bf..9e2ee56 100644
--- a/internal/pkg/core/olt_platform_test.go
+++ b/internal/pkg/core/olt_platform_test.go
@@ -23,6 +23,7 @@
 	"testing"
 
 	fu "github.com/opencord/voltha-lib-go/v3/pkg/flows"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 )
@@ -171,18 +172,18 @@
 		wantErr error
 	}{
 		// TODO: Add test cases.
-		{"IntfIDFromNniPortNum-01", args{portNum: 8081}, 0, ErrInvalidPortRange},
-		{"IntfIDFromNniPortNum-02", args{portNum: 9090}, 0, ErrInvalidPortRange},
-		{"IntfIDFromNniPortNum-03", args{portNum: 0}, 0, ErrInvalidPortRange},
-		{"IntfIDFromNniPortNum-04", args{portNum: 65535}, 0, ErrInvalidPortRange},
-		{"IntfIDFromNniPortNum-05", args{portNum: 1048575}, 0, ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-01", args{portNum: 8081}, 0, olterrors.ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-02", args{portNum: 9090}, 0, olterrors.ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-03", args{portNum: 0}, 0, olterrors.ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-04", args{portNum: 65535}, 0, olterrors.ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-05", args{portNum: 1048575}, 0, olterrors.ErrInvalidPortRange},
 		{"IntfIDFromNniPortNum-06", args{portNum: 1048576}, 0, nil},
 		{"IntfIDFromNniPortNum-07", args{portNum: 1048577}, 1, nil},
 		{"IntfIDFromNniPortNum-08", args{portNum: 1048578}, 2, nil},
 		{"IntfIDFromNniPortNum-09", args{portNum: 1048579}, 3, nil},
 		{"IntfIDFromNniPortNum-10", args{portNum: 2097150}, 65534, nil},
 		{"IntfIDFromNniPortNum-11", args{portNum: 2097151}, 65535, nil},
-		{"IntfIDFromNniPortNum-12", args{portNum: 3000000}, 0, ErrInvalidPortRange},
+		{"IntfIDFromNniPortNum-12", args{portNum: 3000000}, 0, olterrors.ErrInvalidPortRange},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
diff --git a/internal/pkg/core/olt_state_transitions_test.go b/internal/pkg/core/olt_state_transitions_test.go
index 75e7807..9c2be8d 100644
--- a/internal/pkg/core/olt_state_transitions_test.go
+++ b/internal/pkg/core/olt_state_transitions_test.go
@@ -18,6 +18,7 @@
 
 import (
 	"context"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	"reflect"
 	"testing"
 	"time"
@@ -47,7 +48,7 @@
 		after: []TransitionHandler{func(ctx context.Context) error {
 			return nil
 		}, func(ctx context.Context) error {
-			return ErrStateTransition
+			return olterrors.ErrStateTransition
 		}},
 	}
 	transitions[GrpcConnected] = transition
@@ -65,7 +66,7 @@
 		before: []TransitionHandler{func(ctx context.Context) error {
 			return nil
 		}, func(ctx context.Context) error {
-			return ErrStateTransition
+			return olterrors.ErrStateTransition
 		}},
 	}
 	transitions[GrpcConnected] = transition
diff --git a/internal/pkg/core/openolt.go b/internal/pkg/core/openolt.go
index 9a5167f..8ad7c75 100644
--- a/internal/pkg/core/openolt.go
+++ b/internal/pkg/core/openolt.go
@@ -26,6 +26,7 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/opencord/voltha-openolt-adapter/internal/pkg/config"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	ic "github.com/opencord/voltha-protos/v3/go/inter_container"
 	"github.com/opencord/voltha-protos/v3/go/openflow_13"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
@@ -140,7 +141,7 @@
 func (oo *OpenOLT) Adopt_device(device *voltha.Device) error {
 	ctx := context.Background()
 	if device == nil {
-		return NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
 	}
 	log.Infow("adopt-device", log.Fields{"deviceId": device.Id})
 	var handler *DeviceHandler
@@ -160,7 +161,7 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.GetOfpDeviceInfo(device)
 	}
-	return nil, NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Get_ofp_port_info returns OFP port information for the given device
@@ -169,7 +170,7 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.GetOfpPortInfo(device, portNo)
 	}
-	return nil, NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return nil, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Process_inter_adapter_message sends messages to a target device (between adapters)
@@ -183,29 +184,29 @@
 	if handler := oo.getDeviceHandler(targetDevice); handler != nil {
 		return handler.ProcessInterAdapterMessage(msg)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": targetDevice}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": targetDevice}, nil).Log()
 }
 
 //Adapter_descriptor not implemented
 func (oo *OpenOLT) Adapter_descriptor() error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Device_types unimplemented
 func (oo *OpenOLT) Device_types() (*voltha.DeviceTypes, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Health  returns unimplemented
 func (oo *OpenOLT) Health() (*voltha.HealthStatus, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Reconcile_device unimplemented
 func (oo *OpenOLT) Reconcile_device(device *voltha.Device) error {
 	ctx := context.Background()
 	if device == nil {
-		return NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
 	}
 	log.Infow("reconcile-device", log.Fields{"deviceId": device.Id})
 	var handler *DeviceHandler
@@ -220,7 +221,7 @@
 
 //Abandon_device unimplemented
 func (oo *OpenOLT) Abandon_device(device *voltha.Device) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Disable_device disables the given device
@@ -229,7 +230,7 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.DisableDevice(device)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Reenable_device enables the olt device after disable
@@ -238,7 +239,7 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.ReenableDevice(device)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Reboot_device reboots the given device
@@ -247,12 +248,12 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.RebootDevice(device)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Self_test_device unimplented
 func (oo *OpenOLT) Self_test_device(device *voltha.Device) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Delete_device unimplemented
@@ -266,17 +267,17 @@
 		oo.deleteDeviceHandlerToMap(handler)
 		return nil
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Get_device_details unimplemented
 func (oo *OpenOLT) Get_device_details(device *voltha.Device) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Update_flows_bulk returns
 func (oo *OpenOLT) Update_flows_bulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Update_flows_incrementally updates (add/remove) the flows on a given device
@@ -286,12 +287,12 @@
 	if handler := oo.getDeviceHandler(device.Id); handler != nil {
 		return handler.UpdateFlowsIncrementally(ctx, device, flows, groups, flowMetadata)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": device.Id}, nil).Log()
 }
 
 //Update_pm_config returns PmConfigs nil or error
 func (oo *OpenOLT) Update_pm_config(device *voltha.Device, pmConfigs *voltha.PmConfigs) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Receive_packet_out sends packet out to the device
@@ -301,42 +302,42 @@
 	if handler := oo.getDeviceHandler(deviceID); handler != nil {
 		return handler.PacketOut(ctx, egressPortNo, packet)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": deviceID}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": deviceID}, nil).Log()
 }
 
 //Suppress_event unimplemented
 func (oo *OpenOLT) Suppress_event(filter *voltha.EventFilter) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Unsuppress_event  unimplemented
 func (oo *OpenOLT) Unsuppress_event(filter *voltha.EventFilter) error {
-	return ErrNotImplemented
+	return olterrors.ErrNotImplemented
 }
 
 //Download_image unimplemented
 func (oo *OpenOLT) Download_image(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Get_image_download_status unimplemented
 func (oo *OpenOLT) Get_image_download_status(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Cancel_image_download unimplemented
 func (oo *OpenOLT) Cancel_image_download(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Activate_image_update unimplemented
 func (oo *OpenOLT) Activate_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 //Revert_image_update unimplemented
 func (oo *OpenOLT) Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
-	return nil, ErrNotImplemented
+	return nil, olterrors.ErrNotImplemented
 }
 
 // Enable_port to Enable PON/NNI interface
@@ -355,7 +356,7 @@
 func (oo *OpenOLT) enableDisablePort(deviceID string, port *voltha.Port, enablePort bool) error {
 	log.Infow("enableDisablePort", log.Fields{"deviceId": deviceID, "port": port})
 	if port == nil {
-		return NewErrInvalidValue(log.Fields{
+		return olterrors.NewErrInvalidValue(log.Fields{
 			"reason":    "port cannot be nil",
 			"device-id": deviceID,
 			"port":      nil}, nil).Log()
@@ -384,5 +385,5 @@
 	if handler := oo.getDeviceHandler(deviceID); handler != nil {
 		return handler.ChildDeviceLost(ctx, pPortNo, onuID)
 	}
-	return NewErrNotFound("device-handler", log.Fields{"device-id": deviceID}, nil).Log()
+	return olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": deviceID}, nil).Log()
 }
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index 45d963e..ee74f4a 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -24,6 +24,7 @@
 
 	"github.com/opencord/voltha-lib-go/v3/pkg/adapters/adapterif"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	"github.com/opencord/voltha-protos/v3/go/common"
 	oop "github.com/opencord/voltha-protos/v3/go/openolt"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
@@ -142,10 +143,10 @@
 		log.Infow("Received onu deactivation failure indication ", log.Fields{"alarm_ind": alarmInd})
 		err = em.onuDeactivationFailureIndication(alarmInd.GetOnuDeactivationFailureInd(), deviceID, raisedTs)
 	default:
-		err = NewErrInvalidValue(log.Fields{"indication-type": alarmInd}, nil)
+		err = olterrors.NewErrInvalidValue(log.Fields{"indication-type": alarmInd}, nil)
 	}
 	if err != nil {
-		return NewErrCommunication("publish-message", log.Fields{"indication-type": alarmInd}, err).Log()
+		return olterrors.NewErrCommunication("publish-message", log.Fields{"indication-type": alarmInd}, err).Log()
 	}
 	return nil
 }
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 3ed340f..c6bad46 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -41,6 +41,7 @@
 
 	//deepcopy "github.com/getlantern/deepcopy"
 	"github.com/EagleChen/mapmutex"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 )
@@ -271,7 +272,7 @@
 		log.Debug("multicast flow, shifting id")
 		return 0x2<<15 | uint64(flowID), nil
 	} else {
-		return 0, NewErrInvalidValue(log.Fields{"direction": direction}, nil).Log()
+		return 0, olterrors.NewErrInvalidValue(log.Fields{"direction": direction}, nil).Log()
 	}
 }
 
@@ -364,7 +365,7 @@
 			log.Debug("Scheduler already created for upstream")
 			return nil
 		}
-		return NewErrInvalidValue(log.Fields{
+		return olterrors.NewErrInvalidValue(log.Fields{
 			"unsupported":       "meter-id",
 			"kv-store-meter-id": KvStoreMeter.MeterId,
 			"meter-id-in-flow":  sq.meterID}, nil).Log()
@@ -396,13 +397,13 @@
 		log.Error("Flow-metadata-is-not-present-in-flow")
 	}
 	if meterConfig == nil {
-		return NewErrNotFound("meterbands", log.Fields{
+		return olterrors.NewErrNotFound("meterbands", log.Fields{
 			"reason":        "Could-not-get-meterbands-from-flowMetadata",
 			"flow-metadata": sq.flowMetadata,
 			"meter-id":      sq.meterID}, nil).Log()
 	} else if len(meterConfig.Bands) < MaxMeterBand {
 		log.Errorw("Invalid-number-of-bands-in-meter", log.Fields{"Bands": meterConfig.Bands, "MeterID": sq.meterID})
-		return NewErrInvalidValue(log.Fields{
+		return olterrors.NewErrInvalidValue(log.Fields{
 			"reason":          "Invalid-number-of-bands-in-meter",
 			"meterband-count": len(meterConfig.Bands),
 			"metabands":       meterConfig.Bands,
@@ -661,7 +662,7 @@
 	}
 	//Make sure we have as many tech_profiles as there are pon ports on the device
 	if tpCount != int(f.resourceMgr.DevInfo.GetPonPorts()) {
-		return NewErrInvalidValue(log.Fields{
+		return olterrors.NewErrInvalidValue(log.Fields{
 			"reason":             "TP count does not match number of PON ports",
 			"tech-profile-count": tpCount,
 			"pon-port-count":     f.resourceMgr.DevInfo.GetPonPorts()}, nil).Log()
@@ -708,7 +709,7 @@
 	if ok {
 		downlinkAction[VlanVid] = dlClVid & 0xfff
 	} else {
-		return NewErrInvalidValue(log.Fields{
+		return olterrors.NewErrInvalidValue(log.Fields{
 			"reason":  "failed to convert VLANID classifier",
 			"vlan-id": VlanVid}, nil).Log()
 	}
@@ -744,21 +745,21 @@
 	}
 	flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, HsiaFlow, vlanPbit)
 	if err != nil {
-		return NewErrNotFound("hsia-flow-id", log.Fields{"direction": direction}, err).Log()
+		return olterrors.NewErrNotFound("hsia-flow-id", log.Fields{"direction": direction}, err).Log()
 	}
 	classifierProto, err := makeOpenOltClassifierField(classifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(action)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
 	}
 	log.Debugw("Created action proto", log.Fields{"action": *actionProto})
 	networkIntfID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-interface-id",
+		return olterrors.NewErrNotFound("nni-interface-id",
 			log.Fields{
 				"classifier": classifier,
 				"action":     action,
@@ -778,7 +779,7 @@
 		Cookie:        logicalFlow.Cookie,
 		PortNo:        portNo}
 	if err := f.addFlowToDevice(ctx, logicalFlow, &flow); err != nil {
-		return NewErrFlowOp("add", flowID, nil, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, nil, err).Log()
 	}
 	log.Debug("HSIA flow added to device successfully", log.Fields{"direction": direction})
 	flowsToKVStore := f.getUpdatedFlowInfo(ctx, &flow, flowStoreCookie, HsiaFlow, flowID, logicalFlow.Id)
@@ -786,7 +787,7 @@
 		flow.OnuId,
 		flow.UniId,
 		flow.FlowId /*flowCategory,*/, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flowID, log.Fields{"flow": flow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": flow}, err).Log()
 	}
 	return nil
 }
@@ -795,7 +796,7 @@
 
 	networkIntfID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-interface-id", log.Fields{
+		return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
 			"classifier": classifier,
 			"action":     action},
 			err).Log()
@@ -821,7 +822,7 @@
 	flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, DhcpFlow, 0 /*classifier[VLAN_PCP].(uint32)*/)
 
 	if err != nil {
-		return NewErrNotFound("flow", log.Fields{
+		return olterrors.NewErrNotFound("flow", log.Fields{
 			"interface-id": intfID,
 			"gem-port":     gemPortID,
 			"cookie":       flowStoreCookie},
@@ -832,12 +833,12 @@
 
 	classifierProto, err := makeOpenOltClassifierField(classifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(action)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
 	}
 
 	dhcpFlow := openoltpb2.Flow{AccessIntfId: int32(intfID),
@@ -855,7 +856,7 @@
 		PortNo:        portNo}
 
 	if err := f.addFlowToDevice(ctx, logicalFlow, &dhcpFlow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"dhcp-flow": dhcpFlow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"dhcp-flow": dhcpFlow}, err).Log()
 	}
 	log.Debug("DHCP UL flow added to device successfully")
 	flowsToKVStore := f.getUpdatedFlowInfo(ctx, &dhcpFlow, flowStoreCookie, "DHCP", flowID, logicalFlow.Id)
@@ -863,7 +864,7 @@
 		dhcpFlow.OnuId,
 		dhcpFlow.UniId,
 		dhcpFlow.FlowId, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", dhcpFlow.FlowId, log.Fields{"flow": dhcpFlow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", dhcpFlow.FlowId, log.Fields{"flow": dhcpFlow}, err).Log()
 	}
 
 	return nil
@@ -881,7 +882,7 @@
 
 	networkIntfID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-interface-id", log.Fields{
+		return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
 			"classifier": classifier,
 			"action":     action},
 			err).Log()
@@ -905,7 +906,7 @@
 	flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, flowType, 0, 0 /*classifier[VLAN_PCP].(uint32)*/)
 
 	if err != nil {
-		return NewErrNotFound("flow-id", log.Fields{
+		return olterrors.NewErrNotFound("flow-id", log.Fields{
 			"interface-id": intfID,
 			"oni-id":       onuID,
 			"cookie":       flowStoreCookie,
@@ -917,12 +918,12 @@
 
 	classifierProto, err := makeOpenOltClassifierField(classifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(action)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
 	}
 
 	flow := openoltpb2.Flow{AccessIntfId: int32(intfID),
@@ -940,7 +941,7 @@
 		PortNo:        portNo}
 
 	if err := f.addFlowToDevice(ctx, logicalFlow, &flow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"flow": flow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": flow}, err).Log()
 	}
 	log.Debugf("%s UL flow added to device successfully", flowType)
 
@@ -949,7 +950,7 @@
 		flow.OnuId,
 		flow.UniId,
 		flow.FlowId, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flow.FlowId, log.Fields{"flow": flow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flow.FlowId, log.Fields{"flow": flow}, err).Log()
 	}
 
 	return nil
@@ -976,7 +977,7 @@
 	//Add Uplink EAPOL Flow
 	uplinkFlowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, "", 0)
 	if err != nil {
-		return NewErrNotFound("flow-id", log.Fields{
+		return olterrors.NewErrNotFound("flow-id", log.Fields{
 			"interface-id": intfID,
 			"onu-id":       onuID,
 			"coookie":      flowStoreCookie},
@@ -986,17 +987,17 @@
 
 	classifierProto, err := makeOpenOltClassifierField(uplinkClassifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": uplinkClassifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": uplinkClassifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(uplinkAction)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": uplinkAction}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": uplinkAction}, err).Log()
 	}
 	log.Debugw("Created action proto", log.Fields{"action": *actionProto})
 	networkIntfID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-interface-id", log.Fields{
+		return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
 			"classifier": classifier,
 			"action":     action},
 			err).Log()
@@ -1016,7 +1017,7 @@
 		Cookie:        logicalFlow.Cookie,
 		PortNo:        portNo}
 	if err := f.addFlowToDevice(ctx, logicalFlow, &upstreamFlow); err != nil {
-		return NewErrFlowOp("add", uplinkFlowID, log.Fields{"flow": upstreamFlow}, err).Log()
+		return olterrors.NewErrFlowOp("add", uplinkFlowID, log.Fields{"flow": upstreamFlow}, err).Log()
 	}
 	log.Debug("EAPOL UL flow added to device successfully")
 	flowCategory := "EAPOL"
@@ -1027,7 +1028,7 @@
 		upstreamFlow.FlowId,
 		/* lowCategory, */
 		flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", upstreamFlow.FlowId, log.Fields{"flow": upstreamFlow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", upstreamFlow.FlowId, log.Fields{"flow": upstreamFlow}, err).Log()
 	}
 
 	log.Debugw("Added EAPOL flows to device successfully", log.Fields{"flow": logicalFlow})
@@ -1070,7 +1071,7 @@
 		case DoubleTag:
 		case Untagged:
 		default:
-			return nil, NewErrInvalidValue(log.Fields{"packet-tag-type": pktTagType}, nil).Log()
+			return nil, olterrors.NewErrInvalidValue(log.Fields{"packet-tag-type": pktTagType}, nil).Log()
 		}
 	}
 	return &classifier, nil
@@ -1089,7 +1090,7 @@
 	} else if _, ok := actionInfo[TrapToHost]; ok {
 		action.Cmd.TrapToHost = actionInfo[TrapToHost].(bool)
 	} else {
-		return nil, NewErrInvalidValue(log.Fields{"action-command": actionInfo}, nil).Log()
+		return nil, olterrors.NewErrInvalidValue(log.Fields{"action-command": actionInfo}, nil).Log()
 	}
 	return &action, nil
 }
@@ -1307,7 +1308,7 @@
 
 	networkInterfaceID, err := IntfIDFromNniPortNum(portNo)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"nni-port-number": portNo}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"nni-port-number": portNo}, err).Log()
 	}
 	var flowStoreCookie = getFlowStoreCookie(classifierInfo, uint32(0))
 	if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), flowStoreCookie); present {
@@ -1317,7 +1318,7 @@
 	flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0)
 
 	if err != nil {
-		return NewErrNotFound("flow-id", log.Fields{
+		return olterrors.NewErrNotFound("flow-id", log.Fields{
 			"interface-id": networkInterfaceID,
 			"onu-id":       onuID,
 			"uni-id":       uniID,
@@ -1327,12 +1328,12 @@
 	}
 	classifierProto, err := makeOpenOltClassifierField(classifierInfo)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifierInfo}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifierInfo}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(actionInfo)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": actionInfo}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": actionInfo}, err).Log()
 	}
 	log.Debugw("Created action proto", log.Fields{"action": *actionProto})
 
@@ -1349,7 +1350,7 @@
 		Cookie:        flow.Cookie,
 		PortNo:        portNo}
 	if err := f.addFlowToDevice(ctx, flow, &downstreamflow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	log.Debug("LLDP trap on NNI flow added to device successfully")
 	flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, flow.Id)
@@ -1357,7 +1358,7 @@
 		int32(onuID),
 		int32(uniID),
 		flowID, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	return nil
 }
@@ -1372,7 +1373,7 @@
 	parentPortNo := IntfIDToPortNo(intfID, voltha.Port_PON_OLT)
 	onuDevice, err := f.deviceHandler.GetChildDevice(parentPortNo, onuID)
 	if err != nil {
-		return nil, NewErrNotFound("onu", log.Fields{
+		return nil, olterrors.NewErrNotFound("onu", log.Fields{
 			"interface-id": parentPortNo,
 			"onu-id":       onuID},
 			err).Log()
@@ -1910,7 +1911,7 @@
 
 	inPort, err := f.getInPortOfMulticastFlow(ctx, classifierInfo)
 	if err != nil {
-		return NewErrNotFound("multicast-in-port", log.Fields{"classifier": classifierInfo}, err).Log()
+		return olterrors.NewErrNotFound("multicast-in-port", log.Fields{"classifier": classifierInfo}, err).Log()
 	}
 	//replace ipDst with ethDst
 	if ipv4Dst, ok := classifierInfo[Ipv4Dst]; ok &&
@@ -1929,7 +1930,7 @@
 
 	networkInterfaceID, err := IntfIDFromNniPortNum(inPort)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"nni-in-port-number": inPort}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"nni-in-port-number": inPort}, err).Log()
 	}
 
 	flowStoreCookie := getFlowStoreCookie(classifierInfo, uint32(0))
@@ -1939,7 +1940,7 @@
 	}
 	flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0, 0)
 	if err != nil {
-		return NewErrNotFound("multicast-flow-id", log.Fields{
+		return olterrors.NewErrNotFound("multicast-flow-id", log.Fields{
 			"interface-id": networkInterfaceID,
 			"onu-id":       onuID,
 			"uni-id":       uniID,
@@ -1949,7 +1950,7 @@
 	}
 	classifierProto, err := makeOpenOltClassifierField(classifierInfo)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifierInfo}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifierInfo}, err).Log()
 	}
 	groupID := actionInfo[GroupID].(uint32)
 	multicastFlow := openoltpb2.Flow{
@@ -1962,7 +1963,7 @@
 		Cookie:        flow.Cookie}
 
 	if err = f.addFlowToDevice(ctx, flow, &multicastFlow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"flow": multicastFlow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": multicastFlow}, err).Log()
 	}
 	log.Debug("multicast flow added to device successfully")
 	//get cached group
@@ -1980,7 +1981,7 @@
 		int32(onuID),
 		int32(uniID),
 		flowID, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flowID, log.Fields{"flow": multicastFlow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": multicastFlow}, err).Log()
 	}
 	return nil
 }
@@ -1995,7 +1996,7 @@
 	if e == nil && len(nniPorts) > 0 {
 		return nniPorts[0], nil
 	}
-	return 0, NewErrNotFound("nni-port", nil, e).Log()
+	return 0, olterrors.NewErrNotFound("nni-port", nil, e).Log()
 }
 
 // AddGroup add or update the group
@@ -2285,7 +2286,7 @@
 			}
 		}
 	}
-	return uint32(0), NewErrNotFound("onu-id", log.Fields{
+	return uint32(0), olterrors.NewErrNotFound("onu-id", log.Fields{
 		"serial-number": serialNumber,
 		"interface-id":  intfID,
 		"gem-port-id":   gemPortID},
@@ -2416,7 +2417,7 @@
 	allocID := -1
 	networkInterfaceID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-intreface-id", log.Fields{
+		return olterrors.NewErrNotFound("nni-intreface-id", log.Fields{
 			"classifier": classifier,
 			"action":     action},
 			err).Log()
@@ -2429,7 +2430,7 @@
 	}
 	flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0)
 	if err != nil {
-		return NewErrNotFound("dhcp-trap-nni-flow-id", log.Fields{
+		return olterrors.NewErrNotFound("dhcp-trap-nni-flow-id", log.Fields{
 			"interface-id": networkInterfaceID,
 			"onu-id":       onuID,
 			"uni-id":       uniID,
@@ -2439,12 +2440,12 @@
 	}
 	classifierProto, err := makeOpenOltClassifierField(classifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(action)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
 	}
 	log.Debugw("Created action proto", log.Fields{"action": *actionProto})
 	downstreamflow := openoltpb2.Flow{AccessIntfId: int32(-1), // AccessIntfId not required
@@ -2461,7 +2462,7 @@
 		Cookie:        logicalFlow.Cookie,
 		PortNo:        portNo}
 	if err := f.addFlowToDevice(ctx, logicalFlow, &downstreamflow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	log.Debug("DHCP trap on NNI flow added to device successfully")
 	flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, logicalFlow.Id)
@@ -2469,7 +2470,7 @@
 		int32(onuID),
 		int32(uniID),
 		flowID, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	return nil
 }
@@ -2523,7 +2524,7 @@
 	allocID := -1
 	networkInterfaceID, err := getNniIntfID(classifier, action)
 	if err != nil {
-		return NewErrNotFound("nni-interface-id", log.Fields{
+		return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
 			"classifier": classifier,
 			"action":     action},
 			err).Log()
@@ -2535,7 +2536,7 @@
 	}
 	flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0, 0)
 	if err != nil {
-		return NewErrNotFound("igmp-flow-id", log.Fields{
+		return olterrors.NewErrNotFound("igmp-flow-id", log.Fields{
 			"interface-id": networkInterfaceID,
 			"onu-id":       onuID,
 			"uni-id":       uniID,
@@ -2545,12 +2546,12 @@
 	}
 	classifierProto, err := makeOpenOltClassifierField(classifier)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
 	}
 	log.Debugw("Created classifier proto for the IGMP flow", log.Fields{"classifier": *classifierProto})
 	actionProto, err := makeOpenOltActionField(action)
 	if err != nil {
-		return NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+		return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
 	}
 	log.Debugw("Created action proto for the IGMP flow", log.Fields{"action": *actionProto})
 	downstreamflow := openoltpb2.Flow{AccessIntfId: int32(-1), // AccessIntfId not required
@@ -2567,7 +2568,7 @@
 		Cookie:        logicalFlow.Cookie,
 		PortNo:        portNo}
 	if err := f.addFlowToDevice(ctx, logicalFlow, &downstreamflow); err != nil {
-		return NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	log.Debug("IGMP Trap on NNI flow added to device successfully")
 	flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, logicalFlow.Id)
@@ -2575,14 +2576,14 @@
 		int32(onuID),
 		int32(uniID),
 		flowID, flowsToKVStore); err != nil {
-		return NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
+		return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err).Log()
 	}
 	return nil
 }
 
 func verifyMeterIDAndGetDirection(MeterID uint32, Dir tp_pb.Direction) (string, error) {
 	if MeterID == 0 { // This should never happen
-		return "", NewErrInvalidValue(log.Fields{"meter-id": MeterID}, nil).Log()
+		return "", olterrors.NewErrInvalidValue(log.Fields{"meter-id": MeterID}, nil).Log()
 	}
 	if Dir == tp_pb.Direction_UPSTREAM {
 		return "upstream", nil
@@ -2777,7 +2778,7 @@
 				actionInfo[Output] = out.GetPort()
 				log.Debugw("action-type-output", log.Fields{"out_port": actionInfo[Output].(uint32)})
 			} else {
-				return NewErrInvalidValue(log.Fields{"output-port": nil}, nil).Log()
+				return olterrors.NewErrInvalidValue(log.Fields{"output-port": nil}, nil).Log()
 			}
 		} else if action.Type == flows.POP_VLAN {
 			actionInfo[PopVlan] = true
@@ -2797,7 +2798,7 @@
 			if out := action.GetSetField(); out != nil {
 				if field := out.GetField(); field != nil {
 					if ofClass := field.GetOxmClass(); ofClass != ofp.OfpOxmClass_OFPXMC_OPENFLOW_BASIC {
-						return NewErrInvalidValue(log.Fields{"openflow-class": ofClass}, nil).Log()
+						return olterrors.NewErrInvalidValue(log.Fields{"openflow-class": ofClass}, nil).Log()
 					}
 					/*log.Debugw("action-type-set-field",log.Fields{"field": field, "in_port": classifierInfo[IN_PORT].(uint32)})*/
 					formulateSetFieldActionInfoFromFlow(field, actionInfo)
@@ -2806,7 +2807,7 @@
 		} else if action.Type == flows.GROUP {
 			formulateGroupActionInfoFromFlow(action, actionInfo)
 		} else {
-			return NewErrInvalidValue(log.Fields{"action-type": action.Type}, nil).Log()
+			return olterrors.NewErrInvalidValue(log.Fields{"action-type": action.Type}, nil).Log()
 		}
 	}
 	return nil
@@ -2845,7 +2846,7 @@
 				classifierInfo[InPort] = uniPort
 				log.Debugw("upstream pon-to-controller-flow,inport-in-tunnelid", log.Fields{"newInPort": classifierInfo[InPort].(uint32), "outPort": actionInfo[Output].(uint32)})
 			} else {
-				return NewErrNotFound("child-in-port", log.Fields{
+				return olterrors.NewErrNotFound("child-in-port", log.Fields{
 					"reason": "upstream pon-to-controller-flow, NO-inport-in-tunnelid",
 					"flow":   flow}, nil).Log()
 			}
@@ -2858,7 +2859,7 @@
 				actionInfo[Output] = uniPort
 				log.Debugw("downstream-nni-to-pon-port-flow, outport-in-tunnelid", log.Fields{"newOutPort": actionInfo[Output].(uint32), "outPort": actionInfo[Output].(uint32)})
 			} else {
-				return NewErrNotFound("out-port", log.Fields{
+				return olterrors.NewErrNotFound("out-port", log.Fields{
 					"reason": "downstream-nni-to-pon-port-flow, no-outport-in-tunnelid",
 					"flow":   flow}, nil).Log()
 			}
@@ -2869,7 +2870,7 @@
 				log.Debugw("upstream-pon-to-nni-port-flow, inport-in-tunnelid", log.Fields{"newInPort": actionInfo[Output].(uint32),
 					"outport": actionInfo[Output].(uint32)})
 			} else {
-				return NewErrNotFound("nni-port", log.Fields{
+				return olterrors.NewErrNotFound("nni-port", log.Fields{
 					"reason":   "upstream-pon-to-nni-port-flow, no-inport-in-tunnelid",
 					"in-port":  classifierInfo[InPort].(uint32),
 					"out-port": actionInfo[Output].(uint32),
@@ -2890,7 +2891,7 @@
 	*/
 	metadata := flows.GetMetadataFromWriteMetadataAction(flow)
 	if metadata == 0 {
-		return 0, NewErrNotFound("metadata", log.Fields{"flow": flow}, nil).Log()
+		return 0, olterrors.NewErrNotFound("metadata", log.Fields{"flow": flow}, nil).Log()
 	}
 	TpID := flows.GetTechProfileIDFromWriteMetaData(metadata)
 	return uint32(TpID), nil
@@ -3014,7 +3015,7 @@
 func (f *OpenOltFlowMgr) GetFlowGroupFromKVStore(ctx context.Context, groupID uint32, cached bool) (*ofp.OfpGroupEntry, bool, error) {
 	exists, groupInfo, err := f.resourceMgr.GetFlowGroupFromKVStore(ctx, groupID, cached)
 	if err != nil {
-		return nil, false, NewErrNotFound("flow-group", log.Fields{"group-id": groupID}, err).Log()
+		return nil, false, olterrors.NewErrNotFound("flow-group", log.Fields{"group-id": groupID}, err).Log()
 	}
 	if exists {
 		return newGroup(groupInfo.GroupID, groupInfo.OutPorts), exists, nil
diff --git a/internal/pkg/core/openolt_test.go b/internal/pkg/core/openolt_test.go
index 5944db2..20cb38d 100644
--- a/internal/pkg/core/openolt_test.go
+++ b/internal/pkg/core/openolt_test.go
@@ -30,6 +30,7 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 	"github.com/opencord/voltha-openolt-adapter/internal/pkg/config"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	ic "github.com/opencord/voltha-protos/v3/go/inter_container"
 	"github.com/opencord/voltha-protos/v3/go/openflow_13"
 	ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
@@ -135,9 +136,9 @@
 		args    args
 		wantErr error
 	}{
-		{"abandon_device-1", &fields{}, args{}, ErrNotImplemented},
-		{"abandon_device-2", &fields{}, args{}, ErrNotImplemented},
-		{"abandon_device-3", &fields{}, args{}, ErrNotImplemented},
+		{"abandon_device-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"abandon_device-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"abandon_device-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -162,11 +163,11 @@
 		wantErr error
 	}{
 		{"activate_image_upate-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"activate_image_upate-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123CDE"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"activate_image_upate-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123EFG"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -185,9 +186,9 @@
 		fields  *fields
 		wantErr error
 	}{
-		{"adapter_descriptor-1", &fields{}, ErrNotImplemented},
-		{"adapter_descriptor-2", &fields{}, ErrNotImplemented},
-		{"adapter_descriptor-3", &fields{}, ErrNotImplemented},
+		{"adapter_descriptor-1", &fields{}, olterrors.ErrNotImplemented},
+		{"adapter_descriptor-2", &fields{}, olterrors.ErrNotImplemented},
+		{"adapter_descriptor-3", &fields{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -205,7 +206,7 @@
 	}
 	var device = mockDevice()
 	device.Id = "olt"
-	nilDevice := NewErrInvalidValue(log.Fields{"device": nil}, nil)
+	nilDevice := olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
 	tests := []struct {
 		name    string
 		fields  *fields
@@ -244,11 +245,11 @@
 		wantErr error
 	}{
 		{"cancel_image_download-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"cancel_image_download-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123IJK"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"cancel_image_download-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123KLM"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -272,7 +273,7 @@
 		wantErr error
 	}{
 		{"delete_device-1", &fields{}, args{mockDevice()},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -292,11 +293,11 @@
 		wantErr error
 	}{
 		{"device_types-1", &fields{}, &voltha.DeviceTypes{},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"device_types-2", &fields{}, &voltha.DeviceTypes{},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"device_types-3", &fields{}, &voltha.DeviceTypes{},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -321,7 +322,7 @@
 	}{
 		{"disable_device-1", mockOlt(), args{mockDevice()}, nil},
 		{"disable_device-2", &fields{}, args{mockDevice()},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -346,11 +347,11 @@
 		wantErr error
 	}{
 		{"download_image-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"download_image-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123LKJ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"download_image-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123RTY"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -373,9 +374,9 @@
 		args    args
 		wantErr error
 	}{
-		{"get_device_details-1", &fields{}, args{}, ErrNotImplemented},
-		{"get_device_details-2", &fields{}, args{}, ErrNotImplemented},
-		{"get_device_details-3", &fields{}, args{}, ErrNotImplemented},
+		{"get_device_details-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"get_device_details-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"get_device_details-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -400,11 +401,11 @@
 		wantErr error
 	}{
 		{"get_image_download_status-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"get_image_download_status-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123LKJ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"get_image_download_status-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123DFG"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -442,7 +443,7 @@
 			},
 		}, nil},
 		{"get_ofp_device_info-2", &fields{}, args{mockDevice()}, nil,
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -484,7 +485,7 @@
 			},
 		}, nil},
 		{"get_ofp_port_info-2", &fields{}, args{mockDevice(), 1}, nil,
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -505,9 +506,9 @@
 		want    *voltha.HealthStatus
 		wantErr error
 	}{
-		{"health-1", &fields{}, &voltha.HealthStatus{}, ErrNotImplemented},
-		{"health-2", &fields{}, &voltha.HealthStatus{}, ErrNotImplemented},
-		{"health-3", &fields{}, &voltha.HealthStatus{}, ErrNotImplemented},
+		{"health-1", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
+		{"health-2", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
+		{"health-3", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -560,11 +561,11 @@
 		wantErrType reflect.Type
 	}{
 		{"process_inter_adaptor_messgae-1", mockOlt(), message1,
-			reflect.TypeOf(&ErrNotFound{})},
+			reflect.TypeOf(&olterrors.ErrNotFound{})},
 		{"process_inter_adaptor_messgae-2", mockOlt(), message2,
 			reflect.TypeOf(errors.New("message is nil"))},
 		{"process_inter_adaptor_messgae-3", mockOlt(), message3,
-			reflect.TypeOf(&ErrInvalidValue{})},
+			reflect.TypeOf(&olterrors.ErrInvalidValue{})},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -589,7 +590,7 @@
 	}{
 		{"reboot_device-1", mockOlt(), args{mockDevice()}, nil},
 		{"reboot_device-2", &fields{}, args{mockDevice()},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -623,7 +624,7 @@
 	}{
 		{"receive_packet_out-1", mockOlt(), args{mockDevice().Id, 1, pktout}, nil},
 		{"receive_packet_out-2", mockOlt(), args{"1234", 1, pktout},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "1234"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "1234"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -639,7 +640,7 @@
 	type args struct {
 		device *voltha.Device
 	}
-	expectedError := NewErrInvalidValue(log.Fields{"device": nil}, nil)
+	expectedError := olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
 	tests := []struct {
 		name    string
 		fields  *fields
@@ -672,7 +673,7 @@
 	}{
 		{"reenable_device-1", mockOlt(), args{mockDevice()}, nil},
 		{"reenable_device-2", &fields{}, args{mockDevice()},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -697,11 +698,11 @@
 		wantErr error
 	}{
 		{"revert_image_update-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"revert_image_update-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123TYU"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 		{"revert_image_update-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123GTH"},
-			ErrNotImplemented},
+			olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -724,9 +725,9 @@
 		args    args
 		wantErr error
 	}{
-		{"self_test_device-1", &fields{}, args{}, ErrNotImplemented},
-		{"self_test_device-2", &fields{}, args{}, ErrNotImplemented},
-		{"self_test_device-3", &fields{}, args{}, ErrNotImplemented},
+		{"self_test_device-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"self_test_device-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"self_test_device-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -793,9 +794,9 @@
 		args    args
 		wantErr error
 	}{
-		{"suppress_event-1", &fields{}, args{}, ErrNotImplemented},
-		{"suppress_event-2", &fields{}, args{}, ErrNotImplemented},
-		{"suppress_event-3", &fields{}, args{}, ErrNotImplemented},
+		{"suppress_event-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"suppress_event-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"suppress_event-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -817,9 +818,9 @@
 		args    args
 		wantErr error
 	}{
-		{"unsupress_event-1", &fields{}, args{}, ErrNotImplemented},
-		{"unsupress_event-2", &fields{}, args{}, ErrNotImplemented},
-		{"unsupress_event-3", &fields{}, args{}, ErrNotImplemented},
+		{"unsupress_event-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"unsupress_event-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"unsupress_event-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -844,9 +845,9 @@
 		args    args
 		wantErr error
 	}{
-		{"update_flows_bulk-1", &fields{}, args{}, ErrNotImplemented},
-		{"update_flows_bulk-2", &fields{}, args{}, ErrNotImplemented},
-		{"update_flows_bulk-3", &fields{}, args{}, ErrNotImplemented},
+		{"update_flows_bulk-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"update_flows_bulk-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"update_flows_bulk-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -873,7 +874,7 @@
 		wantErr error
 	}{
 		{"update_flows_incrementally-1", &fields{}, args{device: mockDevice()},
-			NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
+			olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
 		{"update_flows_incrementally-2", mockOlt(), args{device: mockDevice()}, nil},
 	}
 	for _, tt := range tests {
@@ -897,9 +898,9 @@
 		args    args
 		wantErr error
 	}{
-		{"update_pm_config-1", &fields{}, args{}, ErrNotImplemented},
-		{"update_pm_config-2", &fields{}, args{}, ErrNotImplemented},
-		{"update_pm_config-3", &fields{}, args{}, ErrNotImplemented},
+		{"update_pm_config-1", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"update_pm_config-2", &fields{}, args{}, olterrors.ErrNotImplemented},
+		{"update_pm_config-3", &fields{}, args{}, olterrors.ErrNotImplemented},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
diff --git a/internal/pkg/core/statsmanager.go b/internal/pkg/core/statsmanager.go
index 3133bce..0cc1b46 100755
--- a/internal/pkg/core/statsmanager.go
+++ b/internal/pkg/core/statsmanager.go
@@ -20,6 +20,7 @@
 import (
 	"fmt"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
+	"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
 	"github.com/opencord/voltha-protos/v3/go/openolt"
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 	"sync"
@@ -233,7 +234,7 @@
 		return PONPorts, nil
 	} else {
 		log.Errorf("Invalid type of interface %s", Intftype)
-		return nil, NewErrInvalidValue(log.Fields{"interface-type": Intftype}, nil)
+		return nil, olterrors.NewErrInvalidValue(log.Fields{"interface-type": Intftype}, nil)
 	}
 }
 
diff --git a/internal/pkg/core/error.go b/internal/pkg/olterrors/olterrors.go
similarity index 98%
rename from internal/pkg/core/error.go
rename to internal/pkg/olterrors/olterrors.go
index 0de7dc8..175b948 100644
--- a/internal/pkg/core/error.go
+++ b/internal/pkg/olterrors/olterrors.go
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-// Package core provides the utility for olt devices, flows and statistics
-package core
+//Package olterrors implements functions to manipulate OLT errors
+package olterrors
 
 import (
 	"encoding/json"