VOL-3434 Added SCA Fixes

Change-Id: I405780cef6de3e2d287dbafa6ddd968caaa72dac
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 91b794c..ae7a593 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -218,6 +218,184 @@
 
 }
 
+func (dh *DeviceHandler) processInterAdapterOMCIReqMessage(msg *ic.InterAdapterMessage) error {
+	msgBody := msg.GetBody()
+	omciMsg := &ic.InterAdapterOmciMessage{}
+	if err := ptypes.UnmarshalAny(msgBody, omciMsg); err != nil {
+		logger.Warnw("cannot-unmarshal-omci-msg-body", log.Fields{
+			"device-id": dh.deviceID, "error": err})
+		return err
+	}
+
+	//assuming omci message content is hex coded!
+	// with restricted output of 16(?) bytes would be ...omciMsg.Message[:16]
+	logger.Debugw("inter-adapter-recv-omci", log.Fields{
+		"device-id": dh.deviceID, "RxOmciMessage": hex.EncodeToString(omciMsg.Message)})
+	//receive_message(omci_msg.message)
+	pDevEntry := dh.GetOnuDeviceEntry(true)
+	if pDevEntry != nil {
+		return pDevEntry.PDevOmciCC.ReceiveMessage(context.TODO(), omciMsg.Message)
+	}
+	logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
+	return errors.New("no valid OnuDevice")
+}
+
+func (dh *DeviceHandler) processInterAdapterONUIndReqMessage(msg *ic.InterAdapterMessage) error {
+	msgBody := msg.GetBody()
+	onuIndication := &oop.OnuIndication{}
+	if err := ptypes.UnmarshalAny(msgBody, onuIndication); err != nil {
+		logger.Warnw("cannot-unmarshal-onu-indication-msg-body", log.Fields{
+			"device-id": dh.deviceID, "error": err})
+		return err
+	}
+
+	onuOperstate := onuIndication.GetOperState()
+	logger.Debugw("inter-adapter-recv-onu-ind", log.Fields{"OnuId": onuIndication.GetOnuId(),
+		"AdminState": onuIndication.GetAdminState(), "OperState": onuOperstate,
+		"SNR": onuIndication.GetSerialNumber()})
+
+	//interface related functions might be error checked ....
+	if onuOperstate == "up" {
+		_ = dh.createInterface(onuIndication)
+	} else if (onuOperstate == "down") || (onuOperstate == "unreachable") {
+		_ = dh.updateInterface(onuIndication)
+	} else {
+		logger.Errorw("unknown-onu-indication operState", log.Fields{"OnuId": onuIndication.GetOnuId()})
+		return errors.New("invalidOperState")
+	}
+	return nil
+}
+
+func (dh *DeviceHandler) processInterAdapterTechProfileDownloadReqMessage(
+	msg *ic.InterAdapterMessage) error {
+	if dh.pOnuTP == nil {
+		//should normally not happen ...
+		logger.Warnw("onuTechProf instance not set up for DLMsg request - ignoring request",
+			log.Fields{"device-id": dh.deviceID})
+		return errors.New("techProfile DLMsg request while onuTechProf instance not setup")
+	}
+	if (dh.deviceReason == "stopping-openomci") || (dh.deviceReason == "omci-admin-lock") {
+		// I've seen cases for this request, where the device was already stopped
+		logger.Warnw("TechProf stopped: device-unreachable", log.Fields{"device-id": dh.deviceID})
+		return errors.New("device-unreachable")
+	}
+
+	msgBody := msg.GetBody()
+	techProfMsg := &ic.InterAdapterTechProfileDownloadMessage{}
+	if err := ptypes.UnmarshalAny(msgBody, techProfMsg); err != nil {
+		logger.Warnw("cannot-unmarshal-techprof-msg-body", log.Fields{
+			"device-id": dh.deviceID, "error": err})
+		return err
+	}
+
+	// we have to lock access to TechProfile processing based on different messageType calls or
+	// even to fast subsequent calls of the same messageType
+	dh.pOnuTP.lockTpProcMutex()
+	// lock hangs as long as below decoupled or other related TechProfile processing is active
+	if bTpModify := dh.pOnuTP.updateOnuUniTpPath(techProfMsg.UniId, techProfMsg.Path); bTpModify {
+		//	if there has been some change for some uni TechProfilePath
+		//in order to allow concurrent calls to other dh instances we do not wait for execution here
+		//but doing so we can not indicate problems to the caller (who does what with that then?)
+		//by now we just assume straightforward successful execution
+		//TODO!!! Generally: In this scheme it would be good to have some means to indicate
+		//  possible problems to the caller later autonomously
+
+		// deadline context to ensure completion of background routines waited for
+		//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
+		deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
+		dctx, cancel := context.WithDeadline(context.Background(), deadline)
+
+		dh.pOnuTP.resetProcessingErrorIndication()
+		var wg sync.WaitGroup
+		wg.Add(2) // for the 2 go routines to finish
+		// attention: deadline completion check and wg.Done is to be done in both routines
+		go dh.pOnuTP.configureUniTp(dctx, uint8(techProfMsg.UniId), techProfMsg.Path, &wg)
+		go dh.pOnuTP.updateOnuTpPathKvStore(dctx, &wg)
+		//the wait.. function is responsible for tpProcMutex.Unlock()
+		err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collect their result
+		return err
+	}
+	// no change, nothing really to do
+	dh.pOnuTP.unlockTpProcMutex()
+	//return success
+	return nil
+}
+
+func (dh *DeviceHandler) processInterAdapterDeleteGemPortReqMessage(
+	msg *ic.InterAdapterMessage) error {
+
+	if dh.pOnuTP == nil {
+		//should normally not happen ...
+		logger.Warnw("onuTechProf instance not set up for DelGem request - ignoring request",
+			log.Fields{"device-id": dh.deviceID})
+		return errors.New("techProfile DelGem request while onuTechProf instance not setup")
+	}
+
+	msgBody := msg.GetBody()
+	delGemPortMsg := &ic.InterAdapterDeleteGemPortMessage{}
+	if err := ptypes.UnmarshalAny(msgBody, delGemPortMsg); err != nil {
+		logger.Warnw("cannot-unmarshal-delete-gem-msg-body", log.Fields{
+			"device-id": dh.deviceID, "error": err})
+		return err
+	}
+
+	//compare TECH_PROFILE_DOWNLOAD_REQUEST
+	dh.pOnuTP.lockTpProcMutex()
+
+	// deadline context to ensure completion of background routines waited for
+	deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
+	dctx, cancel := context.WithDeadline(context.Background(), deadline)
+
+	dh.pOnuTP.resetProcessingErrorIndication()
+	var wg sync.WaitGroup
+	wg.Add(1) // for the 1 go routine to finish
+	go dh.pOnuTP.deleteTpResource(dctx, delGemPortMsg.UniId, delGemPortMsg.TpPath,
+		cResourceGemPort, delGemPortMsg.GemPortId, &wg)
+	//the wait.. function is responsible for tpProcMutex.Unlock()
+	err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
+	return err
+}
+
+func (dh *DeviceHandler) processInterAdapterDeleteTcontReqMessage(
+	msg *ic.InterAdapterMessage) error {
+	if dh.pOnuTP == nil {
+		//should normally not happen ...
+		logger.Warnw("onuTechProf instance not set up for DelTcont request - ignoring request",
+			log.Fields{"device-id": dh.deviceID})
+		return errors.New("techProfile DelTcont request while onuTechProf instance not setup")
+	}
+
+	msgBody := msg.GetBody()
+	delTcontMsg := &ic.InterAdapterDeleteTcontMessage{}
+	if err := ptypes.UnmarshalAny(msgBody, delTcontMsg); err != nil {
+		logger.Warnw("cannot-unmarshal-delete-tcont-msg-body", log.Fields{
+			"device-id": dh.deviceID, "error": err})
+		return err
+	}
+
+	//compare TECH_PROFILE_DOWNLOAD_REQUEST
+	dh.pOnuTP.lockTpProcMutex()
+	if bTpModify := dh.pOnuTP.updateOnuUniTpPath(delTcontMsg.UniId, ""); bTpModify {
+		// deadline context to ensure completion of background routines waited for
+		deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
+		dctx, cancel := context.WithDeadline(context.Background(), deadline)
+
+		dh.pOnuTP.resetProcessingErrorIndication()
+		var wg sync.WaitGroup
+		wg.Add(2) // for the 2 go routines to finish
+		go dh.pOnuTP.deleteTpResource(dctx, delTcontMsg.UniId, delTcontMsg.TpPath,
+			cResourceTcont, delTcontMsg.AllocId, &wg)
+		// Removal of the tcont/alloc id mapping represents the removal of the tech profile
+		go dh.pOnuTP.updateOnuTpPathKvStore(dctx, &wg)
+		//the wait.. function is responsible for tpProcMutex.Unlock()
+		err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
+		return err
+	}
+	dh.pOnuTP.unlockTpProcMutex()
+	//return success
+	return nil
+}
+
 //ProcessInterAdapterMessage sends the proxied messages to the target device
 // If the proxy address is not found in the unmarshalled message, it first fetches the onu device for which the message
 // is meant, and then send the unmarshalled omci message to this onu
