[VOL-3119] Refactoring: Define string constants for all FSM events/states
correction delivery for [VOL-3038] Configuration of tech profiles 1t1gem - Response after processing with possible error indication

Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: I406b6e373ac7568efd856bf4b6807c6e91d16dc8
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index f27e3da..a580530 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -47,6 +47,23 @@
 )
 */
 
+const (
+	// events of Device FSM
+	devEvDeviceInit       = "devEvDeviceInit"
+	devEvGrpcConnected    = "devEvGrpcConnected"
+	devEvGrpcDisconnected = "devEvGrpcDisconnected"
+	devEvDeviceUpInd      = "devEvDeviceUpInd"
+	devEvDeviceDownInd    = "devEvDeviceDownInd"
+)
+const (
+	// states of Device FSM
+	devStNull      = "devStNull"
+	devStDown      = "devStDown"
+	devStInit      = "devStInit"
+	devStConnected = "devStConnected"
+	devStUp        = "devStUp"
+)
+
 //Event category and subcategory definitions - same as defiend for OLT in eventmgr.go  - should be done more centrally
 const (
 	pon           = voltha.EventSubCategory_PON
@@ -136,23 +153,23 @@
 
 	// Device related state machine
 	dh.pDeviceStateFsm = fsm.NewFSM(
-		"null",
+		devStNull,
 		fsm.Events{
-			{Name: "DeviceInit", Src: []string{"null", "down"}, Dst: "init"},
-			{Name: "GrpcConnected", Src: []string{"init"}, Dst: "connected"},
-			{Name: "GrpcDisconnected", Src: []string{"connected", "down"}, Dst: "init"},
-			{Name: "DeviceUpInd", Src: []string{"connected", "down"}, Dst: "up"},
-			{Name: "DeviceDownInd", Src: []string{"up"}, Dst: "down"},
+			{Name: devEvDeviceInit, Src: []string{devStNull, devStDown}, Dst: devStInit},
+			{Name: devEvGrpcConnected, Src: []string{devStInit}, Dst: devStConnected},
+			{Name: devEvGrpcDisconnected, Src: []string{devStConnected, devStDown}, Dst: devStInit},
+			{Name: devEvDeviceUpInd, Src: []string{devStConnected, devStDown}, Dst: devStUp},
+			{Name: devEvDeviceDownInd, Src: []string{devStUp}, Dst: devStDown},
 		},
 		fsm.Callbacks{
-			"before_event":            func(e *fsm.Event) { dh.logStateChange(e) },
-			"before_DeviceInit":       func(e *fsm.Event) { dh.doStateInit(e) },
-			"after_DeviceInit":        func(e *fsm.Event) { dh.postInit(e) },
-			"before_GrpcConnected":    func(e *fsm.Event) { dh.doStateConnected(e) },
-			"before_GrpcDisconnected": func(e *fsm.Event) { dh.doStateInit(e) },
-			"after_GrpcDisconnected":  func(e *fsm.Event) { dh.postInit(e) },
-			"before_DeviceUpInd":      func(e *fsm.Event) { dh.doStateUp(e) },
-			"before_DeviceDownInd":    func(e *fsm.Event) { dh.doStateDown(e) },
+			"before_event":                      func(e *fsm.Event) { dh.logStateChange(e) },
+			("before_" + devEvDeviceInit):       func(e *fsm.Event) { dh.doStateInit(e) },
+			("after_" + devEvDeviceInit):        func(e *fsm.Event) { dh.postInit(e) },
+			("before_" + devEvGrpcConnected):    func(e *fsm.Event) { dh.doStateConnected(e) },
+			("before_" + devEvGrpcDisconnected): func(e *fsm.Event) { dh.doStateInit(e) },
+			("after_" + devEvGrpcDisconnected):  func(e *fsm.Event) { dh.postInit(e) },
+			("before_" + devEvDeviceUpInd):      func(e *fsm.Event) { dh.doStateUp(e) },
+			("before_" + devEvDeviceDownInd):    func(e *fsm.Event) { dh.doStateDown(e) },
 		},
 	)
 
@@ -180,8 +197,8 @@
 	logger.Debugw("Adopt_device", log.Fields{"deviceID": device.Id, "Address": device.GetHostAndPort()})
 
 	logger.Debugw("Device FSM: ", log.Fields{"state": string(dh.pDeviceStateFsm.Current())})
-	if dh.pDeviceStateFsm.Is("null") {
-		if err := dh.pDeviceStateFsm.Event("DeviceInit"); err != nil {
+	if dh.pDeviceStateFsm.Is(devStNull) {
+		if err := dh.pDeviceStateFsm.Event(devEvDeviceInit); err != nil {
 			logger.Errorw("Device FSM: Can't go to state DeviceInit", log.Fields{"err": err})
 		}
 		logger.Debugw("Device FSM: ", log.Fields{"state": string(dh.pDeviceStateFsm.Current())})
@@ -270,6 +287,11 @@
 					log.Fields{"deviceID": 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{"deviceId": dh.deviceID})
+				return errors.New("device-unreachable")
+			}
 
 			msgBody := msg.GetBody()
 			techProfMsg := &ic.InterAdapterTechProfileDownloadMessage{}
@@ -296,16 +318,20 @@
 				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, techProfMsg.UniId, techProfMsg.Path, &wg)
 				go dh.pOnuTP.updateOnuTpPathKvStore(dctx, &wg)
 				//the wait.. function is responsible for tpProcMutex.Unlock()
-				go dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
-			} else {
-				dh.pOnuTP.unlockTpProcMutex()
+				err := dh.pOnuTP.waitForTpCompletion(cancel, &wg) //wait for background process to finish and collet their result
+				return err
 			}
+			// no change, nothing really to do
+			dh.pOnuTP.unlockTpProcMutex()
+			//return success
+			return nil
 		}
 	case ic.InterAdapterMessageType_DELETE_GEM_PORT_REQUEST:
 		{
@@ -331,12 +357,14 @@
 			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()
-			go dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
+			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:
 		{
@@ -362,6 +390,7 @@
 				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,
@@ -369,10 +398,12 @@
 				// 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()
-				go dh.pOnuTP.waitForTpCompletion(cancel, &wg) //let that also run off-line to let the IA messaging return!
-			} else {
-				dh.pOnuTP.unlockTpProcMutex()
+				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
 		}
 	default:
 		{
@@ -866,11 +897,16 @@
 	// PM related heartbeat??? !!!TODO....
 	//self._heartbeat.enabled = True
 
-	//call MibUploadFSM - transition up to state "in_sync"
+	/* Note: Even though FSM calls look 'synchronous' here, FSM is running in background with the effect that possible errors
+	 * 	 within the MibUpload are not notified in the OnuIndication response, this might be acceptable here,
+	 *   as further OltAdapter processing may rely on the deviceReason event 'MibUploadDone' as a result of the FSM processing
+	 *   otherwise some processing synchronisation would be required - cmp. e.g TechProfile processing
+	 */
+	//call MibUploadFSM - transition up to state ulStInSync
 	pMibUlFsm := pDevEntry.pMibUploadFsm.pFsm
 	if pMibUlFsm != nil {
-		if pMibUlFsm.Is("disabled") {
-			if err := pMibUlFsm.Event("start"); err != nil {
+		if pMibUlFsm.Is(ulStDisabled) {
+			if err := pMibUlFsm.Event(ulEvStart); err != nil {
 				logger.Errorw("MibSyncFsm: Can't go to state starting", log.Fields{"err": err})
 				return errors.New("Can't go to state starting")
 			} else {
@@ -878,18 +914,18 @@
 				//Determine ONU status and start/re-start MIB Synchronization tasks
 				//Determine if this ONU has ever synchronized
 				if true { //TODO: insert valid check
-					if err := pMibUlFsm.Event("reset_mib"); err != nil {
+					if err := pMibUlFsm.Event(ulEvResetMib); err != nil {
 						logger.Errorw("MibSyncFsm: Can't go to state resetting_mib", log.Fields{"err": err})
 						return errors.New("Can't go to state resetting_mib")
 					}
 				} else {
-					pMibUlFsm.Event("examine_mds")
+					pMibUlFsm.Event(ulEvExamineMds)
 					logger.Debugw("state of MibSyncFsm", log.Fields{"state": string(pMibUlFsm.Current())})
 					//Examine the MIB Data Sync
 					// callbacks to be handled:
-					// Event("success")
-					// Event("timeout")
-					// Event("mismatch")
+					// Event(ulEvSuccess)
+					// Event(ulEvTimeout)
+					// Event(ulEvMismatch)
 				}
 			}
 		} else {
@@ -919,29 +955,29 @@
 			{ //MIBSync FSM may run
 				pMibUlFsm := pDevEntry.pMibUploadFsm.pFsm
 				if pMibUlFsm != nil {
-					pMibUlFsm.Event("stop") //TODO!! verify if MibSyncFsm stop-processing is sufficient (to allow it again afterwards)
+					pMibUlFsm.Event(ulEvStop) //TODO!! verify if MibSyncFsm stop-processing is sufficient (to allow it again afterwards)
 				}
 			}
 		case "discovery-mibsync-complete":
 			{ //MibDownload may run
 				pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
 				if pMibDlFsm != nil {
-					pMibDlFsm.Event("reset")
+					pMibDlFsm.Event(dlEvReset)
 				}
 			}
 		default:
 			{
 				//port lock/unlock FSM's may be active
 				if dh.pUnlockStateFsm != nil {
-					dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event("reset")
+					dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 				}
 				if dh.pLockStateFsm != nil {
-					dh.pLockStateFsm.pAdaptFsm.pFsm.Event("reset")
+					dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 				}
 				//techProfile related PonAniConfigFsm FSM may be active
 				// maybe encapsulated as OnuTP method - perhaps later in context of module splitting
 				if dh.pOnuTP.pAniConfigFsm != nil {
-					dh.pOnuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event("reset")
+					dh.pOnuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 				}
 			}
 			//TODO!!! care about PM/Alarm processing once started
@@ -1055,14 +1091,14 @@
 			 */
 			pMibDlFsm := pDevEntry.pMibDownloadFsm.pFsm
 			if pMibDlFsm != nil {
-				if pMibDlFsm.Is("disabled") {
-					if err := pMibDlFsm.Event("start"); err != 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("create_gal"); err != nil {
+						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())})
@@ -1283,20 +1319,20 @@
 		pLSStatemachine = dh.pLockStateFsm.pAdaptFsm.pFsm
 		//make sure the opposite FSM is not running and if so, terminate it as not relevant anymore
 		if (dh.pUnlockStateFsm != nil) &&
-			(dh.pUnlockStateFsm.pAdaptFsm.pFsm.Current() != "disabled") {
-			dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event("reset")
+			(dh.pUnlockStateFsm.pAdaptFsm.pFsm.Current() != uniStDisabled) {
+			dh.pUnlockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 		}
 	} else {
 		pLSStatemachine = dh.pUnlockStateFsm.pAdaptFsm.pFsm
 		//make sure the opposite FSM is not running and if so, terminate it as not relevant anymore
 		if (dh.pLockStateFsm != nil) &&
-			(dh.pLockStateFsm.pAdaptFsm.pFsm.Current() != "disabled") {
-			dh.pLockStateFsm.pAdaptFsm.pFsm.Event("reset")
+			(dh.pLockStateFsm.pAdaptFsm.pFsm.Current() != uniStDisabled) {
+			dh.pLockStateFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 		}
 	}
 	if pLSStatemachine != nil {
-		if pLSStatemachine.Is("disabled") {
-			if err := pLSStatemachine.Event("start"); err != nil {
+		if pLSStatemachine.Is(uniStDisabled) {
+			if err := pLSStatemachine.Event(uniEvStart); err != nil {
 				logger.Warnw("LockStateFSM: can't start", log.Fields{"err": err})
 				// maybe try a FSM reset and then again ... - TODO!!!
 			} else {
diff --git a/internal/pkg/onuadaptercore/mib_download.go b/internal/pkg/onuadaptercore/mib_download.go
index b6af09b..d271a16 100644
--- a/internal/pkg/onuadaptercore/mib_download.go
+++ b/internal/pkg/onuadaptercore/mib_download.go
@@ -74,7 +74,7 @@
 		// 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("reset")
+				a_pAFsm.pFsm.Event(dlEvReset)
 			}
 		}(pMibDlFsm)
 	}
@@ -97,7 +97,7 @@
 		// see DownloadedState: decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event("restart")
+				a_pAFsm.pFsm.Event(dlEvRestart)
 			}
 		}(pMibDlFsm)
 	}
@@ -115,7 +115,7 @@
 			if !ok {
 				logger.Info("MibDownload Rx Msg", log.Fields{"Message couldn't be read from channel for device-id": onuDeviceEntry.deviceID})
 				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				onuDeviceEntry.pMibDownloadFsm.pFsm.Event("restart")
+				onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRestart)
 				break loop
 			}
 			logger.Debugw("MibDownload Rx Msg", log.Fields{"Received message for device-id": onuDeviceEntry.deviceID})
@@ -179,7 +179,7 @@
 				switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
 				case "GalEthernetProfile":
 					{ // let the FSM proceed ...
-						onuDeviceEntry.pMibDownloadFsm.pFsm.Event("rx_gal_resp")
+						onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxGalResp)
 					}
 				case "MacBridgeServiceProfile",
 					"MacBridgePortConfigurationData",
@@ -221,7 +221,7 @@
 				switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
 				case "Onu2G":
 					{ // let the FSM proceed ...
-						onuDeviceEntry.pMibDownloadFsm.pFsm.Event("rx_onu2g_resp")
+						onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxOnu2gResp)
 					}
 					//so far that was the only MibDownlad Set Element ...
 				}
@@ -248,7 +248,7 @@
 		err := onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at MBSP, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event("reset")
+			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 
@@ -260,7 +260,7 @@
 		err = onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at MBPCD, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event("reset")
+			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 
@@ -272,14 +272,14 @@
 		err = onuDeviceEntry.waitforOmciResponse(meInstance)
 		if err != nil {
 			logger.Error("InitialBridgeSetup failed at EVTOCD, aborting MIB Download!")
-			onuDeviceEntry.pMibDownloadFsm.pFsm.Event("reset")
+			onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvReset)
 			return
 		}
 	}
 	// if Config has been done for all UNI related instances let the FSM proceed
 	// while we did not check here, if there is some port at all - !?
 	logger.Infow("IntialBridgeSetup finished", log.Fields{"deviceId": onuDeviceEntry.deviceID})
-	onuDeviceEntry.pMibDownloadFsm.pFsm.Event("rx_bridge_resp")
+	onuDeviceEntry.pMibDownloadFsm.pFsm.Event(dlEvRxBridgeResp)
 	return
 }
 
