Adding missing device-id to several warning and error logs

Change-Id: Ia1e084d079b5c7f8369596077a062ebcef03a090
diff --git a/internal/pkg/almgr/alarm_manager.go b/internal/pkg/almgr/alarm_manager.go
index 69ae862..159736b 100755
--- a/internal/pkg/almgr/alarm_manager.go
+++ b/internal/pkg/almgr/alarm_manager.go
@@ -384,7 +384,7 @@
 	case omci.GetAllAlarmsNextResponseType:
 		am.handleOmciGetAllAlarmNextResponseMessage(ctx, msg)
 	default:
-		logger.Warnw(ctx, "unknown-message-type", log.Fields{"msg-type": msg.OmciMsg.MessageType})
+		logger.Warnw(ctx, "unknown-message-type", log.Fields{"device-id": am.deviceID, "msg-type": msg.OmciMsg.MessageType})
 
 	}
 }
@@ -581,7 +581,8 @@
 		return fmt.Errorf("alarm-manager-is-in-stopped-state")
 	}
 	if _, present := am.pOnuDeviceEntry.GetOnuDB().MeDb[classID][meInstance]; !present {
-		logger.Errorw(ctx, "me-class-instance-not-present", log.Fields{"class-id": classID, "instance-id": meInstance})
+		logger.Errorw(ctx, "me-class-instance-not-present",
+			log.Fields{"class-id": classID, "instance-id": meInstance, "device-id": am.deviceID})
 		return fmt.Errorf("me-class-%d-instance-%d-not-present", classID, meInstance)
 	}
 	if sequenceNo > 0 {
@@ -630,8 +631,8 @@
 			// Clear this alarm if It is cleared now, in that case IsAlarmClear would return true
 			cleared, err := msg.IsAlarmClear(alarmNo)
 			if err != nil {
-				logger.Warnw(ctx, "unable-to-find-out-alarm-is-cleared", log.Fields{"class-id": classID,
-					"instance-id": meInstance, "alarm-no": alarmNo})
+				logger.Warnw(ctx, "unable-to-find-out-alarm-is-cleared", log.Fields{"device-id": am.deviceID,
+					"class-id": classID, "instance-id": meInstance, "alarm-no": alarmNo})
 				return err
 			}
 			if cleared {
@@ -643,8 +644,8 @@
 			// or not, if yes then raise it.
 			raised, err := msg.IsAlarmActive(alarmNo)
 			if err != nil {
-				logger.Warnw(ctx, "unable-to-find-out-alarm-is-raised", log.Fields{"class-id": classID,
-					"instance-id": meInstance, "alarm-no": alarmNo})
+				logger.Warnw(ctx, "unable-to-find-out-alarm-is-raised", log.Fields{"device-id": am.deviceID,
+					"class-id": classID, "instance-id": meInstance, "alarm-no": alarmNo})
 				return err
 			}
 			if raised {
@@ -694,7 +695,7 @@
 		intfID = am.pDeviceHandler.GetPonPortNumber()
 		return intfID
 	} else {
-		logger.Warnw(ctx, "me-not-supported", log.Fields{"class-id": classID, "instance-id": instanceID})
+		logger.Warnw(ctx, "me-not-supported", log.Fields{"device-id": am.deviceID, "class-id": classID, "instance-id": instanceID})
 	}
 	return nil
 }
diff --git a/internal/pkg/avcfg/omci_vlan_config.go b/internal/pkg/avcfg/omci_vlan_config.go
index dd066b7..109ff30 100755
--- a/internal/pkg/avcfg/omci_vlan_config.go
+++ b/internal/pkg/avcfg/omci_vlan_config.go
@@ -1977,7 +1977,8 @@
 	case omci.CreateResponseType:
 		{ // had to shift that to a method to cope with StaticCodeAnalysis restrictions :-(
 			if err := oFsm.handleOmciCreateResponseMessage(ctx, msg.OmciPacket); err != nil {
-				logger.Warnw(ctx, "CreateResponse handling aborted", log.Fields{"err": err})
+				logger.Warnw(ctx, "CreateResponse handling aborted",
+					log.Fields{"device-id": oFsm.deviceID, "err": err})
 				return
 			}
 		} //CreateResponseType
@@ -2028,7 +2029,8 @@
 	case omci.DeleteResponseType:
 		{ // had to shift that to a method to cope with StaticCodeAnalysis restrictions :-(
 			if err := oFsm.handleOmciDeleteResponseMessage(ctx, msg.OmciPacket); err != nil {
-				logger.Warnw(ctx, "DeleteResponse handling aborted", log.Fields{"err": err})
+				logger.Warnw(ctx, "DeleteResponse handling aborted",
+					log.Fields{"device-id": oFsm.deviceID, "err": err})
 				return
 			}
 		} //DeleteResponseType
diff --git a/internal/pkg/avcfg/onu_uni_tp.go b/internal/pkg/avcfg/onu_uni_tp.go
index c51c489..229bccc 100755
--- a/internal/pkg/avcfg/onu_uni_tp.go
+++ b/internal/pkg/avcfg/onu_uni_tp.go
@@ -449,7 +449,7 @@
 			isMulticast, err = strconv.ParseBool(downstreamContent.IsMulticast)
 			if err != nil {
 				logger.Errorw(ctx, "multicast-error-config-unknown-flag-in-technology-profile",
-					log.Fields{"UniTpKey": uniTPKey, "downstream-gem": downstreamContent, "error": err})
+					log.Fields{"device-id": onuTP.deviceID, "UniTpKey": uniTPKey, "downstream-gem": downstreamContent, "error": err})
 				continue
 			}
 		}
