VOL-2967: Remove redundant variables from  DeviceHandler struct

Change-Id: I09f119ef3cd41f13b8a2ada612cdc9aa009f2409
diff --git a/VERSION b/VERSION
index 59aa62c..037b009 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.4.5
+2.4.6-dev
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 878c6db..2e879e1 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -74,9 +74,6 @@
 
 //DeviceHandler will interact with the OLT device.
 type DeviceHandler struct {
-	deviceID      string
-	deviceType    string
-	adminState    string
 	device        *voltha.Device
 	coreProxy     adapterif.CoreProxy
 	AdapterProxy  adapterif.AdapterProxy
@@ -153,9 +150,6 @@
 	dh.AdapterProxy = ap
 	dh.EventProxy = ep
 	cloned := (proto.Clone(device)).(*voltha.Device)
-	dh.deviceID = cloned.Id
-	dh.deviceType = cloned.Type
-	dh.adminState = "up"
 	dh.device = cloned
 	dh.openOLT = adapter
 	dh.exitChannel = make(chan int, 1)
@@ -343,13 +337,6 @@
 		/*TODO: needs to handle error scenarios */
 		return olterrors.NewErrNotFound("device", log.Fields{"device-id": dh.device.Id}, err)
 	}
-	// When the device is in DISABLED and Adapter container restarts, we need to
-	// rebuild the locally maintained admin state.
-	if device.AdminState == voltha.AdminState_DISABLED {
-		dh.lockDevice.Lock()
-		dh.adminState = "down"
-		dh.lockDevice.Unlock()
-	}
 
 	// Create an exponential backoff around re-enabling indications. The
 	// maximum elapsed time for the back off is set to 0 so that we will
@@ -367,14 +354,14 @@
 	for {
 		select {
 		case <-dh.stopIndications:
-			logger.Debugw("stopping-collecting-indications-for-olt", log.Fields{"deviceID:": dh.deviceID})
+			logger.Debugw("stopping-collecting-indications-for-olt", log.Fields{"deviceID:": dh.device.Id})
 			break Loop
 		default:
 			indication, err := indications.Recv()
 			if err == io.EOF {
 				logger.Infow("eof-for-indications",
 					log.Fields{"err": err,
-						"device-id": dh.deviceID})
+						"device-id": dh.device.Id})
 				// Use an exponential back off to prevent getting into a tight loop
 				duration := indicationBackoff.NextBackOff()
 				if duration == backoff.Stop {
@@ -382,7 +369,7 @@
 					// timer and keep attempting.
 					logger.Warnw("maximum-indication-backoff-reached--resetting-backoff-timer",
 						log.Fields{"max-indication-backoff": indicationBackoff.MaxElapsedTime,
-							"device-id": dh.deviceID})
+							"device-id": dh.device.Id})
 					indicationBackoff.Reset()
 				}
 				time.Sleep(indicationBackoff.NextBackOff())
@@ -394,8 +381,8 @@
 			if err != nil {
 				logger.Errorw("read-indication-error",
 					log.Fields{"err": err,
-						"device-id": dh.deviceID})
-				if dh.adminState == "deleted" {
+						"device-id": dh.device.Id})
+				if device.AdminState == voltha.AdminState_DELETED {
 					logger.Debug("device-deleted--stopping-the-read-indication-thread")
 					break Loop
 				}
@@ -405,7 +392,7 @@
 					// In all probability, the closeSend call may fail
 					logger.Debugw("error-closing-send stream--error-ignored",
 						log.Fields{"err": err,
-							"device-id": dh.deviceID})
+							"device-id": dh.device.Id})
 				}
 				if indications, err = dh.startOpenOltIndicationStream(ctx); err != nil {
 					return err
@@ -415,14 +402,11 @@
 			}
 			// Reset backoff if we have a successful receive
 			indicationBackoff.Reset()
-			dh.lockDevice.RLock()
-			adminState := dh.adminState
-			dh.lockDevice.RUnlock()
 			// When OLT is admin down, ignore all indications.
-			if adminState == "down" && !isIndicationAllowedDuringOltAdminDown(indication) {
+			if device.AdminState == voltha.AdminState_DISABLED && !isIndicationAllowedDuringOltAdminDown(indication) {
 				logger.Debugw("olt-is-admin-down, ignore indication",
 					log.Fields{"indication": indication,
-						"device-id": dh.deviceID})
+						"device-id": dh.device.Id})
 				continue
 			}
 			dh.handleIndication(ctx, indication)
@@ -466,9 +450,9 @@
 		dh.transitionMap.Handle(ctx, DeviceDownInd)
 	}
 	// Send or clear Alarm
-	if err := dh.eventMgr.oltUpDownIndication(oltIndication, dh.deviceID, raisedTs); err != nil {
+	if err := dh.eventMgr.oltUpDownIndication(oltIndication, dh.device.Id, raisedTs); err != nil {
 		return olterrors.NewErrAdapter("failed-indication", log.Fields{
-			"device-id":  dh.deviceID,
+			"device_id":  dh.device.Id,
 			"indication": oltIndication,
 			"timestamp":  raisedTs}, err)
 	}
@@ -481,22 +465,22 @@
 	switch indication.Data.(type) {
 	case *oop.Indication_OltInd:
 		if err := dh.handleOltIndication(ctx, indication.GetOltInd()); err != nil {
-			olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "olt", "device-id": dh.deviceID}, err).Log()
+			olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "olt", "device-id": dh.device.Id}, 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 {
-				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface", "device-id": dh.deviceID}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface", "device-id": dh.device.Id}, err).Log()
 			}
 		}()