@@ -234,176 +412,24 @@
 	switch msgType {
 	case ic.InterAdapterMessageType_OMCI_REQUEST:
 		{
-			msgBody := msg.GetBody()
-			omciMsg := &ic.InterAdapterOmciMessage{}
-			if err := ptypes.UnmarshalAny(msgBody, omciMsg); err != nil {
-				logger.Warnw("cannot-unmarshal-omci-msg-body", log.Fields{
-					"device-id": dh.deviceID, "error": err})
-				return err
-			}
-
-			//assuming omci message content is hex coded!
-			// with restricted output of 16(?) bytes would be ...omciMsg.Message[:16]
-			logger.Debugw("inter-adapter-recv-omci", log.Fields{
-				"device-id": dh.deviceID, "RxOmciMessage": hex.EncodeToString(omciMsg.Message)})
-			//receive_message(omci_msg.message)
-			pDevEntry := dh.GetOnuDeviceEntry(true)
-			if pDevEntry != nil {
-				return pDevEntry.PDevOmciCC.ReceiveMessage(context.TODO(), omciMsg.Message)
-			}
-			logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
-			return errors.New("no valid OnuDevice")
+			return dh.processInterAdapterOMCIReqMessage(msg)
 		}
 	case ic.InterAdapterMessageType_ONU_IND_REQUEST:
 		{
-			msgBody := msg.GetBody()
-			onuIndication := &oop.OnuIndication{}
-			if err := ptypes.UnmarshalAny(msgBody, onuIndication); err != nil {
-				logger.Warnw("cannot-unmarshal-onu-indication-msg-body", log.Fields{
-					"device-id": dh.deviceID, "error": err})
-				return err
-			}
-
-			onuOperstate := onuIndication.GetOperState()
-			logger.Debugw("inter-adapter-recv-onu-ind", log.Fields{"OnuId": onuIndication.GetOnuId(),
-				"AdminState": onuIndication.GetAdminState(), "OperState": onuOperstate,
-				"SNR": onuIndication.GetSerialNumber()})
-
-			//interface related functions might be error checked ....
-			if onuOperstate == "up" {
-				_ = dh.createInterface(onuIndication)
-			} else if (onuOperstate == "down") || (onuOperstate == "unreachable") {
-				_ = dh.updateInterface(onuIndication)
-			} else {
-				logger.Errorw("unknown-onu-indication operState", log.Fields{"OnuId": onuIndication.GetOnuId()})
-				return errors.New("invalidOperState")
-			}
+			return dh.processInterAdapterONUIndReqMessage(msg)
 		}
 	case ic.InterAdapterMessageType_TECH_PROFILE_DOWNLOAD_REQUEST:
 		{
-			if dh.pOnuTP == nil {
-				//should normally not happen ...
-				logger.Warnw("onuTechProf instance not set up for DLMsg request - ignoring request",
-					log.Fields{"device-id": dh.deviceID})
-				return errors.New("techProfile DLMsg request while onuTechProf instance not setup")
-			}
-			if (dh.deviceReason == "stopping-openomci") || (dh.deviceReason == "omci-admin-lock") {
-				// I've seen cases for this request, where the device was already stopped
-				logger.Warnw("TechProf stopped: device-unreachable", log.Fields{"device-id": dh.deviceID})
-				return errors.New("device-unreachable")
-			}
-
-			msgBody := msg.GetBody()
-			techProfMsg := &ic.InterAdapterTechProfileDownloadMessage{}
-			if err := ptypes.UnmarshalAny(msgBody, techProfMsg); err != nil {
-				logger.Warnw("cannot-unmarshal-techprof-msg-body", log.Fields{
-					"device-id": dh.deviceID, "error": err})
-				return err
-			}
-
-			// we have to lock access to TechProfile processing based on different messageType calls or
-			// even to fast subsequent calls of the same messageType
-			dh.pOnuTP.lockTpProcMutex()
-			// lock hangs as long as below decoupled or other related TechProfile processing is active
-			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(techProfMsg.UniId, techProfMsg.Path); bTpModify {
-				//	if there has been some change for some uni TechProfilePath
-				//in order to allow concurrent calls to other dh instances we do not wait for execution here
-				//but doing so we can not indicate problems to the caller (who does what with that then?)
-				//by now we just assume straightforward successful execution
-				//TODO!!! Generally: In this scheme it would be good to have some means to indicate
-				//  possible problems to the caller later autonomously
-
-				// deadline context to ensure completion of background routines waited for
-				//20200721: 10s proved to be less in 8*8 ONU test on local vbox machine with debug, might be further adapted
-				deadline := time.Now().Add(30 * time.Second) //allowed run time to finish before execution
-				dctx, cancel := context.WithDeadline(context.Background(), deadline)
-
-				dh.pOnuTP.resetProcessingErrorIndication()
-				var wg sync.WaitGroup
-				wg.Add(2) // for the 2 go routines to finish
-				// attention: deadline completion check and wg.Done is to be done in both routines
-				go dh.pOnuTP.configureUniTp(dctx, uint8(techProfMsg.UniId), techProfMsg.Path, &wg)
-				go dh.pOnuTP.updateOnuTpPathKvStore(dctx, &wg)
-				//the wait.. function is responsible for tpProcMutex.Unlock()
-				err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collect their result
-				return err
-			}
-			// no change, nothing really to do
-			dh.pOnuTP.unlockTpProcMutex()
-			//return success
-			return nil
+			return dh.processInterAdapterTechProfileDownloadReqMessage(msg)
 		}
 	case ic.InterAdapterMessageType_DELETE_GEM_PORT_REQUEST:
 		{
-			if dh.pOnuTP == nil {
-				//should normally not happen ...
-				logger.Warnw("onuTechProf instance not set up for DelGem request - ignoring request",
-					log.Fields{"device-id": dh.deviceID})
-				return errors.New("techProfile DelGem request while onuTechProf instance not setup")
-			}
+			return dh.processInterAdapterDeleteGemPortReqMessage(msg)
 
-			msgBody := msg.GetBody()
-			delGemPortMsg := &ic.InterAdapterDeleteGemPortMessage{}
-			if err := ptypes.UnmarshalAny(msgBody, delGemPortMsg); err != nil {
-				logger.Warnw("cannot-unmarshal-delete-gem-msg-body", log.Fields{
-					"device-id": dh.deviceID, "error": err})
-				return err
-			}
-
-			//compare TECH_PROFILE_DOWNLOAD_REQUEST
-			dh.pOnuTP.lockTpProcMutex()
-
-			// deadline context to ensure completion of background routines waited for
-			deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
-			dctx, cancel := context.WithDeadline(context.Background(), deadline)
-
-			dh.pOnuTP.resetProcessingErrorIndication()
-			var wg sync.WaitGroup
-			wg.Add(1) // for the 1 go routine to finish
-			go dh.pOnuTP.deleteTpResource(dctx, delGemPortMsg.UniId, delGemPortMsg.TpPath,
-				cResourceGemPort, delGemPortMsg.GemPortId, &wg)
-			//the wait.. function is responsible for tpProcMutex.Unlock()
-			err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
-			return err
 		}
 	case ic.InterAdapterMessageType_DELETE_TCONT_REQUEST:
 		{
-			if dh.pOnuTP == nil {
-				//should normally not happen ...
-				logger.Warnw("onuTechProf instance not set up for DelTcont request - ignoring request",
-					log.Fields{"device-id": dh.deviceID})
-				return errors.New("techProfile DelTcont request while onuTechProf instance not setup")
-			}
-
-			msgBody := msg.GetBody()
-			delTcontMsg := &ic.InterAdapterDeleteTcontMessage{}
-			if err := ptypes.UnmarshalAny(msgBody, delTcontMsg); err != nil {
-				logger.Warnw("cannot-unmarshal-delete-tcont-msg-body", log.Fields{
-					"device-id": dh.deviceID, "error": err})
-				return err
-			}
-
-			//compare TECH_PROFILE_DOWNLOAD_REQUEST
-			dh.pOnuTP.lockTpProcMutex()
-			if bTpModify := dh.pOnuTP.updateOnuUniTpPath(delTcontMsg.UniId, ""); bTpModify {
-				// deadline context to ensure completion of background routines waited for
-				deadline := time.Now().Add(10 * time.Second) //allowed run time to finish before execution
-				dctx, cancel := context.WithDeadline(context.Background(), deadline)
-
-				dh.pOnuTP.resetProcessingErrorIndication()
-				var wg sync.WaitGroup
-				wg.Add(2) // for the 2 go routines to finish
-				go dh.pOnuTP.deleteTpResource(dctx, delTcontMsg.UniId, delTcontMsg.TpPath,
-					cResourceTcont, delTcontMsg.AllocId, &wg)
-				// Removal of the tcont/alloc id mapping represents the removal of the tech profile
-				go dh.pOnuTP.updateOnuTpPathKvStore(dctx, &wg)
-				//the wait.. function is responsible for tpProcMutex.Unlock()
-				err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
-				return err
-			}
-			dh.pOnuTP.unlockTpProcMutex()
-			//return success
-			return nil
+			return dh.processInterAdapterDeleteTcontReqMessage(msg)
 		}
 	default:
 		{
@@ -412,7 +438,6 @@
 			return errors.New("unimplemented")
 		}
 	}
-	return nil
 }
 
 //FlowUpdateIncremental removes and/or adds the flow changes on a given device
@@ -568,7 +593,7 @@
 		var wg sync.WaitGroup
 		wg.Add(1) // for the 1 go routines to finish
 		// attention: deadline completion check and wg.Done is to be done in both routines
-		go dh.pOnuTP.configureUniTp(dctx, uint8(uniData.PersUniId), uniData.PersTpPath, &wg)
+		go dh.pOnuTP.configureUniTp(dctx, uint8(uniData.PersUniID), uniData.PersTpPath, &wg)
 		//the wait.. function is responsible for tpProcMutex.Unlock()
 		_ = dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collect their result
 		return