@@ -459,8 +459,8 @@
 			_, existing := onuTP.mapPonAniConfig[uniTPKey].mapGemPortParams[mcastGemID]
 			if existing {
 				//GEM port was previously configured, avoid setting multicast attributes
-				logger.Errorw(ctx, "multicast-error-config-existing-gem-port-config", log.Fields{"UniTpKey": uniTPKey,
-					"downstream-gem": downstreamContent, "key": mcastGemID})
+				logger.Errorw(ctx, "multicast-error-config-existing-gem-port-config", log.Fields{"device-id": onuTP.deviceID,
+					"UniTpKey": uniTPKey, "downstream-gem": downstreamContent, "key": mcastGemID})
 				continue
 			} else {
 				//GEM port is not configured, setting multicast attributes
@@ -869,7 +869,7 @@
 		//FSM init requirement to get informed about FSM completion! (otherwise timeout of the TechProf config)
 		onuTP.PAniConfigFsm[uniTpKey].setFsmCompleteChannel(onuTP.chTpConfigProcessingStep, aProcessingStep)
 		if err := pACStatemachine.Event(aEvent); err != nil {
-			logger.Errorw(ctx, "AniConfigFSM: can't trigger event", log.Fields{"err": err})
+			logger.Errorw(ctx, "AniConfigFSM: can't trigger event", log.Fields{"device-id": onuTP.deviceID, "err": err})
 			return fmt.Errorf("can't trigger event in AniConfigFSM: %s", onuTP.deviceID)
 		}
 		/***** AniConfigFSM event notified */
diff --git a/internal/pkg/common/omci_cc.go b/internal/pkg/common/omci_cc.go
index d11173f..463bc06 100755
--- a/internal/pkg/common/omci_cc.go
+++ b/internal/pkg/common/omci_cc.go
@@ -629,7 +629,7 @@
 	}
 	sendErr := oo.pBaseDeviceHandler.SendOMCIRequest(ctx, oo.pBaseDeviceHandler.GetProxyAddress().AdapterEndpoint, omciMsg)
 	if sendErr != nil {
-		logger.Errorw(ctx, "send omci request error", log.Fields{"ChildId": oo.deviceID, "error": sendErr})
+		logger.Errorw(ctx, "send omci request error", log.Fields{"device-id": oo.deviceID, "ChildId": oo.deviceID, "error": sendErr})
 		return sendErr
 	}
 	return nil
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 920802a..a442ab8 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -406,7 +406,8 @@
 	uniID := uint8(techProfMsg.UniId)
 	tpID, err := cmn.GetTpIDFromTpPath(techProfMsg.TpInstancePath)
 	if err != nil {
-		logger.Errorw(ctx, "error-parsing-tpid-from-tppath", log.Fields{"err": err, "tp-path": techProfMsg.TpInstancePath})
+		logger.Errorw(ctx, "error-parsing-tpid-from-tppath",
+			log.Fields{"device-id": dh.DeviceID, "err": err, "tp-path": techProfMsg.TpInstancePath})
 		return err
 	}
 	logger.Debugw(ctx, "unmarshal-techprof-msg-body", log.Fields{"device-id": dh.DeviceID,
@@ -4354,7 +4355,8 @@
 	logger.Debugw(subCtx, "send-omci-request", log.Fields{"request": request, "parent-endpoint": parentEndpoint})
 	_, err = pgClient.ProxyOmciRequests(subCtx, request)
 	if err != nil {
-		logger.Errorw(ctx, "omci-failure", log.Fields{"request": request, "error": err, "request-parent": request.ParentDeviceId, "request-child": request.ChildDeviceId, "request-proxy": request.ProxyAddress})
+		logger.Errorw(ctx, "omci-failure", log.Fields{"device-id": dh.device.Id, "request": request, "error": err,
+			"request-parent": request.ParentDeviceId, "request-child": request.ChildDeviceId, "request-proxy": request.ProxyAddress})
 	}
 	return err
 }
diff --git a/internal/pkg/core/openonu.go b/internal/pkg/core/openonu.go
index 890b92d..60d2f81 100755
--- a/internal/pkg/core/openonu.go
+++ b/internal/pkg/core/openonu.go
@@ -628,12 +628,12 @@
 					vendorID = onuVolthaDevice.VendorId
 					imageIdentifier = vendorID + imageIdentifier //head on vendor ID of the ONU
 					vendorIDSet = true
-					logger.Debugw(ctx, "status request for image", log.Fields{"image-id": imageIdentifier})
+					logger.Debugw(ctx, "status request for image", log.Fields{"device-id": loDeviceID, "image-id": imageIdentifier})
 				} else {
 					//for all following devices verify the matching vendorID
 					if onuVolthaDevice.VendorId != vendorID {
 						logger.Warnw(ctx, "onu vendor id does not match image vendor id, device ignored",
-							log.Fields{"onu-vendor-id": onuVolthaDevice.VendorId, "image-vendor-id": vendorID})
+							log.Fields{"device-id": loDeviceID, "onu-vendor-id": onuVolthaDevice.VendorId, "image-vendor-id": vendorID})
 					} else {
 						vendorIDSet = true
 					}
