[VOL-5400] Added locks for mapPonAniConfig and handled the device deletion using commChan during processOmciAniMessages

Signed-off-by: bseeniva <balaji.seenivasan@radisys.com>
Change-Id: Ibb1618eee165bc310517335c9d050b00b381d41a
diff --git a/internal/pkg/avcfg/onu_uni_tp.go b/internal/pkg/avcfg/onu_uni_tp.go
index 19f8453..4f51b1a 100755
--- a/internal/pkg/avcfg/onu_uni_tp.go
+++ b/internal/pkg/avcfg/onu_uni_tp.go
@@ -773,6 +773,7 @@
 func (onuTP *OnuUniTechProf) IsTechProfileConfigCleared(ctx context.Context, uniID uint8, tpID uint8) bool {
 	uniTPKey := uniTP{uniID: uniID, tpID: tpID}
 	logger.Debugw(ctx, "IsTechProfileConfigCleared", log.Fields{"device-id": onuTP.deviceID})
+	onuTP.mutexTPState.RLock()
 	if onuTP.mapPonAniConfig[uniTPKey] != nil {
 		mapGemPortParams := onuTP.mapPonAniConfig[uniTPKey].mapGemPortParams
 		unicastGemCount := 0
@@ -782,6 +783,7 @@
 			}
 		}
 		if unicastGemCount == 0 || onuTP.mapPonAniConfig[uniTPKey].tcontParams.allocID == 0 {
+			onuTP.mutexTPState.RUnlock()
 			logger.Debugw(ctx, "clearing-ani-side-config", log.Fields{
 				"device-id": onuTP.deviceID, "uniTpKey": uniTPKey})
 			onuTP.clearAniSideConfig(ctx, uniID, tpID)
@@ -792,6 +794,7 @@
 			return true
 		}
 	}
+	onuTP.mutexTPState.RUnlock()
 	return false
 }