-		logger.Infow("received-interface-indication", log.Fields{"InterfaceInd": intfInd, "device-id": dh.deviceID})
+		logger.Infow("received-interface-indication", log.Fields{"InterfaceInd": intfInd, "device-id": dh.device.Id})
 	case *oop.Indication_IntfOperInd:
 		intfOperInd := indication.GetIntfOperInd()
 		if intfOperInd.GetType() == "nni" {
 			go func() {
 				if err := dh.addPort(intfOperInd.GetIntfId(), voltha.Port_ETHERNET_NNI, intfOperInd.GetOperState()); err != nil {
-					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-nni", "device-id": dh.deviceID}, err).Log()
+					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-nni", "device-id": dh.device.Id}, err).Log()
 				}
 			}()
 			dh.resourceMgr.AddNNIToKVStore(ctx, intfOperInd.GetIntfId())
@@ -505,45 +489,45 @@
 			// Handle pon port update
 			go func() {
 				if err := dh.addPort(intfOperInd.GetIntfId(), voltha.Port_PON_OLT, intfOperInd.GetOperState()); err != nil {
-					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-pon", "device-id": dh.deviceID}, err).Log()
+					olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "interface-oper-pon", "device-id": dh.device.Id}, err).Log()
 				}
 			}()
-			go dh.eventMgr.oltIntfOperIndication(indication.GetIntfOperInd(), dh.deviceID, raisedTs)
+			go dh.eventMgr.oltIntfOperIndication(indication.GetIntfOperInd(), dh.device.Id, raisedTs)
 		}
 		logger.Infow("received-interface-oper-indication",
 			log.Fields{"interfaceOperInd": intfOperInd,
-				"device-id": dh.deviceID})
+				"device-id": dh.device.Id})
 	case *oop.Indication_OnuDiscInd:
 		onuDiscInd := indication.GetOnuDiscInd()
-		logger.Infow("received-onu-discovery-indication", log.Fields{"OnuDiscInd": onuDiscInd, "device-id": dh.deviceID})
+		logger.Infow("received-onu-discovery-indication", log.Fields{"OnuDiscInd": onuDiscInd, "device-id": dh.device.Id})
 		sn := dh.stringifySerialNumber(onuDiscInd.SerialNumber)
 		go func() {
 			if err := dh.onuDiscIndication(ctx, onuDiscInd, sn); err != nil {
-				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu-discovery", "device-id": dh.deviceID}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu-discovery", "device-id": dh.device.Id}, err).Log()
 			}
 		}()
 	case *oop.Indication_OnuInd:
 		onuInd := indication.GetOnuInd()
-		logger.Infow("received-onu-indication", log.Fields{"OnuInd": onuInd, "device-id": dh.deviceID})
+		logger.Infow("received-onu-indication", log.Fields{"OnuInd": onuInd, "device-id": dh.device.Id})
 		go func() {
 			if err := dh.onuIndication(onuInd); err != nil {
-				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu", "device-id": dh.deviceID}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "onu", "device-id": dh.device.Id}, err).Log()
 			}
 		}()
 	case *oop.Indication_OmciInd:
 		omciInd := indication.GetOmciInd()
-		logger.Debugw("received-omci-indication", log.Fields{"IntfId": omciInd.IntfId, "OnuId": omciInd.OnuId, "device-id": dh.deviceID})
+		logger.Debugw("received-omci-indication", log.Fields{"IntfId": omciInd.IntfId, "OnuId": omciInd.OnuId, "device-id": dh.device.Id})
 		go func() {
 			if err := dh.omciIndication(omciInd); err != nil {
-				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "omci", "device-id": dh.deviceID}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "omci", "device-id": dh.device.Id}, err).Log()
 			}
 		}()
 	case *oop.Indication_PktInd:
 		pktInd := indication.GetPktInd()
-		logger.Infow("received-packet-indication", log.Fields{"PktInd": pktInd, "device-id": dh.deviceID})
+		logger.Infow("received-packet-indication", log.Fields{"PktInd": pktInd, "device-id": dh.device.Id})
 		go func() {
 			if err := dh.handlePacketIndication(ctx, pktInd); err != nil {
-				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "packet", "device-id": dh.deviceID}, err).Log()
+				olterrors.NewErrAdapter("handle-indication-error", log.Fields{"type": "packet", "device-id": dh.device.Id}, err).Log()
 			}
 		}()
 	case *oop.Indication_PortStats:
@@ -551,11 +535,11 @@
 		go dh.portStats.PortStatisticsIndication(portStats, dh.resourceMgr.DevInfo.GetPonPorts())
 	case *oop.Indication_FlowStats:
 		flowStats := indication.GetFlowStats()
-		logger.Infow("received-flow-stats", log.Fields{"FlowStats": flowStats, "device-id": dh.deviceID})
+		logger.Infow("received-flow-stats", log.Fields{"FlowStats": flowStats, "device-id": dh.device.Id})
 	case *oop.Indication_AlarmInd:
 		alarmInd := indication.GetAlarmInd()
-		logger.Infow("received-alarm-indication", log.Fields{"AlarmInd": alarmInd, "device-id": dh.deviceID})
-		go dh.eventMgr.ProcessEvents(alarmInd, dh.deviceID, raisedTs)
+		logger.Infow("received-alarm-indication", log.Fields{"AlarmInd": alarmInd, "device-id": dh.device.Id})
+		go dh.eventMgr.ProcessEvents(alarmInd, dh.device.Id, raisedTs)
 	}
 }
 
