VOL-3730
* When the OLT connectState is unreachable, raise OLT Communication Failure alarm (publish raise-alarm to kafka)
* When the OLT state is up, clear OLT Comunication Failure alarm (publish clear-alarm to kafka)

Change-Id: Ief3d48e359490e6638842042347029e2cbdd17aa
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 413e490..2e04e21 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -604,6 +604,13 @@
 		voltha.OperStatus_ACTIVE); err != nil {
 		return olterrors.NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err)
 	}
+
+	//Clear olt communication failure event
+	dh.device.ConnectStatus = voltha.ConnectStatus_REACHABLE
+	dh.device.OperStatus = voltha.OperStatus_ACTIVE
+	raisedTs := time.Now().UnixNano()
+	go dh.eventMgr.oltCommunicationEvent(ctx, dh.device, raisedTs)
+
 	return nil
 }
 
@@ -1959,6 +1966,13 @@
 		if err = dh.coreProxy.PortsStateUpdate(ctx, dh.device.Id, 0, voltha.OperStatus_UNKNOWN); err != nil {
 			_ = olterrors.NewErrAdapter("port-update-failed", log.Fields{"device-id": dh.device.Id}, err).Log()
 		}
+
+		//raise olt communication failure event
+		raisedTs := time.Now().UnixNano()
+		device.ConnectStatus = voltha.ConnectStatus_UNREACHABLE
+		device.OperStatus = voltha.OperStatus_UNKNOWN
+		go dh.eventMgr.oltCommunicationEvent(ctx, device, raisedTs)
+
 		go dh.cleanupDeviceResources(ctx)
 
 		dh.lockDevice.RLock()