diff --git a/internal/pkg/onuadaptercore/mib_sync.go b/internal/pkg/onuadaptercore/mib_sync.go
index 88c8620..abb80f1 100644
--- a/internal/pkg/onuadaptercore/mib_sync.go
+++ b/internal/pkg/onuadaptercore/mib_sync.go
@@ -263,7 +263,7 @@
 	}
 	logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
 	// TODO: only this action?
-	onuDeviceEntry.pMibUploadFsm.pFsm.Event("stop")
+	onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
 }
 
 func (onuDeviceEntry *OnuDeviceEntry) handleTestMsg(msg TestMessage) {
@@ -272,10 +272,10 @@
 
 	switch msg.TestMessageVal {
 	case LoadMibTemplateFailed:
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event("upload_mib")
+		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvUploadMib)
 		logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())})
 	case LoadMibTemplateOk:
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event("success")
+		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
 		logger.Debugw("MibSync Msg", log.Fields{"state": string(onuDeviceEntry.pMibUploadFsm.pFsm.Current())})
 	default:
 		logger.Warn("MibSync Msg", log.Fields{"Unknown message type received for device-id": onuDeviceEntry.deviceID, "msg.TestMessageVal": msg.TestMessageVal})
@@ -283,14 +283,14 @@
 }
 
 func (onuDeviceEntry *OnuDeviceEntry) handleOmciMessage(msg OmciMessage) {
-
-	logger.Debugw("MibSync Msg", log.Fields{"OmciMessage received for device-id": onuDeviceEntry.deviceID,
-		"msgType": msg.OmciMsg.MessageType})
-
+	if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+		logger.Debugw("MibSync Msg", log.Fields{"OmciMessage received for device-id": onuDeviceEntry.deviceID,
+			"msgType": msg.OmciMsg.MessageType})
+	}
 	//further analysis could be done here based on msg.OmciMsg.Payload, e.g. verification of error code ...
 	switch msg.OmciMsg.MessageType {
 	case omci.MibResetResponseType:
-		if onuDeviceEntry.pMibUploadFsm.pFsm.Is("resetting_mib") {
+		if onuDeviceEntry.pMibUploadFsm.pFsm.Is(ulStResettingMib) {
 			msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibResetResponse)
 			if msgLayer != nil {
 				msgObj, msgOk := msgLayer.(*omci.MibResetResponse)
@@ -298,7 +298,7 @@
 					logger.Debugw("MibResetResponse Data", log.Fields{"data-fields": msgObj})
 					if msgObj.Result == me.Success {
 						// trigger retrieval of VendorId and SerialNumber
-						onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_vendor_and_serial")
+						onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetVendorAndSerial)
 						return
 					} else {
 						logger.Errorw("Omci MibResetResponse Error", log.Fields{"Error": msgObj.Result})
@@ -312,7 +312,8 @@
 		} else {
 			logger.Errorw("Omci MibResetResponse received", log.Fields{"in state ": onuDeviceEntry.pMibUploadFsm.pFsm.Current})
 		}
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event("stop")
+		logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
+		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
 
 	case omci.MibUploadResponseType:
 		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadResponse)
@@ -333,7 +334,7 @@
 		} else {
 			logger.Error("Invalid number of commands received for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "uploadNoOfCmds": onuDeviceEntry.PDevOmciCC.uploadNoOfCmds})
 			//TODO right action?
-			onuDeviceEntry.pMibUploadFsm.pFsm.Event("timeout")
+			onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvTimeout)
 		}
 	case omci.MibUploadNextResponseType:
 		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeMibUploadNextResponse)
@@ -346,8 +347,9 @@
 			logger.Error("Omci Msg layer could not be assigned")
 			return
 		}
-		logger.Debugw("MibUploadNextResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
-
+		if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+			logger.Debugw("MibUploadNextResponse Data for:", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+		}
 		meClassId := msgObj.ReportedME.GetClassID()
 		meEntityId := msgObj.ReportedME.GetEntityID()
 		meAttributes := msgObj.ReportedME.GetAttributeValueMap()
@@ -359,7 +361,7 @@
 		} else {
 			//TODO
 			onuDeviceEntry.pOnuDB.LogMeDb()
-			onuDeviceEntry.pMibUploadFsm.pFsm.Event("success")
+			onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvSuccess)
 		}
 	case omci.GetResponseType:
 		msgLayer := (*msg.OmciPacket).Layer(omci.LayerTypeGetResponse)
@@ -373,7 +375,9 @@
 						meAttributes := msgObj.Attributes
 						switch onuDeviceEntry.PDevOmciCC.pLastTxMeInstance.GetName() {
 						case "OnuG":
-							logger.Debugw("MibSync FSM - GetResponse Data for Onu-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+								logger.Debugw("MibSync FSM - GetResponse Data for Onu-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							}
 							onuDeviceEntry.vendorID = fmt.Sprintf("%s", meAttributes["VendorId"])
 							snBytes, _ := me.InterfaceToOctets(meAttributes["SerialNumber"])
 							if OnugSerialNumberLen == len(snBytes) {
@@ -386,18 +390,22 @@
 								logger.Errorw("MibSync FSM - SerialNumber has wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(snBytes)})
 							}
 							// trigger retrieval of EquipmentId
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_equipment_id")
+							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetEquipmentId)
 							return
 						case "Onu2G":
-							logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+								logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							}
 							onuDeviceEntry.equipmentID = fmt.Sprintf("%s", meAttributes["EquipmentId"])
 							logger.Debugw("MibSync FSM - GetResponse Data for Onu2-G - EquipmentId", log.Fields{"deviceId": onuDeviceEntry.deviceID,
 								"onuDeviceEntry.equipmentID": onuDeviceEntry.equipmentID})
 							// trigger retrieval of 1st SW-image info
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_first_sw_version")
+							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetFirstSwVersion)
 							return
 						case "SoftwareImage":
-							logger.Debugw("MibSync FSM - GetResponse Data for SoftwareImage", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+								logger.Debugw("MibSync FSM - GetResponse Data for SoftwareImage", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							}
 							if entityId <= SecondSwImageMeId {
 								onuDeviceEntry.swImages[entityId].version = fmt.Sprintf("%s", meAttributes["Version"])
 								onuDeviceEntry.swImages[entityId].isActive = meAttributes["IsActive"].(uint8)
@@ -408,15 +416,17 @@
 								//TODO: error handling
 							}
 							if FirstSwImageMeId == entityId {
-								onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_second_sw_version")
+								onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetSecondSwVersion)
 								return
 							} else if SecondSwImageMeId == entityId {
-								onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_mac_address")
+								onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMacAddress)
 								return
 							}
 						case "IpHostConfigData":
 							///