@@ -576,7 +560,7 @@
 func (dh *DeviceHandler) doStateDown(ctx context.Context) error {
 	dh.lockDevice.Lock()
 	defer dh.lockDevice.Unlock()
-	logger.Debugw("do-state-down-start", log.Fields{"device-id": dh.deviceID})
+	logger.Debugw("do-state-down-start", log.Fields{"device-id": dh.device.Id})
 
 	device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
 	if err != nil || device == nil {
@@ -627,7 +611,7 @@
 	var err error
 	if dh.clientCon, err = grpc.Dial(dh.device.GetHostAndPort(), grpc.WithInsecure(), grpc.WithBlock()); err != nil {
 		return olterrors.NewErrCommunication("dial-failure", log.Fields{
-			"device-id":     dh.deviceID,
+			"device-id":     dh.device.Id,
 			"host-and-port": dh.device.GetHostAndPort()}, err)
 	}
 	return nil
@@ -642,47 +626,49 @@
 
 // doStateConnected get the device info and update to voltha core
 func (dh *DeviceHandler) doStateConnected(ctx context.Context) error {
-	logger.Debugw("olt-device-connected", log.Fields{"device-id": dh.deviceID})
+	var err error
+	logger.Debugw("olt-device-connected", log.Fields{"device-id": dh.device.Id})
 
 	// Case where OLT is disabled and then rebooted.
-	if dh.adminState == "down" {
+	device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
+	if err != nil || device == nil {
+		/*TODO: needs to handle error scenarios */
+		return olterrors.NewErrAdapter("device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+	}
+	if device.AdminState == voltha.AdminState_DISABLED {
 		logger.Debugln("do-state-connected--device-admin-state-down")
-		device, err := dh.coreProxy.GetDevice(ctx, dh.device.Id, dh.device.Id)
-		if err != nil || device == nil {
-			/*TODO: needs to handle error scenarios */
-			olterrors.NewErrAdapter("device-fetch-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
-		}
 
 		cloned := proto.Clone(device).(*voltha.Device)
 		cloned.ConnectStatus = voltha.ConnectStatus_REACHABLE
 		cloned.OperStatus = voltha.OperStatus_UNKNOWN
 		dh.device = cloned
-		if er := dh.coreProxy.DeviceStateUpdate(ctx, cloned.Id, cloned.ConnectStatus, cloned.OperStatus); er != nil {
-			olterrors.NewErrAdapter("device-state-update-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+		if err = dh.coreProxy.DeviceStateUpdate(ctx, cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
+			return 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 {
-			olterrors.NewErrAdapter("olt-disable-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+			return olterrors.NewErrAdapter("olt-disable-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 		}
 		// We should still go ahead an initialize various device handler modules so that when OLT is re-enabled, we have
 		// all the modules initialized and ready to handle incoming ONUs.
 
-		if err := dh.initializeDeviceHandlerModules(ctx); err != nil {
-			olterrors.NewErrAdapter("device-handler-initialization-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+		err = dh.initializeDeviceHandlerModules(ctx)
+		if err != nil {
+			return olterrors.NewErrAdapter("device-handler-initialization-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 		}
 
 		// Start reading indications
 		go func() {
-			if err := dh.readIndications(ctx); err != nil {
+			if err = dh.readIndications(ctx); err != nil {
 				olterrors.NewErrAdapter("indication-read-failure", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 			}
 		}()
 		return nil
 	}
 
-	device, err := dh.coreProxy.GetDevice(context.TODO(), dh.device.Id, dh.device.Id)
+	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 olterrors.NewErrAdapter("fetch-device-failed", log.Fields{"device-id": dh.device.Id}, err)
@@ -693,7 +679,7 @@
 	}
 
 	if err := dh.initializeDeviceHandlerModules(ctx); err != nil {
-		olterrors.NewErrAdapter("device-handler-initialization-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
+		return olterrors.NewErrAdapter("device-handler-initialization-failed", log.Fields{"device-id": dh.device.Id}, err).LogAt(log.ErrorLevel)
 	}
 
 	// Start reading indications
@@ -714,7 +700,7 @@
 	}
 	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 {
+	if dh.resourceMgr = rsrcMgr.NewResourceMgr(ctx, dh.device.Id, KVStoreHostPort, dh.openOLT.KVStoreType, dh.device.Type, deviceInfo); dh.resourceMgr == nil {
 		return olterrors.ErrResourceManagerInstantiating
 	}
 
@@ -747,7 +733,7 @@
 		return nil, olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
 	}
 
-	logger.Debugw("fetched-device-info", log.Fields{"deviceInfo": deviceInfo, "device-id": dh.deviceID})
+	logger.Debugw("fetched-device-info", log.Fields{"deviceInfo": deviceInfo, "device-id": dh.device.Id})
 	dh.device.Root = true
 	dh.device.Vendor = deviceInfo.Vendor
 	dh.device.Model = deviceInfo.Model
@@ -783,11 +769,11 @@
 	for {
 		select {
 		case <-dh.stopCollector:
-			logger.Debugw("stopping-collector-for-olt", log.Fields{"deviceID:": dh.deviceID})
+			logger.Debugw("stopping-collector-for-olt", log.Fields{"deviceID:": dh.device.Id})
 			return
 		case <-time.After(time.Duration(freq) * time.Second):
-			context["oltid"] = dh.deviceID
-			context["devicetype"] = dh.deviceType
+			context["oltid"] = dh.device.Id
+			context["devicetype"] = dh.device.Type
 			ports := make([]*voltha.Port, len(dh.device.Ports))
 			copy(ports, dh.device.Ports)
 
@@ -797,7 +783,7 @@
 					intfID := PortNoToIntfID(port.PortNo, voltha.Port_ETHERNET_NNI)
 					cmnni := dh.portStats.collectNNIMetrics(intfID)
 					logger.Debugw("collect-nni-metrics", log.Fields{"metrics": cmnni})
-					go dh.portStats.publishMetrics(cmnni, port, context, dh.deviceID)
+					go dh.portStats.publishMetrics(cmnni, port, context, dh.device.Id)
 					logger.Debugw("publish-nni-metrics", log.Fields{"nni-port": port.Label})
 				}
 				// PON Stats
@@ -806,7 +792,7 @@
 					if val, ok := dh.activePorts.Load(intfID); ok && val == true {
 						cmpon := dh.portStats.collectPONMetrics(intfID)
 						logger.Debugw("collect-pon-metrics", log.Fields{"metrics": cmpon})
-						go dh.portStats.publishMetrics(cmpon, port, context, dh.deviceID)
+						go dh.portStats.publishMetrics(cmpon, port, context, dh.device.Id)
 					}
 					logger.Debugw("publish-pon-metrics", log.Fields{"pon-port": port.Label})
 				}
@@ -871,20 +857,20 @@
 }
 
 func (dh *DeviceHandler) omciIndication(omciInd *oop.OmciIndication) error {
-	logger.Debugw("omci-indication", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.deviceID})
+	logger.Debugw("omci-indication", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.device.Id})
 	var deviceType string
 	var deviceID string
 	var proxyDeviceID string
 
 	transid := extractOmciTransactionID(omciInd.Pkt)
-	logger.Debugw("recv-omci-msg", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.deviceID,
+	logger.Debugw("recv-omci-msg", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.device.Id,
 		"omciTransactionID": transid, "omciMsg": hex.EncodeToString(omciInd.Pkt)})
 
 	onuKey := dh.formOnuKey(omciInd.IntfId, omciInd.OnuId)
 
 	if onuInCache, ok := dh.onus.Load(onuKey); !ok {
 
-		logger.Debugw("omci-indication-for-a-device-not-in-cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.deviceID})
+		logger.Debugw("omci-indication-for-a-device-not-in-cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.device.Id})
 		ponPort := IntfIDToPortNo(omciInd.GetIntfId(), voltha.Port_PON_OLT)
 		kwargs := make(map[string]interface{})
 		kwargs["onu_id"] = omciInd.OnuId
@@ -903,7 +889,7 @@
 		dh.onus.Store(onuKey, NewOnuDevice(deviceID, deviceType, onuDevice.SerialNumber, omciInd.OnuId, omciInd.IntfId, proxyDeviceID, false))
 	} else {
 		//found in cache
-		logger.Debugw("omci-indication-for-a-device-in-cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.deviceID})
+		logger.Debugw("omci-indication-for-a-device-in-cache.", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "device-id": dh.device.Id})
 		deviceType = onuInCache.(*OnuDevice).deviceType
 		deviceID = onuInCache.(*OnuDevice).deviceID
 		proxyDeviceID = onuInCache.(*OnuDevice).proxyDeviceID
@@ -911,10 +897,10 @@
 
 	omciMsg := &ic.InterAdapterOmciMessage{Message: omciInd.Pkt}
 	if err := dh.AdapterProxy.SendInterAdapterMessage(context.Background(), omciMsg,
-		ic.InterAdapterMessageType_OMCI_REQUEST, dh.deviceType, deviceType,
+		ic.InterAdapterMessageType_OMCI_REQUEST, dh.device.Type, deviceType,
 		deviceID, proxyDeviceID, ""); err != nil {
 		return olterrors.NewErrCommunication("omci-request", log.Fields{
-			"source":          dh.deviceType,
+			"source":          dh.device.Type,
 			"destination":     deviceType,
 			"onu-id":          deviceID,
 			"proxy-device-id": proxyDeviceID}, err)
@@ -1016,7 +1002,7 @@
 }
 
 func (dh *DeviceHandler) activateONU(ctx context.Context, intfID uint32, onuID int64, serialNum *oop.SerialNumber, serialNumber string) error {
-	logger.Debugw("activate-onu", log.Fields{"intfID": intfID, "onuID": onuID, "serialNum": serialNum, "serialNumber": serialNumber, "device-id": dh.deviceID})
+	logger.Debugw("activate-onu", log.Fields{"intfID": intfID, "onuID": onuID, "serialNum": serialNum, "serialNumber": serialNumber, "device-id": dh.device.Id})
 	if err := dh.flowMgr.UpdateOnuInfo(ctx, intfID, uint32(onuID), serialNumber); err != nil {
 		return olterrors.NewErrAdapter("onu-activate-failed", log.Fields{"onu": onuID, "intfID": intfID}, err)
 	}
@@ -1026,12 +1012,12 @@
 	if _, err := dh.Client.ActivateOnu(ctx, &Onu); err != nil {
 		st, _ := status.FromError(err)
 		if st.Code() == codes.AlreadyExists {
-			logger.Debugw("onu-activation-in-progress", log.Fields{"SerialNumber": serialNumber, "onuID": onuID, "device-id": dh.deviceID})
+			logger.Debugw("onu-activation-in-progress", log.Fields{"SerialNumber": serialNumber, "onuID": onuID, "device-id": dh.device.Id})
 		} else {
-			return olterrors.NewErrAdapter("onu-activate-failed", log.Fields{"onu": Onu, "device-id": dh.deviceID}, err)
+			return olterrors.NewErrAdapter("onu-activate-failed", log.Fields{"onu": Onu, "device-id": dh.device.Id}, err)
 		}
 	} else {
-		logger.Infow("activated-onu", log.Fields{"SerialNumber": serialNumber, "device-id": dh.deviceID})
+		logger.Infow("activated-onu", log.Fields{"SerialNumber": serialNumber, "device-id": dh.device.Id})
 	}
 	return nil
 }
@@ -1134,7 +1120,7 @@
 			log.Fields{"onuDevice": onuDevice,
 				"sn":        sn,
 				"onuID":     onuID,
-				"device-id": dh.deviceID})
+				"device-id": dh.device.Id})
 	}
 
 	// we can now use the existing ONU Id
@@ -1178,7 +1164,7 @@
 	logger.Debugw("onu-indication-key-create",
 		log.Fields{"onuId": onuInd.OnuId,
 			"intfId":    onuInd.GetIntfId(),
-			"device-id": dh.deviceID})
+			"device-id": dh.device.Id})
 	onuKey := dh.formOnuKey(onuInd.GetIntfId(), onuInd.OnuId)
 
 	errFields := log.Fields{"device-id": dh.device.Id}
@@ -1217,7 +1203,7 @@
 		logger.Warnw("onu-id-mismatch-possible-if-voltha-and-olt-rebooted", log.Fields{
 			"expected-onu-id": onuDevice.ProxyAddress.OnuId,
 			"received-onu-id": onuInd.OnuId,
-			"device-id":       dh.deviceID})
+			"device-id":       dh.device.Id})
 	}
 	if !foundInCache {
 		onuKey := dh.formOnuKey(onuInd.GetIntfId(), onuInd.GetOnuId())
@@ -1312,7 +1298,7 @@
 	logger.Debugw("getchilddevice",
 		log.Fields{"pon-port": parentPort,
 			"onuID":     onuID,
-			"device-id": dh.deviceID})
+			"device-id": dh.device.Id})
 	kwargs := make(map[string]interface{})
 	kwargs["onu_id"] = onuID
 	kwargs["parent_port_no"] = parentPort
@@ -1333,7 +1319,7 @@
 	logger.Debugw("send-packet-in-to-core", log.Fields{
 		"port":      logicalPort,
 		"packet":    hex.EncodeToString(packetPayload),
-		"device-id": dh.deviceID,
+		"device-id": dh.device.Id,
 	})
 	if err := dh.coreProxy.SendPacketIn(context.TODO(), dh.device.Id, logicalPort, packetPayload); err != nil {
 		return olterrors.NewErrCommunication("packet-send-failed", log.Fields{
@@ -1345,7 +1331,7 @@
 	}
 	logger.Debugw("sent-packet-in-to-core-successfully", log.Fields{
 		"packet":    hex.EncodeToString(packetPayload),
-		"device-id": dh.deviceID,
+		"device-id": dh.device.Id,
 	})
 	return nil
 }
@@ -1412,13 +1398,13 @@
 			}
 		}
 		if len(groups.ToRemove.Items) != 0 {
-			logger.Debugw("group-delete-operation-not-supported", log.Fields{"device-id": dh.deviceID})
+			logger.Debugw("group-delete-operation-not-supported", log.Fields{"device-id": dh.device.Id})
 		}
 	}
 	if len(errorsList) > 0 {
 		return fmt.Errorf("errors-installing-flows-groups, errors:%v", errorsList)
 	}
-	logger.Debugw("updated-flows-incrementally-successfully", log.Fields{"device-id": dh.deviceID})
+	logger.Debugw("updated-flows-incrementally-successfully", log.Fields{"device-id": dh.device.Id})
 	return nil
 }
 
@@ -1430,15 +1416,9 @@
 func (dh *DeviceHandler) DisableDevice(device *voltha.Device) error {
 	/* On device disable ,admin state update has to be done prior sending request to agent since
 	   the indication thread may processes invalid  indications of ONU and OLT*/
-	dh.lockDevice.Lock()
-	dh.adminState = "down"
-	dh.lockDevice.Unlock()
 	if dh.Client != nil {
 		if _, err := dh.Client.DisableOlt(context.Background(), new(oop.Empty)); err != nil {
 			if e, ok := status.FromError(err); ok && e.Code() == codes.Internal {
-				dh.lockDevice.Lock()
-				dh.adminState = "up"
-				dh.lockDevice.Unlock()
 				return olterrors.NewErrAdapter("olt-disable-failed", log.Fields{"device-id": device.Id}, err)
 			}
 		}
@@ -1455,6 +1435,8 @@
 
 	go dh.notifyChildDevices("unreachable")
 	cloned := proto.Clone(device).(*voltha.Device)
+	//Update device Admin state
+	dh.device = cloned
 	// Update the all pon ports state on that device to disable and NNI remains active as NNI remains active in openolt agent.
 	for _, port := range cloned.Ports {
 		if port.GetType() == voltha.Port_PON_OLT {
@@ -1499,15 +1481,9 @@
 //Device Port-State: ACTIVE
 //Device Oper-State: ACTIVE
 func (dh *DeviceHandler) ReenableDevice(device *voltha.Device) error {
-	dh.lockDevice.Lock()
-	dh.adminState = "up"
-	dh.lockDevice.Unlock()
 
 	if _, err := dh.Client.ReenableOlt(context.Background(), new(oop.Empty)); err != nil {
 		if e, ok := status.FromError(err); ok && e.Code() == codes.Internal {
-			dh.lockDevice.Lock()
-			dh.adminState = "down"
-			dh.lockDevice.Unlock()
 			return olterrors.NewErrAdapter("olt-reenable-failed", log.Fields{"device-id": dh.device.Id}, err)
 		}
 	}
@@ -1578,7 +1554,7 @@
 	nniOnuID := -1
 
 	if dh.resourceMgr == nil {
-		return olterrors.NewErrNotFound("resource-manager", log.Fields{"device-id": dh.deviceID}, nil)
+		return olterrors.NewErrNotFound("resource-manager", log.Fields{"device-id": dh.device.Id}, nil)
 	}
 	//Free the flow-ids for the NNI port
 	nni, err := dh.resourceMgr.GetNNIFromKVStore(ctx)
@@ -1603,13 +1579,6 @@
 // DeleteDevice deletes the device instance from openolt handler array.  Also clears allocated resource manager resources.  Also reboots the OLT hardware!
 func (dh *DeviceHandler) DeleteDevice(ctx context.Context, device *voltha.Device) error {
 	logger.Debug("function-entry-delete-device")
-	dh.lockDevice.Lock()
-	if dh.adminState == "deleted" {
-		dh.lockDevice.Unlock()
-		return nil
-	}
-	dh.adminState = "deleted"
-	dh.lockDevice.Unlock()
 	/* Clear the KV store data associated with the all the UNI ports
 	   This clears up flow data and also resource map data for various
 	   other pon resources like alloc_id and gemport_id
@@ -1623,7 +1592,7 @@
 	//Reset the state
 	if dh.Client != nil {
 		if _, err := dh.Client.Reboot(ctx, new(oop.Empty)); err != nil {
-			return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err).Log()
+			return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 		}
 	}
 	cloned := proto.Clone(device).(*voltha.Device)
@@ -1673,7 +1642,7 @@
 		   There are mostly trap rules from NNI port (like LLDP)
 		*/
 		if err := dh.clearNNIData(ctx); err != nil {
-			logger.Errorw("failed-to-clear-data-for-NNI-port", log.Fields{"device-id": dh.deviceID})
+			logger.Errorw("failed-to-clear-data-for-NNI-port", log.Fields{"device-id": dh.device.Id})
 		}
 
 		/* Clear the resource pool for each PON port in the background */
@@ -1698,7 +1667,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 olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.deviceID}, err)
+		return olterrors.NewErrAdapter("olt-reboot-failed", log.Fields{"device-id": dh.device.Id}, err)
 	}
 	logger.Debugw("rebooted-device-successfully", log.Fields{"device-id": device.Id})
 	return nil
@@ -1722,14 +1691,14 @@
 	if err := dh.coreProxy.SendPacketIn(context.TODO(), dh.device.Id, logicalPortNum, packetIn.Pkt); err != nil {
 		return olterrors.NewErrCommunication("send-packet-in", log.Fields{
 			"destination": "core",
-			"source":      dh.deviceType,
+			"source":      dh.device.Type,
 			"device-id":   dh.device.Id,
 			"packet":      hex.EncodeToString(packetIn.Pkt),
 		}, err)
 	}
 	logger.Debugw("success-sending-packet-in-to-core!", log.Fields{
 		"packet":    hex.EncodeToString(packetIn.Pkt),
-		"device-id": dh.deviceID,
+		"device-id": dh.device.Id,
 	})
 	return nil
 }
@@ -1737,7 +1706,7 @@
 // PacketOut sends packet-out from VOLTHA to OLT on the egress port provided
 func (dh *DeviceHandler) PacketOut(ctx context.Context, egressPortNo int, packet *of.OfpPacketOut) error {
 	logger.Debugw("incoming-packet-out", log.Fields{
-		"device-id":      dh.deviceID,
+		"device-id":      dh.device.Id,
 		"egress-port-no": egressPortNo,
 		"pkt-length":     len(packet.Data),
 		"packet":         hex.EncodeToString(packet.Data),
@@ -1779,7 +1748,7 @@
 			// This may not always succeed at the agent and packetOut may fail.
 			logger.Errorw("failed-to-retrieve-gemport-id-for-packet-out", log.Fields{
 				"packet":    hex.EncodeToString(packet.Data),
-				"device-id": dh.deviceID,
+				"device-id": dh.device.Id,
 			})
 		}
 
@@ -1792,7 +1761,7 @@
 			"uniID":          uniID,
 			"gemPortID":      gemPortID,
 			"packet":         hex.EncodeToString(packet.Data),
-			"device-id":      dh.deviceID,
+			"device-id":      dh.device.Id,
 		})
 
 		if _, err := dh.Client.OnuPacketOut(ctx, &onuPkt); err != nil {
@@ -1821,7 +1790,7 @@
 		logger.Debugw("sending-packet-to-nni", log.Fields{
 			"uplink-pkt": uplinkPkt,
 			"packet":     hex.EncodeToString(packet.Data),
-			"device-id":  dh.deviceID,
+			"device-id":  dh.device.Id,
 		})
 
 		if _, err := dh.Client.UplinkPacketOut(ctx, &uplinkPkt); err != nil {
@@ -1835,7 +1804,7 @@
 			"egress-port-no": egressPortNo,
 			"egressPortType": egressPortType,
 			"packet":         hex.EncodeToString(packet.Data),
-			"device-id":      dh.deviceID,
+			"device-id":      dh.device.Id,
 		})
 	}
 	return nil
@@ -1855,7 +1824,7 @@
 		case <-heartbeatTimer.C:
 			ctxWithTimeout, cancel := context.WithTimeout(context.Background(), dh.openOLT.GrpcTimeoutInterval)
 			if heartBeat, err := dh.Client.HeartbeatCheck(ctxWithTimeout, new(oop.Empty)); err != nil {
-				logger.Warnw("hearbeat-failed", log.Fields{"device-id": dh.deviceID})
+				logger.Warnw("hearbeat-failed", log.Fields{"device-id": dh.device.Id})
 				if timerCheck == nil {
 					// start a after func, when expired will update the state to the core
 					timerCheck = time.AfterFunc(dh.openOLT.HeartbeatFailReportInterval, func() { dh.updateStateUnreachable(ctx) })
@@ -1863,17 +1832,17 @@
 			} else {
 				if timerCheck != nil {
 					if timerCheck.Stop() {
-						logger.Debugw("got-hearbeat-within-timeout", log.Fields{"device-id": dh.deviceID})
+						logger.Debugw("got-hearbeat-within-timeout", log.Fields{"device-id": dh.device.Id})
 					}
 					timerCheck = nil
 				}
 				logger.Debugw("hearbeat",
 					log.Fields{"signature": heartBeat,
-						"device-id": dh.deviceID})
+						"device-id": dh.device.Id})
 			}
 			cancel()
 		case <-dh.stopHeartbeatCheck:
-			logger.Debugw("stopping-heart-beat-check", log.Fields{"device-id": dh.deviceID})
+			logger.Debugw("stopping-heart-beat-check", log.Fields{"device-id": dh.device.Id})
 			return
 		}
 	}
@@ -1924,7 +1893,7 @@
 //modifyPhyPort is common function to enable and disable the port. parm :enablePort, true to enablePort and false to disablePort.
 func (dh *DeviceHandler) modifyPhyPort(port *voltha.Port, enablePort bool) error {
 	ctx := context.Background()
-	logger.Infow("modifyPhyPort", log.Fields{"port": port, "Enable": enablePort, "device-id": dh.deviceID})
+	logger.Infow("modifyPhyPort", log.Fields{"port": port, "Enable": enablePort, "device-id": dh.device.Id})
 	if port.GetType() == voltha.Port_ETHERNET_NNI {
 		// Bug is opened for VOL-2505 to support NNI disable feature.
 		logger.Infow("voltha-supports-single-nni-hence-disable-of-nni-not-allowed",
@@ -1961,9 +1930,9 @@
 		dh.activePorts.Store(ponID, false)
 		logger.Infow("disabled-pon-port", log.Fields{"out": out, "device-id": dh.device, "Port": port})
 	}
-	if err := dh.coreProxy.PortStateUpdate(ctx, dh.deviceID, voltha.Port_PON_OLT, port.PortNo, operStatus); err != nil {
+	if err := dh.coreProxy.PortStateUpdate(ctx, dh.device.Id, voltha.Port_PON_OLT, port.PortNo, operStatus); err != nil {
 		return olterrors.NewErrAdapter("port-state-update-failed", log.Fields{
-			"device-id": dh.deviceID,
+			"device-id": dh.device.Id,
 			"port":      port.PortNo}, err)
 	}
 	return nil
@@ -1978,7 +1947,7 @@
 		if port.AdminState == common.AdminState_DISABLED {
 			if err := dh.DisablePort(port); err != nil {
 				return olterrors.NewErrAdapter("port-disable-failed", log.Fields{
-					"device-id": dh.deviceID,
+					"device-id": dh.device.Id,
 					"port":      port}, err)
 			}
 		}
@@ -2016,7 +1985,7 @@
 	if !ok {
 		return olterrors.NewErrAdapter("failed-to-load-onu-details",
 			log.Fields{
-				"device-id":    dh.deviceID,
+				"device-id":    dh.device.Id,
 				"onu-id":       onuID,
 				"interface-id": IntfID}, nil).Log()
 	}
@@ -2025,25 +1994,25 @@
 	if sn, err = dh.deStringifySerialNumber(onuDevice.(*OnuDevice).serialNumber); err != nil {
 		return olterrors.NewErrAdapter("failed-to-destringify-serial-number",
 			log.Fields{
-				"devicer-id":    dh.deviceID,
+				"devicer-id":    dh.device.Id,
 				"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 olterrors.NewErrAdapter("failed-to-delete-onu", log.Fields{
-			"device-id": dh.deviceID,
+			"device-id": dh.device.Id,
 			"onu-id":    onuID}, err).Log()
 	}
 	//clear PON resources associated with ONU
 	var onuGemData []rsrcMgr.OnuGemInfo
 	if onuMgr, ok := dh.resourceMgr.ResourceMgrs[IntfID]; !ok {
 		logger.Warnw("failed-to-get-resource-manager-for-interface-Id", log.Fields{
-			"device-id":    dh.deviceID,
+			"device-id":    dh.device.Id,
 			"interface-id": IntfID})
 	} else {
 		if err := onuMgr.GetOnuGemInfo(ctx, IntfID, &onuGemData); err != nil {
 			logger.Warnw("failed-to-get-onu-info-for-pon-port", log.Fields{
-				"device-id":    dh.deviceID,
+				"device-id":    dh.device.Id,
 				"interface-id": IntfID,
 				"error":        err})
 		} else {
@@ -2052,7 +2021,7 @@
 					logger.Debugw("onu-data", log.Fields{"onu": onu})
 					if err := dh.clearUNIData(ctx, &onu); err != nil {
 						logger.Warnw("failed-to-clear-uni-data-for-onu", log.Fields{
-							"device-id":  dh.deviceID,
+							"device-id":  dh.device.Id,
 							"onu-device": onu,
 							"error":      err})
 					}
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index b2f870c..bd97db8 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -155,8 +155,8 @@
 		Pools:      []*oop.DeviceInfo_DeviceResourceRanges_Pool{{}},
 	}}
 
-	deviceInf := &oop.DeviceInfo{Vendor: "openolt", Ranges: oopRanges, Model: "openolt", DeviceId: dh.deviceID, PonPorts: 2}
-	rsrMgr := resourcemanager.OpenOltResourceMgr{DeviceID: dh.deviceID, DeviceType: dh.deviceType, DevInfo: deviceInf,
+	deviceInf := &oop.DeviceInfo{Vendor: "openolt", Ranges: oopRanges, Model: "openolt", DeviceId: dh.device.Id, PonPorts: 2}
+	rsrMgr := resourcemanager.OpenOltResourceMgr{DeviceID: dh.device.Id, DeviceType: dh.device.Type, DevInfo: deviceInf,
 		KVStore: &db.Backend{
 			Client: &mocks.MockKVClient{},
 		}}
@@ -219,7 +219,6 @@
 	dh := newMockDeviceHandler()
 	device := dh.device
 	device.Id = ""
-	dh.adminState = "down"
 	return dh
 }
 func Test_generateMacFromHost(t *testing.T) {
@@ -946,7 +945,7 @@
 	dh1 := newMockDeviceHandler()
 	dh2 := newMockDeviceHandler()
 
-	dh2.deviceID = ""
+	dh2.device.Id = ""
 	dh3 := negativeDeviceHandler()
 
 	tests := []struct {
@@ -1129,7 +1128,6 @@
 func TestDeviceHandler_readIndications(t *testing.T) {
 	dh1 := newMockDeviceHandler()
 	dh2 := newMockDeviceHandler()
-	dh2.adminState = "down"
 	dh3 := newMockDeviceHandler()
 	dh3.device.AdminState = voltha.AdminState_DISABLED
 	dh4 := negativeDeviceHandler()
diff --git a/internal/pkg/core/openolt.go b/internal/pkg/core/openolt.go
index 335a424..354382a 100644
--- a/internal/pkg/core/openolt.go
+++ b/internal/pkg/core/openolt.go
@@ -104,15 +104,15 @@
 func (oo *OpenOLT) addDeviceHandlerToMap(agent *DeviceHandler) {
 	oo.lockDeviceHandlersMap.Lock()
 	defer oo.lockDeviceHandlersMap.Unlock()
-	if _, exist := oo.deviceHandlers[agent.deviceID]; !exist {
-		oo.deviceHandlers[agent.deviceID] = agent
+	if _, exist := oo.deviceHandlers[agent.device.Id]; !exist {
+		oo.deviceHandlers[agent.device.Id] = agent
 	}
 }
 
 func (oo *OpenOLT) deleteDeviceHandlerToMap(agent *DeviceHandler) {
 	oo.lockDeviceHandlersMap.Lock()
 	defer oo.lockDeviceHandlersMap.Unlock()
-	delete(oo.deviceHandlers, agent.deviceID)
+	delete(oo.deviceHandlers, agent.device.Id)
 }
 
 func (oo *OpenOLT) getDeviceHandler(deviceID string) *DeviceHandler {
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 9762da2..ffdde7e 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -279,7 +279,7 @@
 
 func (f *OpenOltFlowMgr) registerFlow(ctx context.Context, flowFromCore *ofp.OfpFlowStats, deviceFlow *openoltpb2.Flow) {
 	logger.Debug("Registering Flow for Device ", log.Fields{"flow": flowFromCore},
-		log.Fields{"device": f.deviceHandler.deviceID})
+		log.Fields{"device": f.deviceHandler.device.Id})
 	gemPK := gemPortKey{uint32(deviceFlow.AccessIntfId), uint32(deviceFlow.GemportId)}
 	flowIDList, ok := f.flowsUsedByGemPort[gemPK]
 	if !ok {
@@ -1482,11 +1482,11 @@
 	if sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
 		delGemPortMsg,
 		ic.InterAdapterMessageType_DELETE_GEM_PORT_REQUEST,
-		f.deviceHandler.deviceType,
+		f.deviceHandler.device.Type,
 		onuDev.deviceType,
 		onuDev.deviceID,
 		onuDev.proxyDeviceID, ""); sendErr != nil {
-		return olterrors.NewErrCommunication("send-delete-gem-port-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.deviceType,
+		return olterrors.NewErrCommunication("send-delete-gem-port-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
 			"toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
 			"proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
 	}
@@ -1506,11 +1506,11 @@
 	if sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
 		delTcontMsg,
 		ic.InterAdapterMessageType_DELETE_TCONT_REQUEST,
-		f.deviceHandler.deviceType,
+		f.deviceHandler.device.Type,
 		onuDev.deviceType,
 		onuDev.deviceID,
 		onuDev.proxyDeviceID, ""); sendErr != nil {
-		return olterrors.NewErrCommunication("send-delete-tcont-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.deviceType,
+		return olterrors.NewErrCommunication("send-delete-tcont-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
 			"toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
 			"proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
 	}
@@ -2295,12 +2295,12 @@
 	sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
 		tpDownloadMsg,
 		ic.InterAdapterMessageType_TECH_PROFILE_DOWNLOAD_REQUEST,
-		f.deviceHandler.deviceType,
+		f.deviceHandler.device.Type,
 		onuDev.deviceType,
 		onuDev.deviceID,
 		onuDev.proxyDeviceID, "")
 	if sendErr != nil {
-		return olterrors.NewErrCommunication("send-techprofile-download-request", log.Fields{"fromAdapter": f.deviceHandler.deviceType,
+		return olterrors.NewErrCommunication("send-techprofile-download-request", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
 			"toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
 			"proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
 	}
diff --git a/internal/pkg/core/statsmanager.go b/internal/pkg/core/statsmanager.go
index c5c44db..5d742d0 100755
--- a/internal/pkg/core/statsmanager.go
+++ b/internal/pkg/core/statsmanager.go
@@ -197,10 +197,10 @@
 	// Northbound and Southbound ports
 	// added to initialize the pm_metrics
 	var Ports interface{}
-	Ports, _ = InitPorts("nni", Dev.deviceID, 1)
+	Ports, _ = InitPorts("nni", Dev.device.Id, 1)
 	StatMgr.NorthBoundPort, _ = Ports.(map[uint32]*NniPort)
 	NumPonPorts := Dev.resourceMgr.DevInfo.GetPonPorts()
-	Ports, _ = InitPorts("pon", Dev.deviceID, NumPonPorts)
+	Ports, _ = InitPorts("pon", Dev.device.Id, NumPonPorts)
 	StatMgr.SouthBoundPort, _ = Ports.(map[uint32]*PonPort)
 	return &StatMgr
 }