@@ -701,12 +701,12 @@
 					vendorID = onuVolthaDevice.VendorId
 					vendorIDSet = true
 					imageIdentifier = vendorID + imageIdentifier //head on vendor ID of the ONU
-					logger.Debugw(ctx, "abort request for file", log.Fields{"image-id": imageIdentifier})
+					logger.Debugw(ctx, "abort request for file", log.Fields{"device-id": loDeviceID, "image-id": imageIdentifier})
 				} else {
 					//for all following devices verify the matching vendorID
 					if onuVolthaDevice.VendorId != vendorID {
 						logger.Warnw(ctx, "onu vendor id does not match image vendor id, device ignored",
-							log.Fields{"onu-vendor-id": onuVolthaDevice.VendorId, "image-vendor-id": vendorID})
+							log.Fields{"device-id": loDeviceID, "onu-vendor-id": onuVolthaDevice.VendorId, "image-vendor-id": vendorID})
 						pDeviceImageState.DeviceId = loDeviceID
 						pDeviceImageState.ImageState.Version = (*in).Version
 						pDeviceImageState.ImageState.DownloadState = voltha.ImageState_DOWNLOAD_UNKNOWN
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index 595228e..4fd5ebb 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -870,7 +870,7 @@
 		_ = oo.handleOmciGetResponseMessage(ctx, msg)
 
 	default:
-		logger.Warnw(ctx, "Unknown Message Type", log.Fields{"msgType": msg.OmciMsg.MessageType})
+		logger.Warnw(ctx, "Unknown Message Type", log.Fields{"device-id": oo.deviceID, "msgType": msg.OmciMsg.MessageType})
 
 	}
 }
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index cb50e75..bed9b77 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -495,7 +495,7 @@
 
 //Relay the InSync message via Handler to Rw core - Status update
 func (oo *OnuDeviceEntry) transferSystemEvent(ctx context.Context, devEvent cmn.OnuDeviceEvent) {
-	logger.Debugw(ctx, "relaying system-event", log.Fields{"Event": devEvent})
+	logger.Debugw(ctx, "relaying system-event", log.Fields{"device-id": oo.deviceID, "Event": devEvent})
 	// decouple the handler transfer from further processing here
 	// TODO!!! check if really no synch is required within the system e.g. to ensure following steps ..
 	if devEvent == cmn.MibDatabaseSync {
@@ -504,17 +504,20 @@
 			go oo.baseDeviceHandler.DeviceProcStatusUpdate(ctx, devEvent)
 			//TODO!!! device control: next step: start MIB capability verification from here ?!!!
 		} else {
-			logger.Debugw(ctx, "mibinsync-event in some already synced state - ignored", log.Fields{"state": oo.devState})
+			logger.Debugw(ctx, "mibinsync-event in some already synced state - ignored",
+				log.Fields{"device-id": oo.deviceID, "state": oo.devState})
 		}
 	} else if devEvent == cmn.MibDownloadDone {
 		if oo.devState < cmn.MibDownloadDone { //devState has not been synced yet
 			oo.devState = cmn.MibDownloadDone
 			go oo.baseDeviceHandler.DeviceProcStatusUpdate(ctx, devEvent)
 		} else {
-			logger.Debugw(ctx, "mibdownloaddone-event was already seen - ignored", log.Fields{"state": oo.devState})
+			logger.Debugw(ctx, "mibdownloaddone-event was already seen - ignored",
+				log.Fields{"device-id": oo.deviceID, "state": oo.devState})
 		}
 	} else {
-		logger.Warnw(ctx, "device-event not yet handled", log.Fields{"state": devEvent})
+		logger.Warnw(ctx, "device-event not yet handled",
+			log.Fields{"device-id": oo.deviceID, "state": devEvent})
 	}
 }
 