-							logger.Debugw("MibSync FSM - GetResponse Data for IpHostConfigData", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							if onuDeviceEntry.mibDebugLevel == "VERBOSE" {
+								logger.Debugw("MibSync FSM - GetResponse Data for IpHostConfigData", log.Fields{"deviceId": onuDeviceEntry.deviceID, "data-fields": msgObj})
+							}
 							macBytes, _ := me.InterfaceToOctets(meAttributes["MacAddress"])
 							if OmciMacAddressLen == len(macBytes) {
 								onuDeviceEntry.macAddress = hex.EncodeToString(macBytes[:])
@@ -426,7 +436,8 @@
 								logger.Errorw("MibSync FSM - MacAddress wrong length", log.Fields{"deviceId": onuDeviceEntry.deviceID, "length": len(macBytes)})
 							}
 							// trigger retrieval of mib template
-							onuDeviceEntry.pMibUploadFsm.pFsm.Event("get_mib_template")
+							onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvGetMibTemplate)
+							return
 						}
 					}
 				} else {
@@ -438,8 +449,8 @@
 		} else {
 			logger.Error("Omci Msg layer could not be detected for GetResponse")
 		}
-		//
-		onuDeviceEntry.pMibUploadFsm.pFsm.Event("stop")
+		logger.Info("MibSync Msg", log.Fields{"Stopped handling of MibSyncChan for device-id": onuDeviceEntry.deviceID})
+		onuDeviceEntry.pMibUploadFsm.pFsm.Event(ulEvStop)
 	}
 }
 
diff --git a/internal/pkg/onuadaptercore/omci_ani_config.go b/internal/pkg/onuadaptercore/omci_ani_config.go
index d968edb..54e8a50 100644
--- a/internal/pkg/onuadaptercore/omci_ani_config.go
+++ b/internal/pkg/onuadaptercore/omci_ani_config.go
@@ -33,7 +33,38 @@
 	//"github.com/opencord/voltha-protos/v3/go/voltha"
 )
 
-//UniPonAniConfigFsm defines the structure for the state machine to lock/unlock the ONU UNI ports via OMCI
+const (
+	// events of config PON ANI port FSM
+	aniEvStart           = "uniEvStart"
+	aniEvStartConfig     = "aniEvStartConfig"
+	aniEvRxDot1pmapCresp = "aniEvRxDot1pmapCresp"
+	aniEvRxMbpcdResp     = "aniEvRxMbpcdResp"
+	aniEvRxTcontsResp    = "aniEvRxTcontsResp"
+	aniEvRxGemntcpsResp  = "aniEvRxGemntcpsResp"
+	aniEvRxGemiwsResp    = "aniEvRxGemiwsResp"
+	aniEvRxPrioqsResp    = "aniEvRxPrioqsResp"
+	aniEvRxDot1pmapSresp = "aniEvRxDot1pmapSresp"
+	aniEvTimeoutSimple   = "aniEvTimeoutSimple"
+	aniEvTimeoutMids     = "aniEvTimeoutMids"
+	aniEvReset           = "aniEvReset"
+	aniEvRestart         = "aniEvRestart"
+)
+const (
+	// states of config PON ANI port FSM
+	aniStDisabled            = "aniStDisabled"
+	aniStStarting            = "aniStStarting"
+	aniStCreatingDot1PMapper = "aniStCreatingDot1PMapper"
+	aniStCreatingMBPCD       = "aniStCreatingMBPCD"
+	aniStSettingTconts       = "aniStSettingTconts"
+	aniStCreatingGemNCTPs    = "aniStCreatingGemNCTPs"
+	aniStCreatingGemIWs      = "aniStCreatingGemIWs"
+	aniStSettingPQs          = "aniStSettingPQs"
+	aniStSettingDot1PMapper  = "aniStSettingDot1PMapper"
+	aniStConfigDone          = "aniStConfigDone"
+	aniStResetting           = "aniStResetting"
+)
+
+//UniPonAniConfigFsm defines the structure for the state machine to config the PON ANI ports of ONU UNI ports via OMCI
 type UniPonAniConfigFsm struct {
 	pOmciCC                  *OmciCC
 	pOnuUniPort              *OnuUniPort
@@ -43,6 +74,7 @@
 	requestEvent             OnuDeviceEvent
 	omciMIdsResponseReceived chan bool //seperate channel needed for checking multiInstance OMCI message responses
 	pAdaptFsm                *AdapterFsm
+	aniConfigCompleted       bool
 	chSuccess                chan<- uint8
 	procStep                 uint8
 	chanSet                  bool
@@ -55,18 +87,19 @@
 	downQueueXID             []uint16
 }
 
-//NewUniPonAniConfigFsm is the 'constructor' for the state machine to lock/unlock the ONU UNI ports via OMCI
+//NewUniPonAniConfigFsm is the 'constructor' for the state machine to config the PON ANI ports of ONU UNI ports via OMCI
 func NewUniPonAniConfigFsm(apDevOmciCC *OmciCC, apUniPort *OnuUniPort, apUniTechProf *OnuUniTechProf,
 	apOnuDB *OnuDeviceDB, aTechProfileID uint16, aRequestEvent OnuDeviceEvent, aName string,
 	aDeviceID string, aCommChannel chan Message) *UniPonAniConfigFsm {
 	instFsm := &UniPonAniConfigFsm{
-		pOmciCC:       apDevOmciCC,
-		pOnuUniPort:   apUniPort,
-		pUniTechProf:  apUniTechProf,
-		pOnuDB:        apOnuDB,
-		techProfileID: aTechProfileID,
-		requestEvent:  aRequestEvent,
-		chanSet:       false,
+		pOmciCC:            apDevOmciCC,
+		pOnuUniPort:        apUniPort,
+		pUniTechProf:       apUniTechProf,
+		pOnuDB:             apOnuDB,
+		techProfileID:      aTechProfileID,
+		requestEvent:       aRequestEvent,
+		aniConfigCompleted: false,
+		chanSet:            false,
 	}
 	instFsm.pAdaptFsm = NewAdapterFsm(aName, aDeviceID, aCommChannel)
 	if instFsm.pAdaptFsm == nil {
@@ -76,49 +109,50 @@
 	}
 
 	instFsm.pAdaptFsm.pFsm = fsm.NewFSM(
-		"disabled",
+		aniStDisabled,
 		fsm.Events{
 
-			{Name: "start", Src: []string{"disabled"}, Dst: "starting"},
+			{Name: aniEvStart, Src: []string{aniStDisabled}, Dst: aniStStarting},
 
 			//Note: .1p-Mapper and MBPCD might also have multi instances (per T-Cont) - by now only one 1 T-Cont considered!
-			{Name: "start_config", Src: []string{"starting"}, Dst: "creatingDot1PMapper"},
-			{Name: "rx_dot1pmap_cresp", Src: []string{"creatingDot1PMapper"}, Dst: "creatingMBPCD"},
-			{Name: "rx_mbpcd_resp", Src: []string{"creatingMBPCD"}, Dst: "settingTconts"},
-			{Name: "rx_tconts_resp", Src: []string{"settingTconts"}, Dst: "creatingGemNCTPs"},
+			{Name: aniEvStartConfig, Src: []string{aniStStarting}, Dst: aniStCreatingDot1PMapper},
+			{Name: aniEvRxDot1pmapCresp, Src: []string{aniStCreatingDot1PMapper}, Dst: aniStCreatingMBPCD},
+			{Name: aniEvRxMbpcdResp, Src: []string{aniStCreatingMBPCD}, Dst: aniStSettingTconts},
+			{Name: aniEvRxTcontsResp, Src: []string{aniStSettingTconts}, Dst: aniStCreatingGemNCTPs},
 			// the creatingGemNCTPs state is used for multi ME config if required for all configured/available GemPorts
-			{Name: "rx_gemntcps_resp", Src: []string{"creatingGemNCTPs"}, Dst: "creatingGemIWs"},
+			{Name: aniEvRxGemntcpsResp, Src: []string{aniStCreatingGemNCTPs}, Dst: aniStCreatingGemIWs},
 			// the creatingGemIWs state is used for multi ME config if required for all configured/available GemPorts
-			{Name: "rx_gemiws_resp", Src: []string{"creatingGemIWs"}, Dst: "settingPQs"},
+			{Name: aniEvRxGemiwsResp, Src: []string{aniStCreatingGemIWs}, Dst: aniStSettingPQs},
 			// the settingPQs state is used for multi ME config if required for all configured/available upstream PriorityQueues
-			{Name: "rx_prioqs_resp", Src: []string{"settingPQs"}, Dst: "settingDot1PMapper"},
-			{Name: "rx_dot1pmap_sresp", Src: []string{"settingDot1PMapper"}, Dst: "aniConfigDone"},
+			{Name: aniEvRxPrioqsResp, Src: []string{aniStSettingPQs}, Dst: aniStSettingDot1PMapper},
+			{Name: aniEvRxDot1pmapSresp, Src: []string{aniStSettingDot1PMapper}, Dst: aniStConfigDone},
 
-			{Name: "timeout_simple", Src: []string{
-				"creatingDot1PMapper", "creatingMBPCD", "settingTconts", "settingDot1PMapper"}, Dst: "starting"},
-			{Name: "timeout_mids", Src: []string{
-				"creatingGemNCTPs", "creatingGemIWs", "settingPQs"}, Dst: "starting"},
+			{Name: aniEvTimeoutSimple, Src: []string{
+				aniStCreatingDot1PMapper, aniStCreatingMBPCD, aniStSettingTconts, aniStSettingDot1PMapper}, Dst: aniStStarting},
+			{Name: aniEvTimeoutMids, Src: []string{
+				aniStCreatingGemNCTPs, aniStCreatingGemIWs, aniStSettingPQs}, Dst: aniStStarting},
 
-			// exceptional treatment for all states except "resetting"
-			{Name: "reset", Src: []string{"starting", "creatingDot1PMapper", "creatingMBPCD",
-				"settingTconts", "creatingGemNCTPs", "creatingGemIWs", "settingPQs", "settingDot1PMapper",
-				"aniConfigDone"}, Dst: "resetting"},
+			// exceptional treatment for all states except aniStResetting
+			{Name: aniEvReset, Src: []string{aniStStarting, aniStCreatingDot1PMapper, aniStCreatingMBPCD,
+				aniStSettingTconts, aniStCreatingGemNCTPs, aniStCreatingGemIWs, aniStSettingPQs, aniStSettingDot1PMapper,
+				aniStConfigDone}, Dst: aniStResetting},
 			// the only way to get to resource-cleared disabled state again is via "resseting"
-			{Name: "restart", Src: []string{"resetting"}, Dst: "disabled"},
+			{Name: aniEvRestart, Src: []string{aniStResetting}, Dst: aniStDisabled},
 		},
 
 		fsm.Callbacks{
-			"enter_state":               func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
-			"enter_starting":            func(e *fsm.Event) { instFsm.enterConfigStartingState(e) },
-			"enter_creatingDot1PMapper": func(e *fsm.Event) { instFsm.enterCreatingDot1PMapper(e) },
-			"enter_creatingMBPCD":       func(e *fsm.Event) { instFsm.enterCreatingMBPCD(e) },
-			"enter_settingTconts":       func(e *fsm.Event) { instFsm.enterSettingTconts(e) },
-			"enter_creatingGemNCTPs":    func(e *fsm.Event) { instFsm.enterCreatingGemNCTPs(e) },
-			"enter_creatingGemIWs":      func(e *fsm.Event) { instFsm.enterCreatingGemIWs(e) },
-			"enter_settingPQs":          func(e *fsm.Event) { instFsm.enterSettingPQs(e) },
-			"enter_settingDot1PMapper":  func(e *fsm.Event) { instFsm.enterSettingDot1PMapper(e) },
-			"enter_aniConfigDone":       func(e *fsm.Event) { instFsm.enterAniConfigDone(e) },
-			"enter_resetting":           func(e *fsm.Event) { instFsm.enterResettingState(e) },
+			"enter_state":                         func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
+			("enter_" + aniStStarting):            func(e *fsm.Event) { instFsm.enterConfigStartingState(e) },
+			("enter_" + aniStCreatingDot1PMapper): func(e *fsm.Event) { instFsm.enterCreatingDot1PMapper(e) },
+			("enter_" + aniStCreatingMBPCD):       func(e *fsm.Event) { instFsm.enterCreatingMBPCD(e) },
+			("enter_" + aniStSettingTconts):       func(e *fsm.Event) { instFsm.enterSettingTconts(e) },
+			("enter_" + aniStCreatingGemNCTPs):    func(e *fsm.Event) { instFsm.enterCreatingGemNCTPs(e) },
+			("enter_" + aniStCreatingGemIWs):      func(e *fsm.Event) { instFsm.enterCreatingGemIWs(e) },
+			("enter_" + aniStSettingPQs):          func(e *fsm.Event) { instFsm.enterSettingPQs(e) },
+			("enter_" + aniStSettingDot1PMapper):  func(e *fsm.Event) { instFsm.enterSettingDot1PMapper(e) },
+			("enter_" + aniStConfigDone):          func(e *fsm.Event) { instFsm.enterAniConfigDone(e) },
+			("enter_" + aniStResetting):           func(e *fsm.Event) { instFsm.enterResettingState(e) },
+			("enter_" + aniStDisabled):            func(e *fsm.Event) { instFsm.enterDisabledState(e) },
 		},
 	)
 	if instFsm.pAdaptFsm.pFsm == nil {
@@ -175,7 +209,7 @@
 				//TODO!: for now fixed, but target is to use value from MibUpload (mibDB), also TechProf setting dependency may exist!
 				oFsm.downQueueXID = append(oFsm.downQueueXID, 1)
 
-				a_pAFsm.pFsm.Event("start_config")
+				a_pAFsm.pFsm.Event(aniEvStartConfig)
 			}
 		}(pConfigAniStateAFsm)
 	}