@@ -1143,9 +1168,9 @@
 				}
 				for _, uniPort := range dh.uniEntityMap {
 					//reset the TechProfileConfig Done state for all (active) UNI's
-					dh.pOnuTP.setConfigDone(uniPort.uniId, false)
-					// reset tjhe possibly existing VlanConfigFsm
-					if pVlanFilterFsm, exist := dh.UniVlanConfigFsmMap[uniPort.uniId]; exist {
+					dh.pOnuTP.setConfigDone(uniPort.uniID, false)
+					// reset the possibly existing VlanConfigFsm
+					if pVlanFilterFsm, exist := dh.UniVlanConfigFsmMap[uniPort.uniID]; exist {
 						//VlanFilterFsm exists and was already started
 						pVlanFilterStatemachine := pVlanFilterFsm.pAdaptFsm.pFsm
 						if pVlanFilterStatemachine != nil {
@@ -1199,197 +1224,221 @@
 	return nil
 }
 
+func (dh *DeviceHandler) processMibDatabaseSyncEvent(devEvent OnuDeviceEvent) {
+	logger.Debugw("MibInSync event received", log.Fields{"device-id": dh.deviceID})
+	if !dh.reconciling {
+		//initiate DevStateUpdate
+		if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "discovery-mibsync-complete"); err != nil {
+			//TODO with VOL-3045/VOL-3046: return the error and stop further processing
+			logger.Errorw("error-DeviceReasonUpdate to 'mibsync-complete'", log.Fields{
+				"device-id": dh.deviceID, "error": err})
+		} else {
+			logger.Infow("dev reason updated to 'MibSync complete'", log.Fields{"deviceID": dh.deviceID})
+		}
+	} else {
+		logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to mibsync-complete",
+			log.Fields{"device-id": dh.deviceID})
+	}
+	//set internal state anyway - as it was done
+	dh.deviceReason = "discovery-mibsync-complete"
+
+	i := uint8(0) //UNI Port limit: see MaxUnisPerOnu (by now 16) (OMCI supports max 255 p.b.)
+	pDevEntry := dh.GetOnuDeviceEntry(false)
+	if unigInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.UniGClassID); len(unigInstKeys) > 0 {
+		for _, mgmtEntityID := range unigInstKeys {
+			logger.Debugw("Add UNI port for stored UniG instance:", log.Fields{
+				"device-id": dh.deviceID, "UnigMe EntityID": mgmtEntityID})
+			dh.addUniPort(mgmtEntityID, i, UniPPTP)
+			i++
+		}
+	} else {
+		logger.Debugw("No UniG instances found", log.Fields{"device-id": dh.deviceID})
+	}
+	if veipInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.VirtualEthernetInterfacePointClassID); len(veipInstKeys) > 0 {
+		for _, mgmtEntityID := range veipInstKeys {
+			logger.Debugw("Add VEIP acc. to stored VEIP instance:", log.Fields{
+				"device-id": dh.deviceID, "VEIP EntityID": mgmtEntityID})
+			dh.addUniPort(mgmtEntityID, i, UniVEIP)
+			i++
+		}
+	} else {
+		logger.Debugw("No VEIP instances found", log.Fields{"device-id": dh.deviceID})
+	}
+	if i == 0 {
+		logger.Warnw("No PPTP instances found", log.Fields{"device-id": dh.deviceID})
+	}
+
+	/* 200605: lock processing after initial MIBUpload removed now as the ONU should be in the lock state per default here
+	 *  left the code here as comment in case such processing should prove needed unexpectedly
+			// Init Uni Ports to Admin locked state
+			// maybe not really needed here as UNI ports should be locked by default, but still left as available in python code
+			// *** should generate UniLockStateDone event *****
+			if dh.pLockStateFsm == nil {
+				dh.createUniLockFsm(true, UniLockStateDone)
+			} else { //LockStateFSM already init
+				dh.pLockStateFsm.SetSuccessEvent(UniLockStateDone)
+				dh.runUniLockFsm(true)
+			}
+		}
+	case UniLockStateDone:
+		{
+			logger.Infow("UniLockStateDone event: Starting MIB download", log.Fields{"device-id": dh.deviceID})
+	* lockState processing commented out
+	*/
+	/*  Mib download procedure -
+	***** should run over 'downloaded' state and generate MibDownloadDone event *****
+	 */
+	pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
+	if pMibDlFsm != nil {
+		if pMibDlFsm.Is(dlStDisabled) {
+			if err := pMibDlFsm.Event(dlEvStart); err != nil {
+				logger.Errorw("MibDownloadFsm: Can't go to state starting", log.Fields{"err": err})
+				// maybe try a FSM reset and then again ... - TODO!!!
+			} else {
+				logger.Debugw("MibDownloadFsm", log.Fields{"state": string(pMibDlFsm.Current())})
+				// maybe use more specific states here for the specific download steps ...
+				if err := pMibDlFsm.Event(dlEvCreateGal); err != nil {
+					logger.Errorw("MibDownloadFsm: Can't start CreateGal", log.Fields{"err": err})
+				} else {
+					logger.Debugw("state of MibDownloadFsm", log.Fields{"state": string(pMibDlFsm.Current())})
+					//Begin MIB data download (running autonomously)
+				}
+			}
+		} else {
+			logger.Errorw("wrong state of MibDownloadFsm - want: disabled", log.Fields{"have": string(pMibDlFsm.Current())})
+			// maybe try a FSM reset and then again ... - TODO!!!
+		}
+		/***** Mib download started */
+	} else {
+		logger.Errorw("MibDownloadFsm invalid - cannot be executed!!", log.Fields{"device-id": dh.deviceID})
+	}
+}
+
+func (dh *DeviceHandler) processMibDownloadDoneEvent(devEvent OnuDeviceEvent) {
+	logger.Debugw("MibDownloadDone event received", log.Fields{"device-id": dh.deviceID})
+	//initiate DevStateUpdate
+	if !dh.reconciling {
+		if err := dh.coreProxy.DeviceStateUpdate(context.TODO(), dh.deviceID,
+			voltha.ConnectStatus_REACHABLE, voltha.OperStatus_ACTIVE); err != nil {
+			//TODO with VOL-3045/VOL-3046: return the error and stop further processing
+			logger.Errorw("error-updating-device-state", log.Fields{"device-id": dh.deviceID, "error": err})
+		} else {
+			logger.Debugw("dev state updated to 'Oper.Active'", log.Fields{"device-id": dh.deviceID})
+		}
+	} else {
+		logger.Debugw("reconciling - don't notify core about DeviceStateUpdate to ACTIVE",
+			log.Fields{"device-id": dh.deviceID})
+	}
+	if !dh.reconciling {
+		if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "initial-mib-downloaded"); err != nil {
+			//TODO with VOL-3045/VOL-3046: return the error and stop further processing
+			logger.Errorw("error-DeviceReasonUpdate to 'initial-mib-downloaded'",
+				log.Fields{"device-id": dh.deviceID, "error": err})
+		} else {
+			logger.Infow("dev reason updated to 'initial-mib-downloaded'", log.Fields{"device-id": dh.deviceID})
+		}
+	} else {
+		logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to initial-mib-downloaded",
+			log.Fields{"device-id": dh.deviceID})
+	}
+	//set internal state anyway - as it was done
+	dh.deviceReason = "initial-mib-downloaded"
+	// *** should generate UniUnlockStateDone event *****
+	if dh.pUnlockStateFsm == nil {
+		dh.createUniLockFsm(false, UniUnlockStateDone)
+	} else { //UnlockStateFSM already init
+		dh.pUnlockStateFsm.SetSuccessEvent(UniUnlockStateDone)
+		dh.runUniLockFsm(false)
+	}
+}
+
+func (dh *DeviceHandler) processUniUnlockStateDoneEvent(devEvent OnuDeviceEvent) {
+	go dh.enableUniPortStateUpdate() //cmp python yield self.enable_ports()
+
+	if !dh.reconciling {
+		logger.Infow("UniUnlockStateDone event: Sending OnuUp event", log.Fields{"device-id": dh.deviceID})
+		raisedTs := time.Now().UnixNano()
+		go dh.sendOnuOperStateEvent(voltha.OperStatus_ACTIVE, dh.deviceID, raisedTs) //cmp python onu_active_event
+	} else {
+		logger.Debugw("reconciling - don't notify core that onu went to active but trigger tech profile config",
+			log.Fields{"device-id": dh.deviceID})
+		go dh.ReconcileDeviceTechProf()
+		//TODO: further actions e.g. restore flows, metrics, ...
+	}
+}
+
+func (dh *DeviceHandler) processOmciAniConfigDoneEvent(devEvent OnuDeviceEvent) {
+	logger.Debugw("OmciAniConfigDone event received", log.Fields{"device-id": dh.deviceID})
+	// attention: the device reason update is done based on ONU-UNI-Port related activity
+	//  - which may cause some inconsistency
+	if dh.deviceReason != "tech-profile-config-download-success" {
+		// which may be the case from some previous actvity on another UNI Port of the ONU
+		if !dh.reconciling {
+			if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "tech-profile-config-download-success"); err != nil {
+				//TODO with VOL-3045/VOL-3046: return the error and stop further processing
+				logger.Errorw("error-DeviceReasonUpdate to 'tech-profile-config-download-success'",
+					log.Fields{"device-id": dh.deviceID, "error": err})
+			} else {
+				logger.Infow("update dev reason to 'tech-profile-config-download-success'",
+					log.Fields{"device-id": dh.deviceID})
+			}
+		} else {
+			logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to tech-profile-config-download-success",
+				log.Fields{"device-id": dh.deviceID})
+		}
+		//set internal state anyway - as it was done
+		dh.deviceReason = "tech-profile-config-download-success"
+	}
+}
+
+func (dh *DeviceHandler) processOmciVlanFilterDoneEvent(devEvent OnuDeviceEvent) {
+	logger.Debugw("OmciVlanFilterDone event received",
+		log.Fields{"device-id": dh.deviceID})
+	// attention: the device reason update is done based on ONU-UNI-Port related activity
+	//  - which may cause some inconsistency
+	//			yield self.core_proxy.device_reason_update(self.device_id, 'omci-flows-pushed')
+
+	if dh.deviceReason != "omci-flows-pushed" {
+		// which may be the case from some previous actvity on another UNI Port of the ONU
+		// or even some previous flow add activity on the same port
+		if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "omci-flows-pushed"); err != nil {
+			logger.Errorw("error-DeviceReasonUpdate to 'omci-flows-pushed'",
+				log.Fields{"device-id": dh.deviceID, "error": err})
+		} else {
+			logger.Infow("updated dev reason to ''omci-flows-pushed'",
+				log.Fields{"device-id": dh.deviceID})
+		}
+		//set internal state anyway - as it was done
+		dh.deviceReason = "omci-flows-pushed"
+	}
+}
+
 //DeviceProcStatusUpdate evaluates possible processing events and initiates according next activities
 func (dh *DeviceHandler) DeviceProcStatusUpdate(devEvent OnuDeviceEvent) {
 	switch devEvent {
 	case MibDatabaseSync:
 		{
-			logger.Debugw("MibInSync event received", log.Fields{"device-id": dh.deviceID})
-			if !dh.reconciling {
-				//initiate DevStateUpdate
-				if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "discovery-mibsync-complete"); err != nil {
-					//TODO with VOL-3045/VOL-3046: return the error and stop further processing
-					logger.Errorw("error-DeviceReasonUpdate to 'mibsync-complete'", log.Fields{
-						"device-id": dh.deviceID, "error": err})
-				} else {
-					logger.Infow("dev reason updated to 'MibSync complete'", log.Fields{"deviceID": dh.deviceID})
-				}
-			} else {
-				logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to mibsync-complete",
-					log.Fields{"device-id": dh.deviceID})
-			}
-			//set internal state anyway - as it was done
-			dh.deviceReason = "discovery-mibsync-complete"
-
-			i := uint8(0) //UNI Port limit: see MaxUnisPerOnu (by now 16) (OMCI supports max 255 p.b.)
-			pDevEntry := dh.GetOnuDeviceEntry(false)
-			if unigInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.UniGClassID); len(unigInstKeys) > 0 {
-				for _, mgmtEntityID := range unigInstKeys {
-					logger.Debugw("Add UNI port for stored UniG instance:", log.Fields{
-						"device-id": dh.deviceID, "UnigMe EntityID": mgmtEntityID})
-					dh.addUniPort(mgmtEntityID, i, UniPPTP)
-					i++
-				}
-			} else {
-				logger.Debugw("No UniG instances found", log.Fields{"device-id": dh.deviceID})
-			}
-			if veipInstKeys := pDevEntry.pOnuDB.GetSortedInstKeys(me.VirtualEthernetInterfacePointClassID); len(veipInstKeys) > 0 {
-				for _, mgmtEntityID := range veipInstKeys {
-					logger.Debugw("Add VEIP acc. to stored VEIP instance:", log.Fields{
-						"device-id": dh.deviceID, "VEIP EntityID": mgmtEntityID})
-					dh.addUniPort(mgmtEntityID, i, UniVEIP)
-					i++
-				}
-			} else {
-				logger.Debugw("No VEIP instances found", log.Fields{"device-id": dh.deviceID})
-			}
-			if i == 0 {
-				logger.Warnw("No PPTP instances found", log.Fields{"device-id": dh.deviceID})
-			}
-
-			/* 200605: lock processing after initial MIBUpload removed now as the ONU should be in the lock state per default here
-			 *  left the code here as comment in case such processing should prove needed unexpectedly
-					// Init Uni Ports to Admin locked state
-					// maybe not really needed here as UNI ports should be locked by default, but still left as available in python code
-					// *** should generate UniLockStateDone event *****
-					if dh.pLockStateFsm == nil {
-						dh.createUniLockFsm(true, UniLockStateDone)
-					} else { //LockStateFSM already init
-						dh.pLockStateFsm.SetSuccessEvent(UniLockStateDone)
-						dh.runUniLockFsm(true)
-					}
-				}
-			case UniLockStateDone:
-				{
-					logger.Infow("UniLockStateDone event: Starting MIB download", log.Fields{"device-id": dh.deviceID})
-			* lockState processing commented out
-			*/
-			/*  Mib download procedure -
-			***** should run over 'downloaded' state and generate MibDownloadDone event *****
-			 */
-			pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
-			if pMibDlFsm != nil {
-				if pMibDlFsm.Is(dlStDisabled) {
-					if err := pMibDlFsm.Event(dlEvStart); err != nil {
-						logger.Errorw("MibDownloadFsm: Can't go to state starting", log.Fields{"err": err})
-						// maybe try a FSM reset and then again ... - TODO!!!
-					} else {
-						logger.Debugw("MibDownloadFsm", log.Fields{"state": string(pMibDlFsm.Current())})
-						// maybe use more specific states here for the specific download steps ...
-						if err := pMibDlFsm.Event(dlEvCreateGal); err != nil {
-							logger.Errorw("MibDownloadFsm: Can't start CreateGal", log.Fields{"err": err})
-						} else {
-							logger.Debugw("state of MibDownloadFsm", log.Fields{"state": string(pMibDlFsm.Current())})
-							//Begin MIB data download (running autonomously)
-						}
-					}
-				} else {
-					logger.Errorw("wrong state of MibDownloadFsm - want: disabled", log.Fields{"have": string(pMibDlFsm.Current())})
-					// maybe try a FSM reset and then again ... - TODO!!!
-				}
-				/***** Mib download started */
-			} else {
-				logger.Errorw("MibDownloadFsm invalid - cannot be executed!!", log.Fields{"device-id": dh.deviceID})
-			}
+			dh.processMibDatabaseSyncEvent(devEvent)
 		}
 	case MibDownloadDone:
 		{
-			logger.Debugw("MibDownloadDone event received", log.Fields{"device-id": dh.deviceID})
-			//initiate DevStateUpdate
-			if !dh.reconciling {
-				if err := dh.coreProxy.DeviceStateUpdate(context.TODO(), dh.deviceID,
-					voltha.ConnectStatus_REACHABLE, voltha.OperStatus_ACTIVE); err != nil {
-					//TODO with VOL-3045/VOL-3046: return the error and stop further processing
-					logger.Errorw("error-updating-device-state", log.Fields{"device-id": dh.deviceID, "error": err})
-				} else {
-					logger.Debugw("dev state updated to 'Oper.Active'", log.Fields{"device-id": dh.deviceID})
-				}
-			} else {
-				logger.Debugw("reconciling - don't notify core about DeviceStateUpdate to ACTIVE",
-					log.Fields{"device-id": dh.deviceID})
-			}
-			if !dh.reconciling {
-				if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "initial-mib-downloaded"); err != nil {
-					//TODO with VOL-3045/VOL-3046: return the error and stop further processing
-					logger.Errorw("error-DeviceReasonUpdate to 'initial-mib-downloaded'",
-						log.Fields{"device-id": dh.deviceID, "error": err})
-				} else {
-					logger.Infow("dev reason updated to 'initial-mib-downloaded'", log.Fields{"device-id": dh.deviceID})
-				}
-			} else {
-				logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to initial-mib-downloaded",
-					log.Fields{"device-id": dh.deviceID})
-			}
-			//set internal state anyway - as it was done
-			dh.deviceReason = "initial-mib-downloaded"
-			// *** should generate UniUnlockStateDone event *****
-			if dh.pUnlockStateFsm == nil {
-				dh.createUniLockFsm(false, UniUnlockStateDone)
-			} else { //UnlockStateFSM already init
-				dh.pUnlockStateFsm.SetSuccessEvent(UniUnlockStateDone)
-				dh.runUniLockFsm(false)
-			}
+			dh.processMibDownloadDoneEvent(devEvent)
+
 		}
 	case UniUnlockStateDone:
 		{
-			go dh.enableUniPortStateUpdate() //cmp python yield self.enable_ports()
+			dh.processUniUnlockStateDoneEvent(devEvent)
 
-			if !dh.reconciling {
-				logger.Infow("UniUnlockStateDone event: Sending OnuUp event", log.Fields{"device-id": dh.deviceID})
-				raisedTs := time.Now().UnixNano()
-				go dh.sendOnuOperStateEvent(voltha.OperStatus_ACTIVE, dh.deviceID, raisedTs) //cmp python onu_active_event
-			} else {
-				logger.Debugw("reconciling - don't notify core that onu went to active but trigger tech profile config",
-					log.Fields{"device-id": dh.deviceID})
-				go dh.ReconcileDeviceTechProf()
-				//TODO: further actions e.g. restore flows, metrics, ...
-			}
 		}
 	case OmciAniConfigDone:
 		{
-			logger.Debugw("OmciAniConfigDone event received", log.Fields{"device-id": dh.deviceID})
-			// attention: the device reason update is done based on ONU-UNI-Port related activity
-			//  - which may cause some inconsistency
-			if dh.deviceReason != "tech-profile-config-download-success" {
-				// which may be the case from some previous actvity on another UNI Port of the ONU
-				if !dh.reconciling {
-					if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "tech-profile-config-download-success"); err != nil {
-						//TODO with VOL-3045/VOL-3046: return the error and stop further processing
-						logger.Errorw("error-DeviceReasonUpdate to 'tech-profile-config-download-success'",
-							log.Fields{"device-id": dh.deviceID, "error": err})
-					} else {
-						logger.Infow("update dev reason to 'tech-profile-config-download-success'",
-							log.Fields{"device-id": dh.deviceID})
-					}
-				} else {
-					logger.Debugw("reconciling - don't notify core about DeviceReasonUpdate to tech-profile-config-download-success",
-						log.Fields{"device-id": dh.deviceID})
-				}
-				//set internal state anyway - as it was done
-				dh.deviceReason = "tech-profile-config-download-success"
-			}
+			dh.processOmciAniConfigDoneEvent(devEvent)
+
 		}
 	case OmciVlanFilterDone:
 		{
-			logger.Debugw("OmciVlanFilterDone event received",
-				log.Fields{"device-id": dh.deviceID})
-			// attention: the device reason update is done based on ONU-UNI-Port related activity
-			//  - which may cause some inconsistency
-			//			yield self.core_proxy.device_reason_update(self.device_id, 'omci-flows-pushed')
+			dh.processOmciVlanFilterDoneEvent(devEvent)
 
-			if dh.deviceReason != "omci-flows-pushed" {
-				// which may be the case from some previous actvity on another UNI Port of the ONU
-				// or even some previous flow add activity on the same port
-				if err := dh.coreProxy.DeviceReasonUpdate(context.TODO(), dh.deviceID, "omci-flows-pushed"); err != nil {
-					logger.Errorw("error-DeviceReasonUpdate to 'omci-flows-pushed'",
-						log.Fields{"device-id": dh.deviceID, "error": err})
-				} else {
-					logger.Infow("updated dev reason to ''omci-flows-pushed'",
-						log.Fields{"device-id": dh.deviceID})
-				}
-				//set internal state anyway - as it was done
-				dh.deviceReason = "omci-flows-pushed"
-			}
 		}
 	default:
 		{
@@ -1436,7 +1485,7 @@
 
 	for uniNo, uniPort := range dh.uniEntityMap {
 		// only if this port is validated for operState transfer
-		if (1<<uniPort.uniId)&ActiveUniPortStateUpdateMask == (1 << uniPort.uniId) {
+		if (1<<uniPort.uniID)&ActiveUniPortStateUpdateMask == (1 << uniPort.uniID) {
 			logger.Infow("onuUniPort-forced-OperState-ACTIVE", log.Fields{"for PortNo": uniNo})
 			uniPort.SetOperState(vc.OperStatus_ACTIVE)
 			if !dh.reconciling {
@@ -1455,7 +1504,7 @@
 	//   -> use current restriction to operate only on first UNI port as inherited from actual Py code
 	for uniNo, uniPort := range dh.uniEntityMap {
 		// only if this port is validated for operState transfer
-		if (1<<uniPort.uniId)&ActiveUniPortStateUpdateMask == (1 << uniPort.uniId) {
+		if (1<<uniPort.uniID)&ActiveUniPortStateUpdateMask == (1 << uniPort.uniID) {
 			logger.Infow("onuUniPort-forced-OperState-UNKNOWN", log.Fields{"for PortNo": uniNo})
 			uniPort.SetOperState(vc.OperStatus_UNKNOWN)
 			//maybe also use getter functions on uniPort - perhaps later ...
@@ -1596,30 +1645,9 @@
 
 	return kvbackend
 }
+func (dh *DeviceHandler) getFlowOfbFields(apFlowItem *ofp.OfpFlowStats, loMatchVlan *uint16,
+	loAddPcp *uint8, loIPProto *uint32) {
 
-//addFlowItemToUniPort parses the actual flow item to add it to the UniPort
-func (dh *DeviceHandler) addFlowItemToUniPort(apFlowItem *ofp.OfpFlowStats, apUniPort *OnuUniPort) error {
-	var loSetVlan uint16 = uint16(of.OfpVlanId_OFPVID_NONE)      //noValidEntry
-	var loMatchVlan uint16 = uint16(of.OfpVlanId_OFPVID_PRESENT) //reserved VLANID entry
-	var loAddPcp, loSetPcp uint8
-	/* the TechProfileId is part of the flow Metadata - compare also comment within
-	 * OLT-Adapter:openolt_flowmgr.go
-	 *     Metadata 8 bytes:
-	 *	   Most Significant 2 Bytes = Inner VLAN
-	 *	   Next 2 Bytes = Tech Profile ID(TPID)
-	 *	   Least Significant 4 Bytes = Port ID
-	 *     Flow Metadata carries Tech-Profile (TP) ID and is mandatory in all
-	 *     subscriber related flows.
-	 */
-
-	metadata := flow.GetMetadataFromWriteMetadataAction(apFlowItem)
-	if metadata == 0 {
-		logger.Debugw("FlowAdd invalid metadata - abort",
-			log.Fields{"device-id": dh.deviceID})
-		return errors.New("FlowAdd invalid metadata")
-	}
-	loTpID := flow.GetTechProfileIDFromWriteMetaData(metadata)
-	logger.Debugw("FlowAdd TechProfileId", log.Fields{"device-id": dh.deviceID, "TP-Id": loTpID})
 	for _, field := range flow.GetOfbFields(apFlowItem) {
 		switch field.Type {
 		case of.OxmOfbFieldTypes_OFPXMT_OFB_ETH_TYPE:
@@ -1629,32 +1657,32 @@
 			}
 		case of.OxmOfbFieldTypes_OFPXMT_OFB_IP_PROTO:
 			{
-				loIPProto := field.GetIpProto()
+				*loIPProto = field.GetIpProto()
 				logger.Debugw("FlowAdd type IpProto", log.Fields{"device-id": dh.deviceID,
-					"IpProto": strconv.FormatInt(int64(loIPProto), 16)})
-				if loIPProto == 2 {
+					"IpProto": strconv.FormatInt(int64(*loIPProto), 16)})
+				if *loIPProto == 2 {
 					// some workaround for TT workflow at proto == 2 (IGMP trap) -> ignore the flow
 					// avoids installing invalid EVTOCD rule
 					logger.Debugw("FlowAdd type IpProto 2: TT workaround: ignore flow",
 						log.Fields{"device-id": dh.deviceID,
-							"IpProto": strconv.FormatInt(int64(loIPProto), 16)})
-					return nil
+							"IpProto": strconv.FormatInt(int64(*loIPProto), 16)})
+					return
 				}
 			}
 		case of.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID:
 			{
-				loMatchVlan = uint16(field.GetVlanVid())
+				*loMatchVlan = uint16(field.GetVlanVid())
 				loMatchVlanMask := uint16(field.GetVlanVidMask())
-				if !(loMatchVlan == uint16(of.OfpVlanId_OFPVID_PRESENT) &&
+				if !(*loMatchVlan == uint16(of.OfpVlanId_OFPVID_PRESENT) &&
 					loMatchVlanMask == uint16(of.OfpVlanId_OFPVID_PRESENT)) {
-					loMatchVlan = loMatchVlan & 0xFFF // not transparent: copy only ID bits
+					*loMatchVlan = *loMatchVlan & 0xFFF // not transparent: copy only ID bits
 				}
 				logger.Debugw("FlowAdd field type", log.Fields{"device-id": dh.deviceID,
-					"VID": strconv.FormatInt(int64(loMatchVlan), 16)})
+					"VID": strconv.FormatInt(int64(*loMatchVlan), 16)})
 			}
 		case of.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP:
 			{
-				loAddPcp = uint8(field.GetVlanPcp())
+				*loAddPcp = uint8(field.GetVlanPcp())
 				logger.Debugw("FlowAdd field type", log.Fields{"device-id": dh.deviceID,
 					"PCP": loAddPcp})
 			}
@@ -1691,7 +1719,9 @@
 			*/
 		}
 	} //for all OfbFields
+}
 
+func (dh *DeviceHandler) getFlowActions(apFlowItem *ofp.OfpFlowStats, loSetPcp *uint8, loSetVlan *uint16) {
 	for _, action := range flow.GetActions(apFlowItem) {
 		switch action.Type {
 		/* not used:
@@ -1714,13 +1744,13 @@
 						"OxcmClass": pActionSetField.Field.OxmClass})
 				}
 				if pActionSetField.Field.GetOfbField().Type == of.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_VID {
-					loSetVlan = uint16(pActionSetField.Field.GetOfbField().GetVlanVid())
+					*loSetVlan = uint16(pActionSetField.Field.GetOfbField().GetVlanVid())
 					logger.Debugw("FlowAdd Set VLAN from SetField action", log.Fields{"device-id": dh.deviceID,
-						"SetVlan": strconv.FormatInt(int64(loSetVlan), 16)})
+						"SetVlan": strconv.FormatInt(int64(*loSetVlan), 16)})
 				} else if pActionSetField.Field.GetOfbField().Type == of.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP {
-					loSetPcp = uint8(pActionSetField.Field.GetOfbField().GetVlanPcp())
+					*loSetPcp = uint8(pActionSetField.Field.GetOfbField().GetVlanPcp())
 					logger.Debugw("FlowAdd Set PCP from SetField action", log.Fields{"device-id": dh.deviceID,
-						"SetPcp": loSetPcp})
+						"SetPcp": *loSetPcp})
 				} else {
 					logger.Warnw("FlowAdd action SetField invalid FieldType", log.Fields{"device-id": dh.deviceID,
 						"Type": pActionSetField.Field.GetOfbField().Type})
@@ -1734,6 +1764,43 @@
 			*/
 		}
 	} //for all Actions
+}
+
+//addFlowItemToUniPort parses the actual flow item to add it to the UniPort
+func (dh *DeviceHandler) addFlowItemToUniPort(apFlowItem *ofp.OfpFlowStats, apUniPort *OnuUniPort) error {
+	var loSetVlan uint16 = uint16(of.OfpVlanId_OFPVID_NONE)      //noValidEntry
+	var loMatchVlan uint16 = uint16(of.OfpVlanId_OFPVID_PRESENT) //reserved VLANID entry
+	var loAddPcp, loSetPcp uint8
+	var loIPProto uint32
+	/* the TechProfileId is part of the flow Metadata - compare also comment within
+	 * OLT-Adapter:openolt_flowmgr.go
+	 *     Metadata 8 bytes:
+	 *	   Most Significant 2 Bytes = Inner VLAN
+	 *	   Next 2 Bytes = Tech Profile ID(TPID)
+	 *	   Least Significant 4 Bytes = Port ID
+	 *     Flow Metadata carries Tech-Profile (TP) ID and is mandatory in all
+	 *     subscriber related flows.
+	 */
+
+	metadata := flow.GetMetadataFromWriteMetadataAction(apFlowItem)
+	if metadata == 0 {
+		logger.Debugw("FlowAdd invalid metadata - abort",
+			log.Fields{"device-id": dh.deviceID})
+		return errors.New("flowAdd invalid metadata")
+	}
+	loTpID := flow.GetTechProfileIDFromWriteMetaData(metadata)
+	logger.Debugw("FlowAdd TechProfileId", log.Fields{"device-id": dh.deviceID, "TP-Id": loTpID})
+
+	dh.getFlowOfbFields(apFlowItem, &loMatchVlan, &loAddPcp, &loIPProto)
+	if loIPProto == 2 {
+		// some workaround for TT workflow at proto == 2 (IGMP trap) -> ignore the flow
+		// avoids installing invalid EVTOCD rule
+		logger.Debugw("FlowAdd type IpProto 2: TT workaround: ignore flow",
+			log.Fields{"device-id": dh.deviceID,
+				"IpProto": strconv.FormatInt(int64(loIPProto), 16)})
+		return nil
+	}
+	dh.getFlowActions(apFlowItem, &loSetPcp, &loSetVlan)
 
 	if loSetVlan == uint16(of.OfpVlanId_OFPVID_NONE) && loMatchVlan != uint16(of.OfpVlanId_OFPVID_PRESENT) {
 		logger.Errorw("FlowAdd aborted - SetVlanId undefined, but MatchVid set", log.Fields{
@@ -1742,7 +1809,7 @@
 			"match_vid": strconv.FormatInt(int64(loMatchVlan), 16)})
 		//TODO!!: Use DeviceId within the error response to rwCore
 		//  likewise also in other error response cases to calling components as requested in [VOL-3458]
-		return errors.New("FlowAdd Set/Match VlanId inconsistent")
+		return errors.New("flowAdd Set/Match VlanId inconsistent")
 	}
 	if loSetVlan == uint16(of.OfpVlanId_OFPVID_NONE) && loMatchVlan == uint16(of.OfpVlanId_OFPVID_PRESENT) {
 		logger.Debugw("FlowAdd vlan-any/copy", log.Fields{"device-id": dh.deviceID})
@@ -1751,22 +1818,22 @@
 		//looks like OMCI value 4097 (copyFromOuter - for Uni double tagged) is not supported here
 		if loSetVlan != uint16(of.OfpVlanId_OFPVID_PRESENT) {
 			// not set to transparent
-			loSetVlan &= 0x0FFF //mask VID bits as prerequiste for vlanConfigFsm
+			loSetVlan &= 0x0FFF //mask VID bits as prerequisite for vlanConfigFsm
 		}
 		logger.Debugw("FlowAdd vlan-set", log.Fields{"device-id": dh.deviceID})
 	}
 	//TODO!!: further FlowAdd requests may be valid even in case the FSM is already running,
 	//  e.g. for multi-step flow configuration, error treatment must be redefined in this context as requested in [VOL-3441]
-	if _, exist := dh.UniVlanConfigFsmMap[apUniPort.uniId]; exist {
+	if _, exist := dh.UniVlanConfigFsmMap[apUniPort.uniID]; exist {
 		logger.Errorw("FlowAdd aborted - FSM already running", log.Fields{
 			"device-id": dh.deviceID, "UniPort": apUniPort.portNo})
-		return errors.New("FlowAdd FSM already running")
+		return errors.New("flowAdd FSM already running")
 	}
 	return dh.createVlanFilterFsm(apUniPort,
 		loTpID, loMatchVlan, loSetVlan, loSetPcp, OmciVlanFilterDone)
 }
 
-// createVlanFilterFsm initialises and runs the VlanFilter FSM to transfer OMCI related VLAN config
+// createVlanFilterFsm initializes and runs the VlanFilter FSM to transfer OMCI related VLAN config
 func (dh *DeviceHandler) createVlanFilterFsm(apUniPort *OnuUniPort,
 	aTpID uint16, aMatchVlan uint16, aSetVlan uint16, aSetPcp uint8, aDevEvent OnuDeviceEvent) error {
 	chVlanFilterFsm := make(chan Message, 2048)
@@ -1774,40 +1841,39 @@
 	pDevEntry := dh.GetOnuDeviceEntry(true)
 	if pDevEntry == nil {
 		logger.Errorw("No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
-		return fmt.Errorf("No valid OnuDevice for device-id %x - aborting", dh.deviceID)
+		return fmt.Errorf("no valid OnuDevice for device-id %x - aborting", dh.deviceID)
 	}
 
 	pVlanFilterFsm := NewUniVlanConfigFsm(dh, pDevEntry.PDevOmciCC, apUniPort, dh.pOnuTP,
 		pDevEntry.pOnuDB, aTpID, aDevEvent, "UniVlanConfigFsm", dh.deviceID, chVlanFilterFsm,
 		dh.pOpenOnuAc.AcceptIncrementalEvto, aMatchVlan, aSetVlan, aSetPcp)
 	if pVlanFilterFsm != nil {
-		dh.UniVlanConfigFsmMap[apUniPort.uniId] = pVlanFilterFsm
+		dh.UniVlanConfigFsmMap[apUniPort.uniID] = pVlanFilterFsm
 		pVlanFilterStatemachine := pVlanFilterFsm.pAdaptFsm.pFsm
 		if pVlanFilterStatemachine != nil {
 			if pVlanFilterStatemachine.Is(vlanStDisabled) {
 				if err := pVlanFilterStatemachine.Event(vlanEvStart); err != nil {
 					logger.Warnw("UniVlanConfigFsm: can't start", log.Fields{"err": err})
-					return fmt.Errorf("Can't start UniVlanConfigFsm for device-id %x", dh.deviceID)
-				} else {
-					/***** UniVlanConfigFsm started */
-					logger.Debugw("UniVlanConfigFsm started", log.Fields{
-						"state": pVlanFilterStatemachine.Current(), "device-id": dh.deviceID,
-						"UniPort": apUniPort.portNo})
+					return fmt.Errorf("can't start UniVlanConfigFsm for device-id %x", dh.deviceID)
 				}
+				/***** UniVlanConfigFsm started */
+				logger.Debugw("UniVlanConfigFsm started", log.Fields{
+					"state": pVlanFilterStatemachine.Current(), "device-id": dh.deviceID,
+					"UniPort": apUniPort.portNo})
 			} else {
 				logger.Warnw("wrong state of UniVlanConfigFsm - want: disabled", log.Fields{
 					"have": pVlanFilterStatemachine.Current(), "device-id": dh.deviceID})
-				return fmt.Errorf("UniVlanConfigFsm not in expected disabled state for device-id %x", dh.deviceID)
+				return fmt.Errorf("uniVlanConfigFsm not in expected disabled state for device-id %x", dh.deviceID)
 			}
 		} else {
 			logger.Errorw("UniVlanConfigFsm StateMachine invalid - cannot be executed!!", log.Fields{
 				"device-id": dh.deviceID})
-			return fmt.Errorf("UniVlanConfigFsm invalid for device-id %x", dh.deviceID)
+			return fmt.Errorf("uniVlanConfigFsm invalid for device-id %x", dh.deviceID)
 		}
 	} else {
 		logger.Errorw("UniVlanConfigFsm could not be created - abort!!", log.Fields{
 			"device-id": dh.deviceID, "UniPort": apUniPort.portNo})
-		return fmt.Errorf("UniVlanConfigFsm could not be created for device-id %x", dh.deviceID)
+		return fmt.Errorf("uniVlanConfigFsm could not be created for device-id %x", dh.deviceID)
 	}
 	return nil
 }
@@ -1817,7 +1883,7 @@
 	//TODO!! verify and start pending flow configuration
 	//some pending config request my exist in case the UniVlanConfig FSM was already started - with internal data -
 	//but execution was set to 'on hold' as first the TechProfile config had to be applied
-	if pVlanFilterFsm, exist := dh.UniVlanConfigFsmMap[apUniPort.uniId]; exist {
+	if pVlanFilterFsm, exist := dh.UniVlanConfigFsmMap[apUniPort.uniID]; exist {
 		//VlanFilterFsm exists and was already started (assumed to wait for TechProfile execution here)
 		pVlanFilterStatemachine := pVlanFilterFsm.pAdaptFsm.pFsm
 		if pVlanFilterStatemachine != nil {
@@ -1848,5 +1914,5 @@
 	logger.Debugw("remove UniVlanConfigFsm StateMachine", log.Fields{
 		"device-id": dh.deviceID, "uniPort": apUniPort.portNo})
 	//save to do, even if entry dows not exist
-	delete(dh.UniVlanConfigFsmMap, apUniPort.uniId)
+	delete(dh.UniVlanConfigFsmMap, apUniPort.uniID)
 }
diff --git a/internal/pkg/onuadaptercore/mib_sync.go b/internal/pkg/onuadaptercore/mib_sync.go
index 45aa197..f781f9e 100644
--- a/internal/pkg/onuadaptercore/mib_sync.go
+++ b/internal/pkg/onuadaptercore/mib_sync.go
@@ -156,8 +156,8 @@
 					if uint16ValidNumber, err := strconv.ParseUint(fistLevelKey, 10, 16); err == nil {
 						meClassID := me.ClassID(uint16ValidNumber)
 						logger.Debugw("MibSync FSM - fistLevelKey is a number in uint16-range", log.Fields{"uint16ValidNumber": uint16ValidNumber})
-						if IsSupportedClassId(meClassID) {
-							logger.Debugw("MibSync FSM - fistLevelKey is a supported classId", log.Fields{"meClassID": meClassID})
+						if IsSupportedClassID(meClassID) {
+							logger.Debugw("MibSync FSM - fistLevelKey is a supported classID", log.Fields{"meClassID": meClassID})
 							secondLevelMap := firstLevelValue.(map[string]interface{})
 							for secondLevelKey, secondLevelValue := range secondLevelMap {
 								logger.Debugw("MibSync FSM - secondLevelKey", log.Fields{"secondLevelKey": secondLevelKey})
@@ -468,7 +468,7 @@
 	}
 }
 
-func IsSupportedClassId(meClassID me.ClassID) bool {
+func IsSupportedClassID(meClassID me.ClassID) bool {
 	for _, v := range supportedClassIds {
 		if v == meClassID {
 			return true
@@ -497,29 +497,29 @@
 	firstLevelMap := onuDeviceEntry.pOnuDB.meDb
 	for firstLevelKey, firstLevelValue := range firstLevelMap {
 		logger.Debugw("MibSync - MibTemplate - firstLevelKey", log.Fields{"firstLevelKey": firstLevelKey})
-		classId := strconv.Itoa(int(firstLevelKey))
+		classID := strconv.Itoa(int(firstLevelKey))
 
 		secondLevelMap := make(map[string]interface{})
 		for secondLevelKey, secondLevelValue := range firstLevelValue {
 			thirdLevelMap := make(map[string]interface{})
-			entityId := strconv.Itoa(int(secondLevelKey))
+			entityID := strconv.Itoa(int(secondLevelKey))
 			thirdLevelMap["Attributes"] = secondLevelValue
-			thirdLevelMap["InstanceId"] = entityId
-			secondLevelMap[entityId] = thirdLevelMap
-			if classId == "6" || classId == "256" {
+			thirdLevelMap["InstanceId"] = entityID
+			secondLevelMap[entityID] = thirdLevelMap
+			if classID == "6" || classID == "256" {
 				forthLevelMap := map[string]interface{}(thirdLevelMap["Attributes"].(me.AttributeValueMap))
 				delete(forthLevelMap, "SerialNumber")
 				forthLevelMap["SerialNumber"] = "%SERIAL_NUMBER%"
 
 			}
-			if classId == "134" {
+			if classID == "134" {
 				forthLevelMap := map[string]interface{}(thirdLevelMap["Attributes"].(me.AttributeValueMap))
 				delete(forthLevelMap, "MacAddress")
 				forthLevelMap["MacAddress"] = "%MAC_ADDRESS%"
 			}
 		}
-		secondLevelMap["ClassId"] = classId
-		templateMap[classId] = secondLevelMap
+		secondLevelMap["ClassId"] = classID
+		templateMap[classID] = secondLevelMap
 	}
 	mibTemplate, err := json.Marshal(&templateMap)
 	if err != nil {
diff --git a/internal/pkg/onuadaptercore/omci_ani_config.go b/internal/pkg/onuadaptercore/omci_ani_config.go
index 1d5e5d4..105dd7b 100644
--- a/internal/pkg/onuadaptercore/omci_ani_config.go
+++ b/internal/pkg/onuadaptercore/omci_ani_config.go
@@ -181,6 +181,102 @@
 	oFsm.chanSet = true
 }
 
+func (oFsm *UniPonAniConfigFsm) prepareAndEnterConfigState(aPAFsm *AdapterFsm) {
+	if aPAFsm != nil && aPAFsm.pFsm != nil {
+		//stick to pythonAdapter numbering scheme
+		//index 0 in naming refers to possible usage of multiple instances (later)
+		oFsm.mapperSP0ID = ieeeMapperServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo) + oFsm.techProfileID
+		oFsm.macBPCD0ID = macBridgePortAniEID + uint16(oFsm.pOnuUniPort.entityID) + oFsm.techProfileID
+
+		// For the time being: if there are multiple T-Conts on the ONU the first one from the entityID-ordered list is used
+		// TODO!: if more T-Conts have to be supported (tcontXID!), then use the first instances of the entity-ordered list
+		// or use the py code approach, which might be a bit more complicated, but also more secure, as it
+		// ensures that the selected T-Cont also has queues (which I would assume per definition from ONU, but who knows ...)
+		// so this approach would search the (sorted) upstream PrioQueue list and use the T-Cont (if available) from highest Bytes
+		// or sndHighByte of relatedPort Attribute (T-Cont Reference) and in case of multiple TConts find the next free TContIndex
+		// that way from PrioQueue.relatedPort list
+		if tcontInstKeys := oFsm.pOnuDB.GetSortedInstKeys(me.TContClassID); len(tcontInstKeys) > 0 {
+			oFsm.tcont0ID = tcontInstKeys[0]
+			logger.Debugw("Used TcontId:", log.Fields{"TcontId": strconv.FormatInt(int64(oFsm.tcont0ID), 16),
+				"device-id": oFsm.pAdaptFsm.deviceID})
+		} else {
+			logger.Warnw("No TCont instances found", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+		}
+		oFsm.alloc0ID = (*(oFsm.pUniTechProf.mapPonAniConfig[oFsm.pOnuUniPort.uniID]))[0].tcontParams.allocID
+		loGemPortAttribs := ponAniGemPortAttribs{}
+		//for all TechProfile set GemIndices
+		for _, gemEntry := range (*(oFsm.pUniTechProf.mapPonAniConfig[oFsm.pOnuUniPort.uniID]))[0].mapGemPortParams {
+			//collect all GemConfigData in a separate Fsm related slice (needed also to avoid mix-up with unsorted mapPonAniConfig)
+
+			if queueInstKeys := oFsm.pOnuDB.GetSortedInstKeys(me.PriorityQueueClassID); len(queueInstKeys) > 0 {
+
+				loGemPortAttribs.gemPortID = gemEntry.gemPortID
+				// MibDb usage: upstream PrioQueue.RelatedPort = xxxxyyyy with xxxx=TCont.Entity(incl. slot) and yyyy=prio
+				// i.e.: search PrioQueue list with xxxx=actual T-Cont.Entity,
+				// from that list use the PrioQueue.Entity with  gemEntry.prioQueueIndex == yyyy (expect 0..7)
+				usQrelPortMask := uint32((((uint32)(oFsm.tcont0ID)) << 16) + uint32(gemEntry.prioQueueIndex))
+
+				// MibDb usage: downstream PrioQueue.RelatedPort = xxyyzzzz with xx=slot, yy=UniPort and zzzz=prio
+				// i.e.: search PrioQueue list with yy=actual pOnuUniPort.uniID,
+				// from that list use the PrioQueue.Entity with gemEntry.prioQueueIndex == zzzz (expect 0..7)
+				// Note: As we do not maintain any slot numbering, slot number will be excluded from seatch pattern.
+				//       Furthermore OMCI Onu port-Id is expected to start with 1 (not 0).
+				dsQrelPortMask := uint32((((uint32)(oFsm.pOnuUniPort.uniID + 1)) << 16) + uint32(gemEntry.prioQueueIndex))
+
+				usQueueFound := false
+				dsQueueFound := false
+				for _, mgmtEntityID := range queueInstKeys {
+					if meAttributes := oFsm.pOnuDB.GetMe(me.PriorityQueueClassID, mgmtEntityID); meAttributes != nil {
+						returnVal := meAttributes["RelatedPort"]
+						if returnVal != nil {
+							if relatedPort, err := oFsm.pOnuDB.GetUint32Attrib(returnVal); err == nil {
+								if relatedPort == usQrelPortMask {
+									loGemPortAttribs.upQueueID = mgmtEntityID
+									logger.Debugw("UpQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
+										"upQueueID": strconv.FormatInt(int64(loGemPortAttribs.upQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
+									usQueueFound = true
+								} else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityID < 0x8000 {
+									loGemPortAttribs.downQueueID = mgmtEntityID
+									logger.Debugw("DownQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
+										"downQueueID": strconv.FormatInt(int64(loGemPortAttribs.downQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
+									dsQueueFound = true
+								}
+								if usQueueFound && dsQueueFound {
+									break
+								}
+							} else {
+								logger.Warnw("Could not convert attribute value", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+							}
+						} else {
+							logger.Warnw("'RelatedPort' not found in meAttributes:", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+						}
+					} else {
+						logger.Warnw("No attributes available in DB:", log.Fields{"meClassID": me.PriorityQueueClassID,
+							"mgmtEntityID": mgmtEntityID, "device-id": oFsm.pAdaptFsm.deviceID})
+					}
+				}
+			} else {
+				logger.Warnw("No PriorityQueue instances found", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+			}
+			loGemPortAttribs.direction = gemEntry.direction
+			loGemPortAttribs.qosPolicy = gemEntry.queueSchedPolicy
+			loGemPortAttribs.weight = gemEntry.queueWeight
+			loGemPortAttribs.pbitString = gemEntry.pbitString
+
+			logger.Debugw("prio-related GemPort attributes:", log.Fields{
+				"gemPortID":      loGemPortAttribs.gemPortID,
+				"upQueueID":      loGemPortAttribs.upQueueID,
+				"downQueueID":    loGemPortAttribs.downQueueID,
+				"pbitString":     loGemPortAttribs.pbitString,
+				"prioQueueIndex": gemEntry.prioQueueIndex,
+			})
+
+			oFsm.gemPortAttribsSlice = append(oFsm.gemPortAttribsSlice, loGemPortAttribs)
+		}
+		_ = aPAFsm.pFsm.Event(aniEvStartConfig)
+	}
+}
+
 func (oFsm *UniPonAniConfigFsm) enterConfigStartingState(e *fsm.Event) {
 	logger.Debugw("UniPonAniConfigFsm start", log.Fields{"in state": e.FSM.Current(),
 		"device-id": oFsm.pAdaptFsm.deviceID})
@@ -206,101 +302,8 @@
 	pConfigAniStateAFsm := oFsm.pAdaptFsm
 	if pConfigAniStateAFsm != nil {
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
-		go func(a_pAFsm *AdapterFsm) {
-			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				//stick to pythonAdapter numbering scheme
-				//index 0 in naming refers to possible usage of multiple instances (later)
-				oFsm.mapperSP0ID = ieeeMapperServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo) + oFsm.techProfileID
-				oFsm.macBPCD0ID = macBridgePortAniEID + uint16(oFsm.pOnuUniPort.entityId) + oFsm.techProfileID
+		go oFsm.prepareAndEnterConfigState(pConfigAniStateAFsm)
 
-				// For the time being: if there are multiple T-Conts on the ONU the first one from the entityID-ordered list is used
-				// TODO!: if more T-Conts have to be supported (tcontXID!), then use the first instances of the entity-ordered list
-				// or use the py code approach, which might be a bit more complicated, but also more secure, as it
-				// ensures that the selected T-Cont also has queues (which I would assume per definition from ONU, but who knows ...)
-				// so this approach would search the (sorted) upstream PrioQueue list and use the T-Cont (if available) from highest Bytes
-				// or sndHighByte of relatedPort Attribute (T-Cont Reference) and in case of multiple TConts find the next free TContIndex
-				// that way from PrioQueue.relatedPort list
-				if tcontInstKeys := oFsm.pOnuDB.GetSortedInstKeys(me.TContClassID); len(tcontInstKeys) > 0 {
-					oFsm.tcont0ID = tcontInstKeys[0]
-					logger.Debugw("Used TcontId:", log.Fields{"TcontId": strconv.FormatInt(int64(oFsm.tcont0ID), 16),
-						"device-id": oFsm.pAdaptFsm.deviceID})
-				} else {
-					logger.Warnw("No TCont instances found", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-				}
-				oFsm.alloc0ID = (*(oFsm.pUniTechProf.mapPonAniConfig[oFsm.pOnuUniPort.uniId]))[0].tcontParams.allocID
-				loGemPortAttribs := ponAniGemPortAttribs{}
-				//for all TechProfile set GemIndices
-				for _, gemEntry := range (*(oFsm.pUniTechProf.mapPonAniConfig[oFsm.pOnuUniPort.uniId]))[0].mapGemPortParams {
-					//collect all GemConfigData in a separate Fsm related slice (needed also to avoid mix-up with unsorted mapPonAniConfig)
-
-					if queueInstKeys := oFsm.pOnuDB.GetSortedInstKeys(me.PriorityQueueClassID); len(queueInstKeys) > 0 {
-
-						loGemPortAttribs.gemPortID = gemEntry.gemPortID
-						// MibDb usage: upstream PrioQueue.RelatedPort = xxxxyyyy with xxxx=TCont.Entity(incl. slot) and yyyy=prio
-						// i.e.: search PrioQueue list with xxxx=actual T-Cont.Entity,
-						// from that list use the PrioQueue.Entity with  gemEntry.prioQueueIndex == yyyy (expect 0..7)
-						usQrelPortMask := uint32((((uint32)(oFsm.tcont0ID)) << 16) + uint32(gemEntry.prioQueueIndex))
-
-						// MibDb usage: downstream PrioQueue.RelatedPort = xxyyzzzz with xx=slot, yy=UniPort and zzzz=prio
-						// i.e.: search PrioQueue list with yy=actual pOnuUniPort.uniId,
-						// from that list use the PrioQueue.Entity with gemEntry.prioQueueIndex == zzzz (expect 0..7)
-						// Note: As we do not maintain any slot numbering, slot number will be excluded from seatch pattern.
-						//       Furthermore OMCI Onu port-Id is expected to start with 1 (not 0).
-						dsQrelPortMask := uint32((((uint32)(oFsm.pOnuUniPort.uniId + 1)) << 16) + uint32(gemEntry.prioQueueIndex))
-
-						usQueueFound := false
-						dsQueueFound := false
-						for _, mgmtEntityID := range queueInstKeys {
-							if meAttributes := oFsm.pOnuDB.GetMe(me.PriorityQueueClassID, mgmtEntityID); meAttributes != nil {
-								returnVal := meAttributes["RelatedPort"]
-								if returnVal != nil {
-									if relatedPort, err := oFsm.pOnuDB.GetUint32Attrib(returnVal); err == nil {
-										if relatedPort == usQrelPortMask {
-											loGemPortAttribs.upQueueID = mgmtEntityID
-											logger.Debugw("UpQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
-												"upQueueID": strconv.FormatInt(int64(loGemPortAttribs.upQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-											usQueueFound = true
-										} else if (relatedPort&0xFFFFFF) == dsQrelPortMask && mgmtEntityID < 0x8000 {
-											loGemPortAttribs.downQueueID = mgmtEntityID
-											logger.Debugw("DownQueue for GemPort found:", log.Fields{"gemPortID": loGemPortAttribs.gemPortID,
-												"downQueueID": strconv.FormatInt(int64(loGemPortAttribs.downQueueID), 16), "device-id": oFsm.pAdaptFsm.deviceID})
-											dsQueueFound = true
-										}
-										if usQueueFound && dsQueueFound {
-											break
-										}
-									} else {
-										logger.Warnw("Could not convert attribute value", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-									}
-								} else {
-									logger.Warnw("'RelatedPort' not found in meAttributes:", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-								}
-							} else {
-								logger.Warnw("No attributes available in DB:", log.Fields{"meClassID": me.PriorityQueueClassID,
-									"mgmtEntityID": mgmtEntityID, "device-id": oFsm.pAdaptFsm.deviceID})
-							}
-						}
-					} else {
-						logger.Warnw("No PriorityQueue instances found", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-					}
-					loGemPortAttribs.direction = gemEntry.direction
-					loGemPortAttribs.qosPolicy = gemEntry.queueSchedPolicy
-					loGemPortAttribs.weight = gemEntry.queueWeight
-					loGemPortAttribs.pbitString = gemEntry.pbitString
-
-					logger.Debugw("prio-related GemPort attributes:", log.Fields{
-						"gemPortID":      loGemPortAttribs.gemPortID,
-						"upQueueID":      loGemPortAttribs.upQueueID,
-						"downQueueID":    loGemPortAttribs.downQueueID,
-						"pbitString":     loGemPortAttribs.pbitString,
-						"prioQueueIndex": gemEntry.prioQueueIndex,
-					})
-
-					oFsm.gemPortAttribsSlice = append(oFsm.gemPortAttribsSlice, loGemPortAttribs)
-				}
-				_ = a_pAFsm.pFsm.Event(aniEvStartConfig)
-			}
-		}(pConfigAniStateAFsm)
 	}
 }
 
@@ -429,9 +432,9 @@
 		pConfigAniStateAFsm := oFsm.pAdaptFsm
 		if pConfigAniStateAFsm != nil {
 			// obviously calling some FSM event here directly does not work - so trying to decouple it ...
-			go func(a_pAFsm *AdapterFsm) {
-				if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-					_ = a_pAFsm.pFsm.Event(aniEvReset)
+			go func(aPAFsm *AdapterFsm) {
+				if aPAFsm != nil && aPAFsm.pFsm != nil {
+					_ = aPAFsm.pFsm.Event(aniEvReset)
 				}
 			}(pConfigAniStateAFsm)
 		}
@@ -452,9 +455,9 @@
 	pConfigAniStateAFsm := oFsm.pAdaptFsm
 	if pConfigAniStateAFsm != nil {
 		// obviously calling some FSM event here directly does not work - so trying to decouple it ...
-		go func(a_pAFsm *AdapterFsm) {
-			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				_ = a_pAFsm.pFsm.Event(aniEvReset)
+		go func(aPAFsm *AdapterFsm) {
+			if aPAFsm != nil && aPAFsm.pFsm != nil {
+				_ = aPAFsm.pFsm.Event(aniEvReset)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -475,9 +478,9 @@
 		pConfigAniStateAFsm.commChan <- fsmAbortMsg
 
 		//try to restart the FSM to 'disabled', decouple event transfer
-		go func(a_pAFsm *AdapterFsm) {
-			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				_ = a_pAFsm.pFsm.Event(aniEvRestart)
+		go func(aPAFsm *AdapterFsm) {
+			if aPAFsm != nil && aPAFsm.pFsm != nil {
+				_ = aPAFsm.pFsm.Event(aniEvRestart)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -494,7 +497,7 @@
 		oFsm.aniConfigCompleted = false
 	}
 	//store that the UNI related techProfile processing is done for the given Profile and Uni
-	oFsm.pUniTechProf.setConfigDone(oFsm.pOnuUniPort.uniId, true)
+	oFsm.pUniTechProf.setConfigDone(oFsm.pOnuUniPort.uniID, true)
 	//if techProfile processing is done it must be checked, if some prior/parallel flow configuration is pending
 	go oFsm.pOmciCC.pBaseDeviceHandler.verifyUniVlanConfigRequest(oFsm.pOnuUniPort)
 
diff --git a/internal/pkg/onuadaptercore/omci_cc.go b/internal/pkg/onuadaptercore/omci_cc.go
index 1f70bd2..7efdc37 100644
--- a/internal/pkg/onuadaptercore/omci_cc.go
+++ b/internal/pkg/onuadaptercore/omci_cc.go
@@ -816,7 +816,7 @@
 func (oo *OmciCC) sendCreateMBPConfigData(ctx context.Context,
 	aPUniPort *OnuUniPort, timeout int, highPrio bool) *me.ManagedEntity {
 	tid := oo.GetNextTid(highPrio)
-	instID := macBridgePortAniEID + aPUniPort.entityId
+	instID := macBridgePortAniEID + aPUniPort.entityID
 	logger.Debugw("send MBPCD-Create-msg:", log.Fields{"device-id": oo.deviceID,
 		"SequNo": strconv.FormatInt(int64(tid), 16), "InstId": strconv.FormatInt(int64(instID), 16)})
 
@@ -826,7 +826,7 @@
 			"BridgeIdPointer": macBridgeServiceProfileEID + uint16(aPUniPort.macBpNo),
 			"PortNum":         aPUniPort.macBpNo,
 			"TpType":          uint8(aPUniPort.portType),
-			"TpPointer":       aPUniPort.entityId,
+			"TpPointer":       aPUniPort.entityID,
 		},
 	}
 	meInstance, omciErr := me.NewMacBridgePortConfigurationData(meParams)
@@ -884,7 +884,7 @@
 		EntityID: instID,
 		Attributes: me.AttributeValueMap{
 			"AssociationType":     assType,
-			"AssociatedMePointer": aPUniPort.entityId,
+			"AssociatedMePointer": aPUniPort.entityID,
 		},
 	}
 	meInstance, omciErr := me.NewExtendedVlanTaggingOperationConfigurationData(meParams)
diff --git a/internal/pkg/onuadaptercore/omci_vlan_config.go b/internal/pkg/onuadaptercore/omci_vlan_config.go
index 1a08b40..deebdb3 100644
--- a/internal/pkg/onuadaptercore/omci_vlan_config.go
+++ b/internal/pkg/onuadaptercore/omci_vlan_config.go
@@ -231,11 +231,11 @@
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
 				//stick to pythonAdapter numbering scheme
-				oFsm.vtfdID = macBridgePortAniEID + oFsm.pOnuUniPort.entityId + oFsm.techProfileID
+				oFsm.vtfdID = macBridgePortAniEID + oFsm.pOnuUniPort.entityID + oFsm.techProfileID
 				//cmp also usage in EVTOCDE create in omci_cc
 				oFsm.evtocdID = macBridgeServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo)
 
-				if oFsm.pUniTechProf.getTechProfileDone(oFsm.pOnuUniPort.uniId, oFsm.techProfileID) {
+				if oFsm.pUniTechProf.getTechProfileDone(oFsm.pOnuUniPort.uniID, oFsm.techProfileID) {
 					// let the vlan processing begin
 					_ = a_pAFsm.pFsm.Event(vlanEvStartConfig)
 				} else {
@@ -705,12 +705,12 @@
 
 func (oFsm *UniVlanConfigFsm) waitforOmciResponse() error {
 	select {
-	// maybe be also some outside cancel (but no context modelled for the moment ...)
+	// maybe be also some outside cancel (but no context modeled for the moment ...)
 	// case <-ctx.Done():
 	// 		logger.Infow("LockState-bridge-init message reception canceled", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 	case <-time.After(30 * time.Second): //AS FOR THE OTHER OMCI FSM's
 		logger.Warnw("UniVlanConfigFsm multi entity timeout", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-		return errors.New("UniVlanConfigFsm multi entity timeout")
+		return errors.New("uniVlanConfigFsm multi entity timeout")
 	case success := <-oFsm.omciMIdsResponseReceived:
 		if success {
 			logger.Debug("UniVlanConfigFsm multi entity response received")
@@ -718,6 +718,6 @@
 		}
 		// should not happen so far
 		logger.Warnw("UniVlanConfigFsm multi entity response error", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
-		return errors.New("UniVlanConfigFsm multi entity responseError")
+		return errors.New("uniVlanConfigFsm multi entity responseError")
 	}
 }
diff --git a/internal/pkg/onuadaptercore/onu_device_entry.go b/internal/pkg/onuadaptercore/onu_device_entry.go
index dfb056b..259d6d9 100644
--- a/internal/pkg/onuadaptercore/onu_device_entry.go
+++ b/internal/pkg/onuadaptercore/onu_device_entry.go
@@ -206,16 +206,16 @@
 
 //OnuDeviceEntry returns a new instance of a OnuDeviceEntry
 //mib_db (as well as not inluded alarm_db not really used in this code? VERIFY!!)
-func NewOnuDeviceEntry(ctx context.Context, device_id string, kVStoreHost string, kVStorePort int, kvStoreType string, device_Handler *DeviceHandler,
-	core_proxy adapterif.CoreProxy, adapter_proxy adapterif.AdapterProxy,
-	supported_Fsms_Ptr *OmciDeviceFsms) *OnuDeviceEntry {
-	logger.Infow("init-onuDeviceEntry", log.Fields{"device-id": device_id})
+func NewOnuDeviceEntry(ctx context.Context, deviceID string, kVStoreHost string, kVStorePort int, kvStoreType string, deviceHandler *DeviceHandler,
+	coreProxy adapterif.CoreProxy, adapterProxy adapterif.AdapterProxy,
+	supportedFsmsPtr *OmciDeviceFsms) *OnuDeviceEntry {
+	logger.Infow("init-onuDeviceEntry", log.Fields{"device-id": deviceID})
 	var onuDeviceEntry OnuDeviceEntry
 	onuDeviceEntry.started = false
-	onuDeviceEntry.deviceID = device_id
-	onuDeviceEntry.baseDeviceHandler = device_Handler
-	onuDeviceEntry.coreProxy = core_proxy
-	onuDeviceEntry.adapterProxy = adapter_proxy
+	onuDeviceEntry.deviceID = deviceID
+	onuDeviceEntry.baseDeviceHandler = deviceHandler
+	onuDeviceEntry.coreProxy = coreProxy
+	onuDeviceEntry.adapterProxy = adapterProxy
 	onuDeviceEntry.devState = DeviceStatusInit
 	onuDeviceEntry.omciRebootMessageReceivedChannel = make(chan Message, 2048)
 	//openomciagent.lockDeviceHandlersMap = sync.RWMutex{}
@@ -223,8 +223,8 @@
 	//are per ONU Vendor
 	//
 	// MIB Synchronization Database - possible overloading from arguments
-	if supported_Fsms_Ptr != nil {
-		onuDeviceEntry.supportedFsms = *supported_Fsms_Ptr
+	if supportedFsmsPtr != nil {
+		onuDeviceEntry.supportedFsms = *supportedFsmsPtr
 	} else {
 		//var mibSyncFsm = NewMibSynchronizer()
 		// use some internaö defaults, if not defined from outside
@@ -254,7 +254,7 @@
 	onuDeviceEntry.mibDebugLevel = "normal" //set to "verbose" if you want to have all output, possibly later also per config option!
 	// Omci related Mib upload sync state machine
 	mibUploadChan := make(chan Message, 2048)
-	onuDeviceEntry.pMibUploadFsm = NewAdapterFsm("MibUpload", device_id, mibUploadChan)
+	onuDeviceEntry.pMibUploadFsm = NewAdapterFsm("MibUpload", deviceID, mibUploadChan)
 	onuDeviceEntry.pMibUploadFsm.pFsm = fsm.NewFSM(
 		ulStDisabled,
 		fsm.Events{
@@ -319,7 +319,7 @@
 	)
 	// Omci related Mib download state machine
 	mibDownloadChan := make(chan Message, 2048)
-	onuDeviceEntry.pMibDownloadFsm = NewAdapterFsm("MibDownload", device_id, mibDownloadChan)
+	onuDeviceEntry.pMibDownloadFsm = NewAdapterFsm("MibDownload", deviceID, mibDownloadChan)
 	onuDeviceEntry.pMibDownloadFsm.pFsm = fsm.NewFSM(
 		dlStDisabled,
 		fsm.Events{
@@ -361,7 +361,7 @@
 
 	onuDeviceEntry.mibTemplateKVStore = onuDeviceEntry.baseDeviceHandler.SetBackend(cBasePathMibTemplateKvStore)
 	if onuDeviceEntry.mibTemplateKVStore == nil {
-		logger.Errorw("Failed to setup mibTemplateKVStore", log.Fields{"device-id": device_id})
+		logger.Errorw("Failed to setup mibTemplateKVStore", log.Fields{"device-id": deviceID})
 	}
 
 	// Alarm Synchronization Database
@@ -378,7 +378,7 @@
 		oo.coreProxy, oo.adapterProxy)
 	if oo.PDevOmciCC == nil {
 		logger.Errorw("Could not create devOmciCc - abort", log.Fields{"for device-id": oo.deviceID})
-		return errors.New("Could not create devOmciCc")
+		return errors.New("could not create devOmciCc")
 	}
 
 	oo.started = true
@@ -410,54 +410,54 @@
 	select {
 	case <-time.After(3 * time.Second): //3s was detected to be to less in 8*8 bbsim test with debug Info/Debug
 		logger.Warnw("Reboot timeout", log.Fields{"for device-id": oo.deviceID})
-		return errors.New("RebootTimeout")
+		return errors.New("rebootTimeout")
 	case data := <-responseChannel:
 		switch data.Data.(OmciMessage).OmciMsg.MessageType {
 		case omci.RebootResponseType:
 			{
 				msgLayer := (*data.Data.(OmciMessage).OmciPacket).Layer(omci.LayerTypeRebootResponse)
 				if msgLayer == nil {
-					return errors.New("Omci Msg layer could not be detected for RebootResponseType")
+					return errors.New("omci Msg layer could not be detected for RebootResponseType")
 				}
 				msgObj, msgOk := msgLayer.(*omci.GetResponse)
 				if !msgOk {
-					return errors.New("Omci Msg layer could not be assigned for RebootResponseType")
+					return errors.New("omci Msg layer could not be assigned for RebootResponseType")
 				}
 				logger.Debugw("CreateResponse Data", log.Fields{"device-id": oo.deviceID, "data-fields": msgObj})
 				if msgObj.Result != me.Success {
 					logger.Errorw("Omci RebootResponseType Error ", log.Fields{"Error": msgObj.Result})
 					// possibly force FSM into abort or ignore some errors for some messages? store error for mgmt display?
-					return errors.New("Omci RebootResponse Result Error indication")
+					return errors.New("omci RebootResponse Result Error indication")
 				}
 				return nil
 			}
 		}
 		logger.Warnw("Reboot response error", log.Fields{"for device-id": oo.deviceID})
-		return errors.New("Unexpected OmciResponse type received")
+		return errors.New("unexpected OmciResponse type received")
 	}
 }
 
 //Relay the InSync message via Handler to Rw core - Status update
-func (oo *OnuDeviceEntry) transferSystemEvent(dev_Event OnuDeviceEvent) {
-	logger.Debugw("relaying system-event", log.Fields{"Event": dev_Event})
+func (oo *OnuDeviceEntry) transferSystemEvent(devEvent OnuDeviceEvent) {
+	logger.Debugw("relaying system-event", log.Fields{"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 dev_Event == MibDatabaseSync {
+	if devEvent == MibDatabaseSync {
 		if oo.devState < MibDatabaseSync { //devState has not been synced yet
 			oo.devState = MibDatabaseSync
-			go oo.baseDeviceHandler.DeviceProcStatusUpdate(dev_Event)
+			go oo.baseDeviceHandler.DeviceProcStatusUpdate(devEvent)
 			//TODO!!! device control: next step: start MIB capability verification from here ?!!!
 		} else {
 			logger.Debugw("mibinsync-event in some already synced state - ignored", log.Fields{"state": oo.devState})
 		}
-	} else if dev_Event == MibDownloadDone {
+	} else if devEvent == MibDownloadDone {
 		if oo.devState < MibDownloadDone { //devState has not been synced yet
 			oo.devState = MibDownloadDone
-			go oo.baseDeviceHandler.DeviceProcStatusUpdate(dev_Event)
+			go oo.baseDeviceHandler.DeviceProcStatusUpdate(devEvent)
 		} else {
 			logger.Debugw("mibdownloaddone-event was already seen - ignored", log.Fields{"state": oo.devState})
 		}
 	} else {
-		logger.Warnw("device-event not yet handled", log.Fields{"state": dev_Event})
+		logger.Warnw("device-event not yet handled", log.Fields{"state": devEvent})
 	}
 }
diff --git a/internal/pkg/onuadaptercore/onu_uni_port.go b/internal/pkg/onuadaptercore/onu_uni_port.go
index 568c1d0..7ce362f 100644
--- a/internal/pkg/onuadaptercore/onu_uni_port.go
+++ b/internal/pkg/onuadaptercore/onu_uni_port.go
@@ -51,29 +51,29 @@
 	portNo     uint32
 	portType   UniPortType
 	ofpPortNo  string
-	uniId      uint8
+	uniID      uint8
 	macBpNo    uint8
-	entityId   uint16
+	entityID   uint16
 	adminState vc.AdminState_Types
 	operState  vc.OperStatus_Types
 	pPort      *voltha.Port
 }
 
 //NewOnuUniPort returns a new instance of a OnuUniPort
-func NewOnuUniPort(a_uniId uint8, a_portNo uint32, a_InstNo uint16,
-	a_portType UniPortType) *OnuUniPort {
-	logger.Infow("init-onuUniPort", log.Fields{"uniId": a_uniId,
-		"portNo": a_portNo, "InstNo": a_InstNo, "type": a_portType})
+func NewOnuUniPort(aUniID uint8, aPortNo uint32, aInstNo uint16,
+	aPortType UniPortType) *OnuUniPort {
+	logger.Infow("init-onuUniPort", log.Fields{"uniID": aUniID,
+		"portNo": aPortNo, "InstNo": aInstNo, "type": aPortType})
 	var onuUniPort OnuUniPort
 	onuUniPort.enabled = false
-	onuUniPort.name = "uni-" + strconv.FormatUint(uint64(a_portNo), 10)
-	onuUniPort.portNo = a_portNo
-	onuUniPort.portType = a_portType
+	onuUniPort.name = "uni-" + strconv.FormatUint(uint64(aPortNo), 10)
+	onuUniPort.portNo = aPortNo
+	onuUniPort.portType = aPortType
 	// so far it seems as here ofpPortNo/Name ist the same as the original port name ...??
 	onuUniPort.ofpPortNo = onuUniPort.name
-	onuUniPort.uniId = a_uniId
-	onuUniPort.macBpNo = a_uniId + 1 //ensure >0 instanceNo
-	onuUniPort.entityId = a_InstNo
+	onuUniPort.uniID = aUniID
+	onuUniPort.macBpNo = aUniID + 1 //ensure >0 instanceNo
+	onuUniPort.entityID = aInstNo
 	onuUniPort.adminState = vc.AdminState_ENABLED //enabled per create
 	onuUniPort.operState = vc.OperStatus_UNKNOWN
 	onuUniPort.pPort = nil // to be set on create
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index 1a80441..5780308 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -52,7 +52,7 @@
 )
 
 type uniPersData struct {
-	PersUniId  uint32 `json:"uni_id"`
+	PersUniID  uint32 `json:"uni_id"`
 	PersTpPath string `json:"tp_path"`
 }
 
@@ -226,7 +226,7 @@
 
 	if onuTP.techProfileKVStore == nil {
 		logger.Debug("techProfileKVStore not set - abort")
-		onuTP.procResult = errors.New("TechProfile config aborted: techProfileKVStore not set")
+		onuTP.procResult = errors.New("techProfile config aborted: techProfileKVStore not set")
 		return
 	}
 
@@ -234,7 +234,7 @@
 	var pCurrentUniPort *OnuUniPort
 	for _, uniPort := range onuTP.baseDeviceHandler.uniEntityMap {
 		// only if this port is validated for operState transfer
-		if uniPort.uniId == uint8(aUniID) {
+		if uniPort.uniID == uint8(aUniID) {
 			pCurrentUniPort = uniPort
 			break //found - end search loop
 		}
@@ -242,7 +242,7 @@
 	if pCurrentUniPort == nil {
 		logger.Errorw("TechProfile configuration aborted: requested uniID not found in PortDB",
 			log.Fields{"device-id": onuTP.deviceID, "uniID": aUniID})
-		onuTP.procResult = errors.New("TechProfile config aborted: requested uniID not found")
+		onuTP.procResult = errors.New("techProfile config aborted: requested uniID not found")
 		return
 	}
 
@@ -271,7 +271,7 @@
 		//timeout or error detected
 		logger.Debugw("tech-profile related configuration aborted on read",
 			log.Fields{"device-id": onuTP.deviceID, "UniId": aUniID})
-		onuTP.procResult = errors.New("TechProfile config aborted: tech-profile read issue")
+		onuTP.procResult = errors.New("techProfile config aborted: tech-profile read issue")
 		return
 	}
 
@@ -284,7 +284,7 @@
 				//timeout or error detected
 				logger.Debugw("tech-profile related configuration aborted on set",
 					log.Fields{"device-id": onuTP.deviceID, "UniId": aUniID})
-				onuTP.procResult = errors.New("TechProfile config aborted: Omci AniSideConfig failed")
+				onuTP.procResult = errors.New("techProfile config aborted: Omci AniSideConfig failed")
 				//this issue here means that the AniConfigFsm has not finished successfully
 				//which requires to reset it to allow for new usage, e.g. also on a different UNI
 				//(without that it would be reset on device down indication latest)
@@ -295,13 +295,13 @@
 			// strange: UNI entry exists, but no ANI data, maybe such situation should be cleared up (if observed)
 			logger.Debugw("no Tcont/Gem data for this UNI found - abort", log.Fields{
 				"device-id": onuTP.deviceID, "uniID": aUniID})
-			onuTP.procResult = errors.New("TechProfile config aborted: no Tcont/Gem data found for this UNI")
+			onuTP.procResult = errors.New("techProfile config aborted: no Tcont/Gem data found for this UNI")
 			return
 		}
 	} else {
 		logger.Debugw("no PonAni data for this UNI found - abort", log.Fields{
 			"device-id": onuTP.deviceID, "uniID": aUniID})
-		onuTP.procResult = errors.New("TechProfile config aborted: no AniSide data found for this UNI")
+		onuTP.procResult = errors.New("techProfile config aborted: no AniSide data found for this UNI")
 		return
 	}
 }
@@ -311,7 +311,7 @@
 
 	if onuTP.onuKVStore == nil {
 		logger.Debugw("onuKVStore not set - abort", log.Fields{"device-id": onuTP.deviceID})
-		onuTP.procResult = errors.New("ONU/TP-data update aborted: onuKVStore not set")
+		onuTP.procResult = errors.New("onu/tp-data update aborted: onuKVStore not set")
 		return
 	}
 	var processingStep uint8 = 1 // used to synchronize the different processing steps with chTpKvProcessingStep
@@ -319,7 +319,7 @@
 	if !onuTP.waitForTimeoutOrCompletion(ctx, onuTP.chTpKvProcessingStep, processingStep) {
 		//timeout or error detected
 		logger.Debugw("ONU/TP-data not written - abort", log.Fields{"device-id": onuTP.deviceID})
-		onuTP.procResult = errors.New("ONU/TP-data update aborted: during writing process")
+		onuTP.procResult = errors.New("onu/tp-data update aborted: during writing process")
 		return
 	}
 }
@@ -382,7 +382,7 @@
 
 	for k, v := range onuTP.mapUniTpPath {
 		onuTP.sOnuPersistentData.PersUniTpPath =
-			append(onuTP.sOnuPersistentData.PersUniTpPath, uniPersData{PersUniId: k, PersTpPath: v})
+			append(onuTP.sOnuPersistentData.PersUniTpPath, uniPersData{PersUniID: k, PersTpPath: v})
 	}
 	logger.Debugw("Update ONU/TP-data in KVStore", log.Fields{"device-id": onuTP.deviceID, "onuTP.sOnuPersistentData": onuTP.sOnuPersistentData})
 
@@ -422,7 +422,7 @@
 				"device-id": onuTP.deviceID})
 
 			for _, uniData := range onuTP.sOnuPersistentData.PersUniTpPath {
-				onuTP.mapUniTpPath[uniData.PersUniId] = uniData.PersTpPath
+				onuTP.mapUniTpPath[uniData.PersUniID] = uniData.PersTpPath
 			}
 			logger.Debugw("TpPath map", log.Fields{"onuTP.mapUniTpPath": onuTP.mapUniTpPath,
 				"device-id": onuTP.deviceID})
diff --git a/internal/pkg/onuadaptercore/uniportadmin.go b/internal/pkg/onuadaptercore/uniportadmin.go
index 874bf86..dcedd57 100644
--- a/internal/pkg/onuadaptercore/uniportadmin.go
+++ b/internal/pkg/onuadaptercore/uniportadmin.go
@@ -345,11 +345,11 @@
 
 		var meInstance *me.ManagedEntity
 		if uniPort.portType == UniPPTP {
-			meInstance = oFsm.pOmciCC.sendSetUniGLS(context.TODO(), uniPort.entityId, ConstDefaultOmciTimeout,
+			meInstance = oFsm.pOmciCC.sendSetUniGLS(context.TODO(), uniPort.entityID, ConstDefaultOmciTimeout,
 				true, requestedAttributes, oFsm.pAdaptFsm.commChan)
 			oFsm.pOmciCC.pLastTxMeInstance = meInstance
 		} else if uniPort.portType == UniVEIP {
-			meInstance = oFsm.pOmciCC.sendSetVeipLS(context.TODO(), uniPort.entityId, ConstDefaultOmciTimeout,
+			meInstance = oFsm.pOmciCC.sendSetVeipLS(context.TODO(), uniPort.entityID, ConstDefaultOmciTimeout,
 				true, requestedAttributes, oFsm.pAdaptFsm.commChan)
 			oFsm.pOmciCC.pLastTxMeInstance = meInstance
 		} else {