diff --git a/internal/pkg/pmmgr/onu_metrics_manager.go b/internal/pkg/pmmgr/onu_metrics_manager.go
index b67f455..2271864 100755
--- a/internal/pkg/pmmgr/onu_metrics_manager.go
+++ b/internal/pkg/pmmgr/onu_metrics_manager.go
@@ -382,7 +382,7 @@
 	}
 	// restore data from KV store
 	if err := metricsManager.restorePmData(ctx); err != nil {
-		logger.Errorw(ctx, "error restoring pm data", log.Fields{"err": err})
+		logger.Errorw(ctx, "error restoring pm data", log.Fields{"device-id": metricsManager.deviceID, "err": err})
 		// we continue given that it does not effect the actual services for the ONU,
 		// but there may be some negative effect on PM collection (there may be some mismatch in
 		// the actual PM config and what is present on the device).
@@ -1019,7 +1019,7 @@
 	ke.Ts = float64(ts)
 
 	if err := mm.pDeviceHandler.GetEventProxy().SendKpiEvent(ctx, "STATS_PUBLISH_EVENT", &ke, voltha.EventCategory_EQUIPMENT, voltha.EventSubCategory_ONU, ts); err != nil {
-		logger.Errorw(ctx, "failed-to-send-pon-stats", log.Fields{"err": err})
+		logger.Errorw(ctx, "failed-to-send-pon-stats", log.Fields{"device-id": mm.deviceID, "err": err})
 	}
 }
 
@@ -1075,7 +1075,7 @@
 	case omci.SetResponseType:
 		_ = mm.handleOmciSetResponseMessage(ctx, msg)
 	default:
-		logger.Warnw(ctx, "Unknown Message Type", log.Fields{"msgType": msg.OmciMsg.MessageType})
+		logger.Warnw(ctx, "Unknown Message Type", log.Fields{"device-id": mm.deviceID, "msgType": msg.OmciMsg.MessageType})
 
 	}
 }
@@ -2656,7 +2656,7 @@
 			mm.GroupMetricMap[g.GroupName].metricMap = GemPortHistory
 			mm.GroupMetricMap[g.GroupName].IsL2PMCounter = true
 		default:
-			logger.Errorw(ctx, "unhandled-group-name", log.Fields{"groupName": g.GroupName})
+			logger.Errorw(ctx, "unhandled-group-name", log.Fields{"device-id": mm.deviceID, "groupName": g.GroupName})
 		}
 	}
 