@@ -283,8 +317,7 @@
 
 func (oFsm *UniPonAniConfigFsm) enterAniConfigDone(e *fsm.Event) {
 
-	//mirror the chanSet state as it will be reset by FSM reset
-	loChanSet := oFsm.chanSet
+	oFsm.aniConfigCompleted = true
 
 	//let's reset the state machine in order to release all resources now
 	pConfigAniStateAFsm := oFsm.pAdaptFsm
@@ -292,27 +325,14 @@
 		// 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("reset")
+				a_pAFsm.pFsm.Event(aniEvReset)
 			}
 		}(pConfigAniStateAFsm)
 	}
-
-	logger.Debugw("UniPonAniConfigFsm send dh event notification", log.Fields{
-		"from_State": e.FSM.Current(), "device-id": oFsm.pAdaptFsm.deviceID})
-	//use DeviceHandler event notification directly
-	oFsm.pOmciCC.pBaseDeviceHandler.DeviceProcStatusUpdate(oFsm.requestEvent)
-
-	if loChanSet {
-		// indicate processing done to the caller
-		logger.Debugw("UniPonAniConfigFsm processingDone on channel", log.Fields{
-			"ProcessingStep": oFsm.procStep, "from_State": e.FSM.Current(), "device-id": oFsm.pAdaptFsm.deviceID})
-		oFsm.chSuccess <- oFsm.procStep
-	}
 }
 
 func (oFsm *UniPonAniConfigFsm) enterResettingState(e *fsm.Event) {
 	logger.Debugw("UniPonAniConfigFsm resetting", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
-	oFsm.chanSet = false //reset the internal channel state
 	pConfigAniStateAFsm := oFsm.pAdaptFsm
 	if pConfigAniStateAFsm != nil {
 		// abort running message processing
@@ -327,12 +347,33 @@
 		//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("restart")
+				a_pAFsm.pFsm.Event(aniEvRestart)
 			}
 		}(pConfigAniStateAFsm)
 	}
 }
 
+func (oFsm *UniPonAniConfigFsm) enterDisabledState(e *fsm.Event) {
+	logger.Debugw("UniPonAniConfigFsm enters disabled state", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
+
+	if oFsm.aniConfigCompleted {
+		logger.Debugw("UniPonAniConfigFsm send dh event notification", log.Fields{
+			"from_State": e.FSM.Current(), "device-id": oFsm.pAdaptFsm.deviceID})
+		//use DeviceHandler event notification directly
+		oFsm.pOmciCC.pBaseDeviceHandler.DeviceProcStatusUpdate(oFsm.requestEvent)
+		oFsm.aniConfigCompleted = false
+	}
+
+	if oFsm.chanSet {
+		// indicate processing done to the caller
+		logger.Debugw("UniPonAniConfigFsm processingDone on channel", log.Fields{
+			"ProcessingStep": oFsm.procStep, "from_State": e.FSM.Current(), "device-id": oFsm.pAdaptFsm.deviceID})
+		oFsm.chSuccess <- oFsm.procStep
+		oFsm.chanSet = false //reset the internal channel state
+	}
+
+}
+
 func (oFsm *UniPonAniConfigFsm) ProcessOmciAniMessages( /*ctx context.Context*/ ) {
 	logger.Debugw("Start UniPonAniConfigFsm Msg processing", log.Fields{"for device-id": oFsm.pAdaptFsm.deviceID})
 loop:
@@ -345,7 +386,7 @@
 			if !ok {
 				logger.Info("UniPonAniConfigFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
 				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				oFsm.pAdaptFsm.pFsm.Event("reset")
+				oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 				break loop
 			}
 			logger.Debugw("UniPonAniConfigFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
@@ -404,11 +445,11 @@
 				switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
 				case "Ieee8021PMapperServiceProfile":
 					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event("rx_dot1pmap_cresp")
+						oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapCresp)
 					}
 				case "MacBridgePortConfigurationData":
 					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event("rx_mbpcd_resp")
+						oFsm.pAdaptFsm.pFsm.Event(aniEvRxMbpcdResp)
 					}
 				case "GemPortNetworkCtp", "GemInterworkingTerminationPoint":
 					{ // let aniConfig Multi-Id processing proceed by stopping the wait function
@@ -444,7 +485,7 @@
 				switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
 				case "TCont":
 					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event("rx_tconts_resp")
+						oFsm.pAdaptFsm.pFsm.Event(aniEvRxTcontsResp)
 					}
 				case "PriorityQueue":
 					{ // let the PrioQueue init proceed by stopping the wait function
@@ -452,7 +493,7 @@
 					}
 				case "Ieee8021PMapperServiceProfile":
 					{ // let the FSM proceed ...
-						oFsm.pAdaptFsm.pFsm.Event("rx_dot1pmap_sresp")
+						oFsm.pAdaptFsm.pFsm.Event(aniEvRxDot1pmapSresp)
 					}
 				}
 			}
@@ -495,14 +536,14 @@
 	if err != nil {
 		logger.Errorw("GemNWCtp create failed, aborting AniConfig FSM!",
 			log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID, "GemIndex": 0}) //running index in loop later!
-		oFsm.pAdaptFsm.pFsm.Event("reset")
+		oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 		return
 	}
 	//for all GemPortID's ports - later
 
 	// if Config has been done for all GemPort instances let the FSM proceed
 	logger.Debugw("GemNWCtp create loop finished", log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event("rx_gemntcps_resp")
+	oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemntcpsResp)
 	return
 }
 
@@ -534,14 +575,14 @@
 	if err != nil {
 		logger.Errorw("GemIwTp create failed, aborting AniConfig FSM!",
 			log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID, "GemIndex": 0}) //running index in loop later!
-		oFsm.pAdaptFsm.pFsm.Event("reset")
+		oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 		return
 	}
 	//for all GemPortID's ports - later
 
 	// if Config has been done for all GemPort instances let the FSM proceed
 	logger.Debugw("GemIwTp create loop finished", log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event("rx_gemiws_resp")
+	oFsm.pAdaptFsm.pFsm.Event(aniEvRxGemiwsResp)
 	return
 }
 
@@ -573,14 +614,14 @@
 	if err != nil {
 		logger.Errorw("PrioQueue set failed, aborting AniConfig FSM!",
 			log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID, "QueueIndex": 0}) //running index in loop later!
-		oFsm.pAdaptFsm.pFsm.Event("reset")
+		oFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 		return
 	}
 	//for all upstream prioQueus - later
 
 	// if Config has been done for all PrioQueue instances let the FSM proceed
 	logger.Debugw("PrioQueue set loop finished", log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event("rx_prioqs_resp")
+	oFsm.pAdaptFsm.pFsm.Event(aniEvRxPrioqsResp)
 	return
 }
 
