[VOL-3785] New Kafka event notifications for errors in OMCI communication and MDS audit

Change-Id: I98ca4092d18d364bc05e4a899886a9bcdc38cf17
diff --git a/internal/pkg/common/defines.go b/internal/pkg/common/defines.go
index d0135aa..06bc4b2 100755
--- a/internal/pkg/common/defines.go
+++ b/internal/pkg/common/defines.go
@@ -345,3 +345,17 @@
 type WaitGroupWithTimeOut struct {
 	sync.WaitGroup
 }
+
+///////////////////////////////////////////////////////////
+
+// event notifications
+const (
+	OnuMibAuditFailureMds     = "ONU_MIB_AUDIT_FAILURE_MDS"
+	OnuMibAuditFailureMdsDesc = "MIB audit failed due to MDS value mismatch between ONU and adapter"
+
+	OnuOmciCommunicationFailureConfig     = "ONU_OMCI_COMMUNICATION_FAILURE_CONFIG"
+	OnuOmciCommunicationFailureConfigDesc = "OMCI communication during ONU configuration failed"
+
+	OnuOmciCommunicationFailureSwUpgrade     = "ONU_OMCI_COMMUNICATION_FAILURE_SW_UPGRADE"
+	OnuOmciCommunicationFailureSwUpgradeDesc = "OMCI communication during ONU SW upgrade failed"
+)
diff --git a/internal/pkg/common/interfaces.go b/internal/pkg/common/interfaces.go
index 4c4878a..a204539 100755
--- a/internal/pkg/common/interfaces.go
+++ b/internal/pkg/common/interfaces.go
@@ -150,6 +150,8 @@
 
 	AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
 	FreeTcont(context.Context, uint16)
+
+	SendOnuDeviceEvent(context.Context, string, string)
 }
 
 // IonuMetricsManager interface to onuMetricsManager
diff --git a/internal/pkg/common/omci_cc.go b/internal/pkg/common/omci_cc.go
index a3df18a..d11173f 100755
--- a/internal/pkg/common/omci_cc.go
+++ b/internal/pkg/common/omci_cc.go
@@ -4296,8 +4296,9 @@
 			break loop
 		case <-time.After(time.Duration(aTimeout) * time.Second):
 			if retryCounter == retries {
-				logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached!",
+				logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - send ONU device event!",
 					log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID})
+				oo.pOnuDeviceEntry.SendOnuDeviceEvent(ctx, OnuOmciCommunicationFailureSwUpgrade, OnuOmciCommunicationFailureSwUpgradeDesc)
 				break loop
 			} else {
 				logger.Infow(ctx, "reqMon: timeout waiting for response - retry",
@@ -4705,8 +4706,9 @@
 			break loop
 		case <-time.After(time.Duration(aTimeout) * time.Second):
 			if retryCounter == retries {
-				logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached!",
+				logger.Errorw(ctx, "reqMon: timeout waiting for response - no of max retries reached - send ONU device event!",
 					log.Fields{"tid": tid, "retries": retryCounter, "device-id": oo.deviceID})
+				oo.pOnuDeviceEntry.SendOnuDeviceEvent(ctx, OnuOmciCommunicationFailureConfig, OnuOmciCommunicationFailureConfigDesc)
 				break loop
 			} else {
 				logger.Infow(ctx, "reqMon: timeout waiting for response - retry",