@@ -2670,7 +2670,7 @@
 		switch m.Name {
 		// None exist as of now. Add when available.
 		default:
-			logger.Errorw(ctx, "unhandled-metric-name", log.Fields{"metricName": m.Name})
+			logger.Errorw(ctx, "unhandled-metric-name", log.Fields{"device-id": mm.deviceID, "metricName": m.Name})
 		}
 	}
 }
@@ -2876,15 +2876,18 @@
 
 	Value, err := json.Marshal(*pmMEData)
 	if err != nil {
-		logger.Errorw(ctx, "unable to marshal PM data", log.Fields{"groupName": groupName, "pmAction": pmAction, "pmData": *pmMEData, "err": err})
+		logger.Errorw(ctx, "unable to marshal PM data", log.Fields{"device-id": mm.deviceID,
+			"groupName": groupName, "pmAction": pmAction, "pmData": *pmMEData, "err": err})
 		return err
 	}
 	// Update back to kv store
 	if err = mm.pmKvStore.Put(ctx, groupName, Value); err != nil {
-		logger.Errorw(ctx, "unable to put PM data to kv store", log.Fields{"groupName": groupName, "pmData": *pmMEData, "pmAction": pmAction, "err": err})
+		logger.Errorw(ctx, "unable to put PM data to kv store", log.Fields{"device-id": mm.deviceID,
+			"groupName": groupName, "pmData": *pmMEData, "pmAction": pmAction, "err": err})
 		return err
 	}
-	logger.Debugw(ctx, "updatePmData - success", log.Fields{"device-id": mm.deviceID, "groupName": groupName, "pmData": *pmMEData, "pmAction": pmAction})
+	logger.Debugw(ctx, "updatePmData - success", log.Fields{"device-id": mm.deviceID,
+		"groupName": groupName, "pmData": *pmMEData, "pmAction": pmAction})
 
 	return nil
 }
@@ -3112,10 +3115,10 @@
 	}
 	classSupported, err := json.Marshal(mm.supportedEthernetFrameExtendedPMClass)
 	if err != nil {
-		logger.Errorw(ctx, "unable-to-marshal-data", log.Fields{"err": err})
+		logger.Errorw(ctx, "unable-to-marshal-data", log.Fields{"device-id": mm.deviceID, "err": err})
 	}
 	if err := mm.extPmKvStore.Put(ctx, key, classSupported); err != nil {
-		logger.Errorw(ctx, "unable-to-add-data-in-db", log.Fields{"err": err})
+		logger.Errorw(ctx, "unable-to-add-data-in-db", log.Fields{"device-id": mm.deviceID, "err": err})
 	}
 }
 
diff --git a/internal/pkg/uniprt/uniportadmin.go b/internal/pkg/uniprt/uniportadmin.go
index 2a0a2c9..742c707 100755
--- a/internal/pkg/uniprt/uniportadmin.go
+++ b/internal/pkg/uniprt/uniportadmin.go
@@ -373,7 +373,8 @@
 		}
 		logger.Debugw(ctx, "LockStateFsm SetResponse Data", log.Fields{"device-id": oFsm.deviceID, "data-fields": msgObj})
 		if msgObj.Result != me.Success {
-			logger.Errorw(ctx, "LockStateFsm - Omci SetResponse Error - later: drive FSM to abort state ?", log.Fields{"Error": msgObj.Result})
+			logger.Errorw(ctx, "LockStateFsm - Omci SetResponse Error - later: drive FSM to abort state ?",
+				log.Fields{"Error": msgObj.Result, "EntityClass": msgObj.EntityClass, "EntityInstance": msgObj.EntityInstance, "device-id": oFsm.deviceID})
 			// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
 			return
 		}
@@ -417,7 +418,7 @@
 			return
 		}
 	} else {
-		logger.Errorw(ctx, "LockStateFsm - Rx OMCI unhandled MsgType", log.Fields{"omciMsgType": msg.OmciMsg.MessageType})
+		logger.Errorw(ctx, "LockStateFsm - Rx OMCI unhandled MsgType", log.Fields{"device-id": oFsm.deviceID, "omciMsgType": msg.OmciMsg.MessageType})
 		return
 	}
 }