diff --git a/internal/pkg/onuadaptercore/omci_cc.go b/internal/pkg/onuadaptercore/omci_cc.go
index 1987562..5b2b33e 100644
--- a/internal/pkg/onuadaptercore/omci_cc.go
+++ b/internal/pkg/onuadaptercore/omci_cc.go
@@ -195,7 +195,7 @@
 		//  (am extendedFormat message could be destroyed this way!)
 		trailerLenData := rxMsg[42:44]
 		trailerLen := binary.BigEndian.Uint16(trailerLenData)
-		logger.Infow("omci-received-trailer-len", log.Fields{"Length": trailerLen})
+		//logger.Debugw("omci-received-trailer-len", log.Fields{"Length": trailerLen})
 		if trailerLen != 40 { // invalid base Format entry -> autocorrect
 			binary.BigEndian.PutUint16(rxMsg[42:44], 40)
 			logger.Debug("cc-corrected-omci-message: trailer len inserted")
@@ -233,7 +233,7 @@
 			return errors.New("Autonomous Omci Message with TranSCorrId != 0 not acccepted")
 		}
 	} else {
-		logger.Debug("RxMsg is a Omci Response Message: try to schedule it to the requester")
+		//logger.Debug("RxMsg is a Omci Response Message: try to schedule it to the requester")
 		oo.mutexRxSchedMap.Lock()
 		rxCallbackEntry, ok := oo.rxSchedulerMap[omciMsg.TransactionID]
 		if ok && rxCallbackEntry.cbFunction != nil {
diff --git a/internal/pkg/onuadaptercore/onu_device_db.go b/internal/pkg/onuadaptercore/onu_device_db.go
index 7f779b2..3395495 100644
--- a/internal/pkg/onuadaptercore/onu_device_db.go
+++ b/internal/pkg/onuadaptercore/onu_device_db.go
@@ -52,7 +52,7 @@
 		return
 	}
 
-	logger.Debugw("Search for key data :", log.Fields{"deviceId": onuDeviceDB.pOnuDeviceEntry.deviceID, "meClassId": meClassId, "meEntityId": meEntityId})
+	//logger.Debugw("Search for key data :", log.Fields{"deviceId": onuDeviceDB.pOnuDeviceEntry.deviceID, "meClassId": meClassId, "meEntityId": meEntityId})
 	meInstMap, ok := onuDeviceDB.meDb[meClassId]
 	if !ok {
 		logger.Debugw("meClassId not found - add to db :", log.Fields{"deviceId": onuDeviceDB.pOnuDeviceEntry.deviceID})
diff --git a/internal/pkg/onuadaptercore/onu_device_entry.go b/internal/pkg/onuadaptercore/onu_device_entry.go
index a08e03f..b623bf9 100644
--- a/internal/pkg/onuadaptercore/onu_device_entry.go
+++ b/internal/pkg/onuadaptercore/onu_device_entry.go
@@ -36,6 +36,68 @@
 )
 
 const (
+	// events of MibUpload FSM
+	ulEvStart              = "ulEvStart"
+	ulEvResetMib           = "ulEvResetMib"
+	ulEvGetVendorAndSerial = "ulEvGetVendorAndSerial"
+	ulEvGetEquipmentId     = "ulEvGetEquipmentId"
+	ulEvGetFirstSwVersion  = "ulEvGetFirstSwVersion"
+	ulEvGetSecondSwVersion = "ulEvGetSecondSwVersion"
+	ulEvGetMacAddress      = "ulEvGetMacAddress"
+	ulEvGetMibTemplate     = "ulEvGetMibTemplate"
+	ulEvUploadMib          = "ulEvUploadMib"
+	ulEvExamineMds         = "ulEvExamineMds"
+	ulEvSuccess            = "ulEvSuccess"
+	ulEvMismatch           = "ulEvMismatch"
+	ulEvAuditMib           = "ulEvAuditMib"
+	ulEvForceResync        = "ulEvForceResync"
+	ulEvDiffsFound         = "ulEvDiffsFound"
+	ulEvTimeout            = "ulEvTimeout"
+	ulEvStop               = "ulEvStop"
+)
+const (
+	// states of MibUpload FSM
+	ulStDisabled               = "ulStDisabled"
+	ulStStarting               = "ulStStarting"
+	ulStResettingMib           = "ulStResettingMib"
+	ulStGettingVendorAndSerial = "ulStGettingVendorAndSerial"
+	ulStGettingEquipmentId     = "ulStGettingEquipmentId"
+	ulStGettingFirstSwVersion  = "ulStGettingFirstSwVersion"
+	ulStGettingSecondSwVersion = "ulStGettingSecondSwVersion"
+	ulStGettingMacAddress      = "ulStGettingMacAddress"
+	ulStGettingMibTemplate     = "ulStGettingMibTemplate"
+	ulStUploading              = "ulStUploading"
+	ulStInSync                 = "ulStInSync"
+	ulStExaminingMds           = "ulStExaminingMds"
+	ulStResynchronizing        = "ulStResynchronizing"
+	ulStAuditing               = "ulStAuditing"
+	ulStOutOfSync              = "ulStOutOfSync"
+)
+
+const (
+	// events of MibDownload FSM
+	dlEvStart         = "dlEvStart"
+	dlEvCreateGal     = "dlEvCreateGal"
+	dlEvRxGalResp     = "dlEvRxGalResp"
+	dlEvRxOnu2gResp   = "dlEvRxOnu2gResp"
+	dlEvRxBridgeResp  = "dlEvRxBridgeResp"
+	dlEvTimeoutSimple = "dlEvTimeoutSimple"
+	dlEvTimeoutBridge = "dlEvTimeoutBridge"
+	dlEvReset         = "dlEvReset"
+	dlEvRestart       = "dlEvRestart"
+)
+const (
+	// states of MibDownload FSM
+	dlStDisabled     = "dlStDisabled"
+	dlStStarting     = "dlStStarting"
+	dlStCreatingGal  = "dlStCreatingGal"
+	dlStSettingOnu2g = "dlStSettingOnu2g"
+	dlStBridgeInit   = "dlStBridgeInit"
+	dlStDownloaded   = "dlStDownloaded"
+	dlStResetting    = "dlStResetting"
+)
+
+const (
 	cBasePathMibTemplateKvStore = "service/voltha/omci_mibs/templates"
 	cSuffixMibTemplateKvStore   = "%s/%s/%s"
 )
@@ -125,6 +187,7 @@
 	devState      OnuDeviceEvent
 	// for mibUpload
 	mibAuditDelay uint16
+	mibDebugLevel string
 
 	// for mibUpload
 	pMibUploadFsm *AdapterFsm //could be handled dynamically and more general as pAdapterFsm - perhaps later
@@ -181,104 +244,107 @@
 	onuDeviceEntry.mibAuditDelay = onuDeviceEntry.supportedFsms["mib-synchronizer"].auditDelay
 	logger.Debugw("MibAudit is set to", log.Fields{"Delay": onuDeviceEntry.mibAuditDelay})
 
+	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.pFsm = fsm.NewFSM(
-		"disabled",
+		ulStDisabled,
 		fsm.Events{
 
-			{Name: "start", Src: []string{"disabled"}, Dst: "starting"},
+			{Name: ulEvStart, Src: []string{ulStDisabled}, Dst: ulStStarting},
 
-			{Name: "reset_mib", Src: []string{"starting"}, Dst: "resetting_mib"},
-			{Name: "get_vendor_and_serial", Src: []string{"resetting_mib"}, Dst: "getting_vendor_and_serial"},
-			{Name: "get_equipment_id", Src: []string{"getting_vendor_and_serial"}, Dst: "getting_equipment_id"},
-			{Name: "get_first_sw_version", Src: []string{"getting_equipment_id"}, Dst: "getting_first_sw_version"},
-			{Name: "get_second_sw_version", Src: []string{"getting_first_sw_version"}, Dst: "getting_second_sw_version"},
-			{Name: "get_mac_address", Src: []string{"getting_second_sw_version"}, Dst: "getting_mac_address"},
-			{Name: "get_mib_template", Src: []string{"getting_mac_address"}, Dst: "getting_mib_template"},
+			{Name: ulEvResetMib, Src: []string{ulStStarting}, Dst: ulStResettingMib},
+			{Name: ulEvGetVendorAndSerial, Src: []string{ulStResettingMib}, Dst: ulStGettingVendorAndSerial},
+			{Name: ulEvGetEquipmentId, Src: []string{ulStGettingVendorAndSerial}, Dst: ulStGettingEquipmentId},
+			{Name: ulEvGetFirstSwVersion, Src: []string{ulStGettingEquipmentId}, Dst: ulStGettingFirstSwVersion},
+			{Name: ulEvGetSecondSwVersion, Src: []string{ulStGettingFirstSwVersion}, Dst: ulStGettingSecondSwVersion},
+			{Name: ulEvGetMacAddress, Src: []string{ulStGettingSecondSwVersion}, Dst: ulStGettingMacAddress},
+			{Name: ulEvGetMibTemplate, Src: []string{ulStGettingMacAddress}, Dst: ulStGettingMibTemplate},
 
-			{Name: "upload_mib", Src: []string{"getting_mib_template"}, Dst: "uploading"},
-			{Name: "examine_mds", Src: []string{"starting"}, Dst: "examining_mds"},
+			{Name: ulEvUploadMib, Src: []string{ulStGettingMibTemplate}, Dst: ulStUploading},
+			{Name: ulEvExamineMds, Src: []string{ulStStarting}, Dst: ulStExaminingMds},
 
-			{Name: "success", Src: []string{"getting_mib_template"}, Dst: "in_sync"},
-			{Name: "success", Src: []string{"uploading"}, Dst: "in_sync"},
+			{Name: ulEvSuccess, Src: []string{ulStGettingMibTemplate}, Dst: ulStInSync},
+			{Name: ulEvSuccess, Src: []string{ulStUploading}, Dst: ulStInSync},
 
-			{Name: "success", Src: []string{"examining_mds"}, Dst: "in_sync"},
-			{Name: "mismatch", Src: []string{"examining_mds"}, Dst: "resynchronizing"},
+			{Name: ulEvSuccess, Src: []string{ulStExaminingMds}, Dst: ulStInSync},
+			{Name: ulEvMismatch, Src: []string{ulStExaminingMds}, Dst: ulStResynchronizing},
 
-			{Name: "audit_mib", Src: []string{"in_sync"}, Dst: "auditing"},
+			{Name: ulEvAuditMib, Src: []string{ulStInSync}, Dst: ulStAuditing},
 
-			{Name: "success", Src: []string{"out_of_sync"}, Dst: "in_sync"},
-			{Name: "audit_mib", Src: []string{"out_of_sync"}, Dst: "auditing"},
+			{Name: ulEvSuccess, Src: []string{ulStOutOfSync}, Dst: ulStInSync},
+			{Name: ulEvAuditMib, Src: []string{ulStOutOfSync}, Dst: ulStAuditing},
 
-			{Name: "success", Src: []string{"auditing"}, Dst: "in_sync"},
-			{Name: "mismatch", Src: []string{"auditing"}, Dst: "resynchronizing"},
-			{Name: "force_resync", Src: []string{"auditing"}, Dst: "resynchronizing"},
+			{Name: ulEvSuccess, Src: []string{ulStAuditing}, Dst: ulStInSync},
+			{Name: ulEvMismatch, Src: []string{ulStAuditing}, Dst: ulStResynchronizing},
+			{Name: ulEvForceResync, Src: []string{ulStAuditing}, Dst: ulStResynchronizing},
 
-			{Name: "success", Src: []string{"resynchronizing"}, Dst: "in_sync"},
-			{Name: "diffs_found", Src: []string{"resynchronizing"}, Dst: "out_of_sync"},
+			{Name: ulEvSuccess, Src: []string{ulStResynchronizing}, Dst: ulStInSync},
+			{Name: ulEvDiffsFound, Src: []string{ulStResynchronizing}, Dst: ulStOutOfSync},
 
-			{Name: "timeout", Src: []string{"reset_mib", "get_vendor_and_serial", "get_equipment_id", "get_first_sw_version", "get_mac_address",
-				"get_mib_template", "uploading", "resynchronizing", "examining_mds", "in_sync", "out_of_sync", "auditing"}, Dst: "starting"},
+			{Name: ulEvTimeout, Src: []string{ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentId, ulStGettingFirstSwVersion,
+				ulStGettingSecondSwVersion, ulStGettingMacAddress, ulStGettingMibTemplate, ulStUploading, ulStResynchronizing, ulStExaminingMds,
+				ulStInSync, ulStOutOfSync, ulStAuditing}, Dst: ulStStarting},
 
-			{Name: "stop", Src: []string{"starting", "reset_mib", "get_vendor_and_serial", "get_equipment_id", "get_first_sw_version", "get_mac_address",
-				"get_mib_template", "uploading", "resynchronizing", "examining_mds", "in_sync", "out_of_sync", "auditing"}, Dst: "disabled"},
+			{Name: ulEvStop, Src: []string{ulStStarting, ulStResettingMib, ulStGettingVendorAndSerial, ulStGettingEquipmentId, ulStGettingFirstSwVersion,
+				ulStGettingSecondSwVersion, ulStGettingMacAddress, ulStGettingMibTemplate, ulStUploading, ulStResynchronizing, ulStExaminingMds,
+				ulStInSync, ulStOutOfSync, ulStAuditing}, Dst: ulStDisabled},
 		},
 
 		fsm.Callbacks{
-			"enter_state":                     func(e *fsm.Event) { onuDeviceEntry.pMibUploadFsm.logFsmStateChange(e) },
-			"enter_starting":                  func(e *fsm.Event) { onuDeviceEntry.enterStartingState(e) },
-			"enter_resetting_mib":             func(e *fsm.Event) { onuDeviceEntry.enterResettingMibState(e) },
-			"enter_getting_vendor_and_serial": func(e *fsm.Event) { onuDeviceEntry.enterGettingVendorAndSerialState(e) },
-			"enter_getting_equipment_id":      func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIdState(e) },
-			"enter_getting_first_sw_version":  func(e *fsm.Event) { onuDeviceEntry.enterGettingFirstSwVersionState(e) },
-			"enter_getting_second_sw_version": func(e *fsm.Event) { onuDeviceEntry.enterGettingSecondSwVersionState(e) },
-			"enter_getting_mac_address":       func(e *fsm.Event) { onuDeviceEntry.enterGettingMacAddressState(e) },
-			"enter_getting_mib_template":      func(e *fsm.Event) { onuDeviceEntry.enterGettingMibTemplate(e) },
-			"enter_uploading":                 func(e *fsm.Event) { onuDeviceEntry.enterUploadingState(e) },
-			"enter_examining_mds":             func(e *fsm.Event) { onuDeviceEntry.enterExaminingMdsState(e) },
-			"enter_resynchronizing":           func(e *fsm.Event) { onuDeviceEntry.enterResynchronizingState(e) },
-			"enter_auditing":                  func(e *fsm.Event) { onuDeviceEntry.enterAuditingState(e) },
-			"enter_out_of_sync":               func(e *fsm.Event) { onuDeviceEntry.enterOutOfSyncState(e) },
-			"enter_in_sync":                   func(e *fsm.Event) { onuDeviceEntry.enterInSyncState(e) },
+			"enter_state":                           func(e *fsm.Event) { onuDeviceEntry.pMibUploadFsm.logFsmStateChange(e) },
+			("enter_" + ulStStarting):               func(e *fsm.Event) { onuDeviceEntry.enterStartingState(e) },
+			("enter_" + ulStResettingMib):           func(e *fsm.Event) { onuDeviceEntry.enterResettingMibState(e) },
+			("enter_" + ulStGettingVendorAndSerial): func(e *fsm.Event) { onuDeviceEntry.enterGettingVendorAndSerialState(e) },
+			("enter_" + ulStGettingEquipmentId):     func(e *fsm.Event) { onuDeviceEntry.enterGettingEquipmentIdState(e) },
+			("enter_" + ulStGettingFirstSwVersion):  func(e *fsm.Event) { onuDeviceEntry.enterGettingFirstSwVersionState(e) },
+			("enter_" + ulStGettingSecondSwVersion): func(e *fsm.Event) { onuDeviceEntry.enterGettingSecondSwVersionState(e) },
+			("enter_" + ulStGettingMacAddress):      func(e *fsm.Event) { onuDeviceEntry.enterGettingMacAddressState(e) },
+			("enter_" + ulStGettingMibTemplate):     func(e *fsm.Event) { onuDeviceEntry.enterGettingMibTemplate(e) },
+			("enter_" + ulStUploading):              func(e *fsm.Event) { onuDeviceEntry.enterUploadingState(e) },
+			("enter_" + ulStExaminingMds):           func(e *fsm.Event) { onuDeviceEntry.enterExaminingMdsState(e) },
+			("enter_" + ulStResynchronizing):        func(e *fsm.Event) { onuDeviceEntry.enterResynchronizingState(e) },
+			("enter_" + ulStAuditing):               func(e *fsm.Event) { onuDeviceEntry.enterAuditingState(e) },
+			("enter_" + ulStOutOfSync):              func(e *fsm.Event) { onuDeviceEntry.enterOutOfSyncState(e) },
+			("enter_" + ulStInSync):                 func(e *fsm.Event) { onuDeviceEntry.enterInSyncState(e) },
 		},
 	)
 	// Omci related Mib download state machine
 	mibDownloadChan := make(chan Message, 2048)
 	onuDeviceEntry.pMibDownloadFsm = NewAdapterFsm("MibDownload", device_id, mibDownloadChan)
 	onuDeviceEntry.pMibDownloadFsm.pFsm = fsm.NewFSM(
-		"disabled",
+		dlStDisabled,
 		fsm.Events{
 
-			{Name: "start", Src: []string{"disabled"}, Dst: "starting"},
+			{Name: dlEvStart, Src: []string{dlStDisabled}, Dst: dlStStarting},
 
-			{Name: "create_gal", Src: []string{"starting"}, Dst: "creatingGal"},
-			{Name: "rx_gal_resp", Src: []string{"creatingGal"}, Dst: "settingOnu2g"},
-			{Name: "rx_onu2g_resp", Src: []string{"settingOnu2g"}, Dst: "bridgeInit"},
+			{Name: dlEvCreateGal, Src: []string{dlStStarting}, Dst: dlStCreatingGal},
+			{Name: dlEvRxGalResp, Src: []string{dlStCreatingGal}, Dst: dlStSettingOnu2g},
+			{Name: dlEvRxOnu2gResp, Src: []string{dlStSettingOnu2g}, Dst: dlStBridgeInit},
 			// the bridge state is used for multi ME config for alle UNI related ports
 			// maybe such could be reflected in the state machine as well (port number parametrized)
 			// but that looks not straightforward here - so we keep it simple here for the beginning(?)
-			{Name: "rx_bridge_resp", Src: []string{"bridgeInit"}, Dst: "downloaded"},
+			{Name: dlEvRxBridgeResp, Src: []string{dlStBridgeInit}, Dst: dlStDownloaded},
 
-			{Name: "timeout_simple", Src: []string{"creatingGal", "settingOnu2g"}, Dst: "starting"},
-			{Name: "timeout_bridge", Src: []string{"bridgeInit"}, Dst: "starting"},
+			{Name: dlEvTimeoutSimple, Src: []string{dlStCreatingGal, dlStSettingOnu2g}, Dst: dlStStarting},
+			{Name: dlEvTimeoutBridge, Src: []string{dlStBridgeInit}, Dst: dlStStarting},
 
-			{Name: "reset", Src: []string{"starting", "creatingGal", "settingOnu2g",
-				"bridgeInit", "downloaded"}, Dst: "resetting"},
-			// exceptional treatment for all states except "resetting"
-			{Name: "restart", Src: []string{"starting", "creatingGal", "settingOnu2g",
-				"bridgeInit", "downloaded", "resetting"}, Dst: "disabled"},
+			{Name: dlEvReset, Src: []string{dlStStarting, dlStCreatingGal, dlStSettingOnu2g,
+				dlStBridgeInit, dlStDownloaded}, Dst: dlStResetting},
+			// exceptional treatment for all states except dlStResetting
+			{Name: dlEvRestart, Src: []string{dlStStarting, dlStCreatingGal, dlStSettingOnu2g,
+				dlStBridgeInit, dlStDownloaded, dlStResetting}, Dst: dlStDisabled},
 		},
 
 		fsm.Callbacks{
-			"enter_state":        func(e *fsm.Event) { onuDeviceEntry.pMibDownloadFsm.logFsmStateChange(e) },
-			"enter_starting":     func(e *fsm.Event) { onuDeviceEntry.enterDLStartingState(e) },
-			"enter_creatingGal":  func(e *fsm.Event) { onuDeviceEntry.enterCreatingGalState(e) },
-			"enter_settingOnu2g": func(e *fsm.Event) { onuDeviceEntry.enterSettingOnu2gState(e) },
-			"enter_bridgeInit":   func(e *fsm.Event) { onuDeviceEntry.enterBridgeInitState(e) },
-			"enter_downloaded":   func(e *fsm.Event) { onuDeviceEntry.enterDownloadedState(e) },
-			"enter_resetting":    func(e *fsm.Event) { onuDeviceEntry.enterResettingState(e) },
+			"enter_state":                 func(e *fsm.Event) { onuDeviceEntry.pMibDownloadFsm.logFsmStateChange(e) },
+			("enter_" + dlStStarting):     func(e *fsm.Event) { onuDeviceEntry.enterDLStartingState(e) },
+			("enter_" + dlStCreatingGal):  func(e *fsm.Event) { onuDeviceEntry.enterCreatingGalState(e) },
+			("enter_" + dlStSettingOnu2g): func(e *fsm.Event) { onuDeviceEntry.enterSettingOnu2gState(e) },
+			("enter_" + dlStBridgeInit):   func(e *fsm.Event) { onuDeviceEntry.enterBridgeInitState(e) },
+			("enter_" + dlStDownloaded):   func(e *fsm.Event) { onuDeviceEntry.enterDownloadedState(e) },
+			("enter_" + dlStResetting):    func(e *fsm.Event) { onuDeviceEntry.enterResettingState(e) },
 		},
 	)
 	if onuDeviceEntry.pMibDownloadFsm == nil || onuDeviceEntry.pMibDownloadFsm.pFsm == nil {
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index 0ab7984..d6950ff 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -20,6 +20,7 @@
 import (
 	"context"
 	"encoding/json"
+	"errors"
 	"strconv"
 	"strings"
 	"sync"
@@ -96,6 +97,7 @@
 	mapUniTpIndication map[uint32]*tTechProfileIndication //use pointer values to ease assignments to the map
 	mapPonAniConfig    map[uint32]*tMapPonAniConfig       //per UNI: use pointer values to ease assignments to the map
 	pAniConfigFsm      *UniPonAniConfigFsm
+	procResult         error //error indication of processing
 }
 
 //NewOnuUniTechProf returns the instance of a OnuUniTechProf
@@ -110,6 +112,7 @@
 	onuTP.chTpProcessingStep = make(chan uint8)
 	onuTP.mapUniTpIndication = make(map[uint32]*tTechProfileIndication)
 	onuTP.mapPonAniConfig = make(map[uint32]*tMapPonAniConfig)
+	onuTP.procResult = nil //default assumption processing done with success
 
 	onuTP.techProfileKVStore = aDeviceHandler.SetBackend(cBasePathTechProfileKVStore)
 	if onuTP.techProfileKVStore == nil {
@@ -129,6 +132,12 @@
 	onuTP.tpProcMutex.Unlock()
 }
 
+// resetProcessingErrorIndication resets the internal error indication
+// need to be called before evaluation of any subsequent processing (given by waitForTpCompletion())
+func (onuTP *OnuUniTechProf) resetProcessingErrorIndication() {
+	onuTP.procResult = nil
+}
+
 // updateOnuUniTpPath verifies and updates changes in the kvStore onuUniTpPath
 func (onuTP *OnuUniTechProf) updateOnuUniTpPath(aUniID uint32, aPathString string) bool {
 	/* within some specific InterAdapter processing request write/read access to data is ensured to be sequentially,
@@ -171,11 +180,12 @@
 	return true
 }
 
-func (onuTP *OnuUniTechProf) waitForTpCompletion(cancel context.CancelFunc, wg *sync.WaitGroup) {
+func (onuTP *OnuUniTechProf) waitForTpCompletion(cancel context.CancelFunc, wg *sync.WaitGroup) error {
 	defer cancel() //ensure termination of context (may be pro forma)
 	wg.Wait()
 	logger.Debug("some TechProfile Processing completed")
 	onuTP.tpProcMutex.Unlock() //allow further TP related processing
+	return onuTP.procResult
 }
 
 // configureUniTp checks existing tp resources to delete and starts the corresponding OMCI configuation of the UNI port
@@ -190,6 +200,7 @@
 
 	if onuTP.techProfileKVStore == nil {
 		logger.Debug("techProfileKVStore not set - abort")
+		onuTP.procResult = errors.New("TechProfile config aborted: techProfileKVStore not set")
 		return
 	}
 
@@ -205,6 +216,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")
 		return
 	}
 
@@ -233,6 +245,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")
 		return
 	}
 
@@ -245,20 +258,25 @@
 				//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")
 				//this issue here means that the AniConfigFsm has not finished succesfully
 				//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)
-				onuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event("reset")
+				onuTP.pAniConfigFsm.pAdaptFsm.pFsm.Event(aniEvReset)
 				return
 			}
 		} else {
 			// 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{
 				"deviceID": onuTP.deviceID, "uniID": aUniID})
+			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{
 			"deviceID": onuTP.deviceID, "uniID": aUniID})
+		onuTP.procResult = errors.New("TechProfile config aborted: no AniSide data found for this UNI")
+		return
 	}
 }
 
@@ -267,6 +285,7 @@
 	logger.Debugw("this would update the ONU's TpPath in KVStore", log.Fields{
 		"deviceID": onuTP.deviceID})
 	//TODO!!!
+	// set onuTP.procResult in case of errors!! cmp. configureUniTp
 	//make use of onuTP.sOnuPersistentData to store the TpPath to KVStore - as background routine
 	/*
 		var processingStep uint8 = 1 // used to synchronize the different processing steps with chTpProcessingStep
@@ -395,10 +414,15 @@
 		// default profile defines "Hybrid" - which probably comes down to WRR with some weigthts for SP
 		(*(onuTP.mapPonAniConfig[aUniID]))[0].tcontParams.schedPolicy = 2 //for G.988 WRR
 	}
+	loNumGemPorts := tpInst.NumGemPorts
+	loGemPortRead := false
 	for pos, content := range tpInst.UpstreamGemPortAttributeList {
-		if pos == 1 {
-			logger.Debugw("PonAniConfig abort GemPortList - still only one Gemport supported",
-				log.Fields{"device-id": onuTP.deviceID})
+		if pos == 0 {
+			loGemPortRead = true
+		}
+		if uint32(pos) == loNumGemPorts {
+			logger.Debugw("PonAniConfig abort GemPortList - GemList exceeds set NumberOfGemPorts",
+				log.Fields{"device-id": onuTP.deviceID, "index": pos, "NumGem": loNumGemPorts})
 			break
 		}
 		// a downstream GemPort should always exist (only downstream for MC)
@@ -416,6 +440,12 @@
 		//'GemWeight' looks strange in default profile, for now we just copy the weight to first queue
 		(*(onuTP.mapPonAniConfig[aUniID]))[0].mapGemPortParams[uint16(pos)].queueWeight = uint8(content.Weight)
 	}
+	if loGemPortRead == false {
+		logger.Errorw("no GemPort could be read from TechProfile",
+			log.Fields{"path": aPathString, "device-id": onuTP.deviceID})
+		onuTP.chTpProcessingStep <- 0 //error indication
+		return
+	}
 	//TODO!! MC (downstream) GemPorts can be set using DownstreamGemPortAttributeList seperately
 
 	//logger does not simply output the given structures, just give some example debug values
@@ -489,10 +519,10 @@
 	var pACStatemachine *fsm.FSM
 	pACStatemachine = onuTP.pAniConfigFsm.pAdaptFsm.pFsm
 	if pACStatemachine != nil {
-		if pACStatemachine.Is("disabled") {
+		if pACStatemachine.Is(aniStDisabled) {
 			//FSM init requirement to get informed abou FSM completion! (otherwise timeout of the TechProf config)
 			onuTP.pAniConfigFsm.SetFsmCompleteChannel(onuTP.chTpProcessingStep, aProcessingStep)
-			if err := pACStatemachine.Event("start"); err != nil {
+			if err := pACStatemachine.Event(aniEvStart); err != nil {
 				logger.Warnw("AniConfigFSM: can't start", log.Fields{"err": err})
 				// maybe try a FSM reset and then again ... - TODO!!!
 			} else {
diff --git a/internal/pkg/onuadaptercore/openonu.go b/internal/pkg/onuadaptercore/openonu.go
index 3de061e..1590f60 100644
--- a/internal/pkg/onuadaptercore/openonu.go
+++ b/internal/pkg/onuadaptercore/openonu.go
@@ -182,12 +182,18 @@
 	targetDevice := msg.Header.ToDeviceId
 	//ToDeviceId should address an DeviceHandler instance
 	if handler := oo.getDeviceHandler(targetDevice); handler != nil {
+		/* 200724: modification towards synchronous implementation - possible errors within processing shall be
+		 * 	 in the accordingly delayed response, some timing effect might result in Techprofile processing for multiple UNI's
+		 */
+		return handler.ProcessInterAdapterMessage(msg)
+		/* so far the processing has been in background with according commented error treatment restrictions:
 		go handler.ProcessInterAdapterMessage(msg)
 		// error treatment might be more sophisticated
 		// by now let's just accept the message on 'communication layer'
 		// message content problems have to be evaluated then in the handler
 		//   and are by now not reported to the calling party (to force what reaction there?)
 		return nil
+		*/
 	}
 	logger.Warnw("no handler found for received Inter-Proxy-message", log.Fields{
 		"msgToDeviceId": targetDevice})
diff --git a/internal/pkg/onuadaptercore/uniportadmin.go b/internal/pkg/onuadaptercore/uniportadmin.go
index ed30b41..6761ea7 100644
--- a/internal/pkg/onuadaptercore/uniportadmin.go
+++ b/internal/pkg/onuadaptercore/uniportadmin.go
@@ -41,6 +41,27 @@
 	pAdaptFsm                *AdapterFsm
 }
 
+const (
+	// events of lock/unlock UNI port FSM
+	uniEvStart         = "uniEvStart"
+	uniEvStartAdmin    = "uniEvStartAdmin"
+	uniEvRxUnisResp    = "uniEvRxUnisResp"
+	uniEvRxOnugResp    = "uniEvRxOnugResp"
+	uniEvTimeoutSimple = "uniEvTimeoutSimple"
+	uniEvTimeoutUnis   = "uniEvTimeoutUnis"
+	uniEvReset         = "uniEvReset"
+	uniEvRestart       = "uniEvRestart"
+)
+const (
+	// states of lock/unlock UNI port FSM
+	uniStDisabled    = "uniStDisabled"
+	uniStStarting    = "uniStStarting"
+	uniStSettingUnis = "uniStSettingUnis"
+	uniStSettingOnuG = "uniStSettingOnuG"
+	uniStAdminDone   = "uniStAdminDone"
+	uniStResetting   = "uniStResetting"
+)
+
 //NewLockStateFsm is the 'constructor' for the state machine to lock/unlock the ONU UNI ports via OMCI
 func NewLockStateFsm(apDevOmciCC *OmciCC, aAdminState bool, aRequestEvent OnuDeviceEvent,
 	aName string, aDeviceID string, aCommChannel chan Message) *LockStateFsm {
@@ -57,68 +78,68 @@
 	}
 	if aAdminState == true { //port locking requested
 		instFsm.pAdaptFsm.pFsm = fsm.NewFSM(
-			"disabled",
+			uniStDisabled,
 			fsm.Events{
 
-				{Name: "start", Src: []string{"disabled"}, Dst: "starting"},
+				{Name: uniEvStart, Src: []string{uniStDisabled}, Dst: uniStStarting},
 
-				{Name: "start_admin", Src: []string{"starting"}, Dst: "settingUnis"},
-				// the settingUnis state is used for multi ME config for alle UNI related ports
+				{Name: uniEvStartAdmin, Src: []string{uniStStarting}, Dst: uniStSettingUnis},
+				// the settingUnis state is used for multi ME config for all UNI related ports
 				// maybe such could be reflected in the state machine as well (port number parametrized)
 				// but that looks not straightforward here - so we keep it simple here for the beginning(?)
-				{Name: "rx_unis_resp", Src: []string{"settingUnis"}, Dst: "settingOnuG"},
-				{Name: "rx_onug_resp", Src: []string{"settingOnuG"}, Dst: "adminDone"},
+				{Name: uniEvRxUnisResp, Src: []string{uniStSettingUnis}, Dst: uniStSettingOnuG},
+				{Name: uniEvRxOnugResp, Src: []string{uniStSettingOnuG}, Dst: uniStAdminDone},
 
-				{Name: "timeout_simple", Src: []string{"settingOnuG"}, Dst: "starting"},
-				{Name: "timeout_unis", Src: []string{"settingUnis"}, Dst: "starting"},
+				{Name: uniEvTimeoutSimple, Src: []string{uniStSettingOnuG}, Dst: uniStStarting},
+				{Name: uniEvTimeoutUnis, Src: []string{uniStSettingUnis}, Dst: uniStStarting},
 
-				{Name: "reset", Src: []string{"starting", "settingOnuG", "settingUnis",
-					"adminDone"}, Dst: "resetting"},
-				// exceptional treatment for all states except "resetting"
-				{Name: "restart", Src: []string{"starting", "settingOnuG", "settingUnis",
-					"adminDone", "resetting"}, Dst: "disabled"},
+				{Name: uniEvReset, Src: []string{uniStStarting, uniStSettingOnuG, uniStSettingUnis,
+					uniStAdminDone}, Dst: uniStResetting},
+				// exceptional treatment for all states except uniStResetting
+				{Name: uniEvRestart, Src: []string{uniStStarting, uniStSettingOnuG, uniStSettingUnis,
+					uniStAdminDone, uniStResetting}, Dst: uniStDisabled},
 			},
 
 			fsm.Callbacks{
-				"enter_state":       func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
-				"enter_starting":    func(e *fsm.Event) { instFsm.enterAdminStartingState(e) },
-				"enter_settingOnuG": func(e *fsm.Event) { instFsm.enterSettingOnuGState(e) },
-				"enter_settingUnis": func(e *fsm.Event) { instFsm.enterSettingUnisState(e) },
-				"enter_adminDone":   func(e *fsm.Event) { instFsm.enterAdminDoneState(e) },
-				"enter_resetting":   func(e *fsm.Event) { instFsm.enterResettingState(e) },
+				"enter_state":                 func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
+				("enter_" + uniStStarting):    func(e *fsm.Event) { instFsm.enterAdminStartingState(e) },
+				("enter_" + uniStSettingOnuG): func(e *fsm.Event) { instFsm.enterSettingOnuGState(e) },
+				("enter_" + uniStSettingUnis): func(e *fsm.Event) { instFsm.enterSettingUnisState(e) },
+				("enter_" + uniStAdminDone):   func(e *fsm.Event) { instFsm.enterAdminDoneState(e) },
+				("enter_" + uniStResetting):   func(e *fsm.Event) { instFsm.enterResettingState(e) },
 			},
 		)
 	} else { //port unlocking requested
 		instFsm.pAdaptFsm.pFsm = fsm.NewFSM(
-			"disabled",
+			uniStDisabled,
 			fsm.Events{
 
-				{Name: "start", Src: []string{"disabled"}, Dst: "starting"},
+				{Name: uniEvStart, Src: []string{uniStDisabled}, Dst: uniStStarting},
 
-				{Name: "start_admin", Src: []string{"starting"}, Dst: "settingOnuG"},
-				{Name: "rx_onug_resp", Src: []string{"settingOnuG"}, Dst: "settingUnis"},
-				// the settingUnis state is used for multi ME config for alle UNI related ports
+				{Name: uniEvStartAdmin, Src: []string{uniStStarting}, Dst: uniStSettingOnuG},
+				{Name: uniEvRxOnugResp, Src: []string{uniStSettingOnuG}, Dst: uniStSettingUnis},
+				// the settingUnis state is used for multi ME config for all UNI related ports
 				// maybe such could be reflected in the state machine as well (port number parametrized)
 				// but that looks not straightforward here - so we keep it simple here for the beginning(?)
-				{Name: "rx_unis_resp", Src: []string{"settingUnis"}, Dst: "adminDone"},
+				{Name: uniEvRxUnisResp, Src: []string{uniStSettingUnis}, Dst: uniStAdminDone},
 
-				{Name: "timeout_simple", Src: []string{"settingOnuG"}, Dst: "starting"},
-				{Name: "timeout_unis", Src: []string{"settingUnis"}, Dst: "starting"},
+				{Name: uniEvTimeoutSimple, Src: []string{uniStSettingOnuG}, Dst: uniStStarting},
+				{Name: uniEvTimeoutUnis, Src: []string{uniStSettingUnis}, Dst: uniStStarting},
 
-				{Name: "reset", Src: []string{"starting", "settingOnuG", "settingUnis",
-					"adminDone"}, Dst: "resetting"},
-				// exceptional treatment for all states except "resetting"
-				{Name: "restart", Src: []string{"starting", "settingOnuG", "settingUnis",
-					"adminDone", "resetting"}, Dst: "disabled"},
+				{Name: uniEvReset, Src: []string{uniStStarting, uniStSettingOnuG, uniStSettingUnis,
+					uniStAdminDone}, Dst: uniStResetting},
+				// exceptional treatment for all states except uniStResetting
+				{Name: uniEvRestart, Src: []string{uniStStarting, uniStSettingOnuG, uniStSettingUnis,
+					uniStAdminDone, uniStResetting}, Dst: uniStDisabled},
 			},
 
 			fsm.Callbacks{
-				"enter_state":       func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
-				"enter_starting":    func(e *fsm.Event) { instFsm.enterAdminStartingState(e) },
-				"enter_settingOnuG": func(e *fsm.Event) { instFsm.enterSettingOnuGState(e) },
-				"enter_settingUnis": func(e *fsm.Event) { instFsm.enterSettingUnisState(e) },
-				"enter_adminDone":   func(e *fsm.Event) { instFsm.enterAdminDoneState(e) },
-				"enter_resetting":   func(e *fsm.Event) { instFsm.enterResettingState(e) },
+				"enter_state":                 func(e *fsm.Event) { instFsm.pAdaptFsm.logFsmStateChange(e) },
+				("enter_" + uniStStarting):    func(e *fsm.Event) { instFsm.enterAdminStartingState(e) },
+				("enter_" + uniStSettingOnuG): func(e *fsm.Event) { instFsm.enterSettingOnuGState(e) },
+				("enter_" + uniStSettingUnis): func(e *fsm.Event) { instFsm.enterSettingUnisState(e) },
+				("enter_" + uniStAdminDone):   func(e *fsm.Event) { instFsm.enterAdminDoneState(e) },
+				("enter_" + uniStResetting):   func(e *fsm.Event) { instFsm.enterResettingState(e) },
 			},
 		)
 	}
@@ -162,7 +183,7 @@
 		// 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("start_admin")
+				a_pAFsm.pFsm.Event(uniEvStartAdmin)
 			}
 		}(pLockStateAFsm)
 	}
@@ -201,7 +222,7 @@
 		// 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("reset")
+				a_pAFsm.pFsm.Event(uniEvReset)
 			}
 		}(pLockStateAFsm)
 	}
@@ -224,7 +245,7 @@
 		// see DownloadedState: decouple event transfer
 		go func(a_pAFsm *AdapterFsm) {
 			if a_pAFsm != nil && a_pAFsm.pFsm != nil {
-				a_pAFsm.pFsm.Event("restart")
+				a_pAFsm.pFsm.Event(uniEvRestart)
 			}
 		}(pLockStateAFsm)
 	}
@@ -242,7 +263,7 @@
 			if !ok {
 				logger.Info("LockStateFsm Rx Msg - could not read from channel", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
 				// but then we have to ensure a restart of the FSM as well - as exceptional procedure
-				oFsm.pAdaptFsm.pFsm.Event("restart")
+				oFsm.pAdaptFsm.pFsm.Event(uniEvRestart)
 				break loop
 			}
 			logger.Debugw("LockStateFsm Rx Msg", log.Fields{"device-id": oFsm.pAdaptFsm.deviceID})
@@ -298,7 +319,7 @@
 			switch oFsm.pOmciCC.pLastTxMeInstance.GetName() {
 			case "OnuG":
 				{ // let the FSM proceed ...
-					oFsm.pAdaptFsm.pFsm.Event("rx_onug_resp")
+					oFsm.pAdaptFsm.pFsm.Event(uniEvRxOnugResp)
 				}
 			case "UniG", "VEIP":
 				{ // let the PPTP init proceed by stopping the wait function
@@ -344,14 +365,14 @@
 		if err != nil {
 			logger.Errorw("PPTP Admin State set failed, aborting LockState set!",
 				log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID, "Port": uniNo})
-			oFsm.pAdaptFsm.pFsm.Event("reset")
+			oFsm.pAdaptFsm.pFsm.Event(uniEvReset)
 			return
 		}
 	} //for all UNI ports
 	// if Config has been done for all UNI related instances let the FSM proceed
 	// while we did not check here, if there is some port at all - !?
 	logger.Infow("PPTP config loop finished", log.Fields{"deviceId": oFsm.pAdaptFsm.deviceID})
-	oFsm.pAdaptFsm.pFsm.Event("rx_unis_resp")
+	oFsm.pAdaptFsm.pFsm.Event(uniEvRxUnisResp)
 	return
 }