[VOL-4771] Error deleting device via voltctl when OLT is unreachable

Change-Id: I4cae0625a78a61b470db47b0339e078108d108c9
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index f39dcf7..6ee538b 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -41,6 +41,7 @@
 	onuLopcMissEvent                    = "ONU_LOPC_MISS"
 	onuLopcMicErrorEvent                = "ONU_LOPC_MIC_ERROR"
 	oltLosEvent                         = "OLT_LOSS_OF_SIGNAL"
+	oltRebootFailedEvent                = "OLT_REBOOT_FAILED"
 	oltCommFailure                      = "OLT_COMMUNICATION_FAILURE"
 	oltIndicationDown                   = "OLT_DOWN_INDICATION"
 	onuDyingGaspEvent                   = "ONU_DYING_GASP"
@@ -80,6 +81,8 @@
 	ContextOltAdminState = "admin-state"
 	// ContextOltConnectState is for the connect state of the Olt in the context of the event
 	ContextOltConnectState = "connect-state"
+	// ContextOltFailureReason is to report the reason of an operation failure in the Olt
+	ContextOltFailureReason = "failure-reason"
 	// ContextOltOperState is for the operational state of the Olt in the context of the event
 	ContextOltOperState = "oper-state"
 	// ContextOltVendor is for the Olt vendor in the context of the event
@@ -339,6 +342,20 @@
 	logger.Debugw(ctx, "olt-los-event-sent-to-kafka", log.Fields{"intf-id": ponIntdID})
 	return nil
 }
+func (em *OpenOltEventMgr) oltRebootFailedEvent(ctx context.Context, deviceID string, reason string, raisedTs int64) error {
+	de := voltha.DeviceEvent{
+		Context:         map[string]string{ContextOltFailureReason: "olt-reboot-failed"},
+		ResourceId:      deviceID,
+		DeviceEventName: fmt.Sprintf("%s_%s", oltRebootFailedEvent, "RAISE_EVENT")}
+	if err := em.eventProxy.SendDeviceEvent(ctx, &de, voltha.EventCategory_COMMUNICATION, voltha.EventSubCategory_OLT,
+		raisedTs); err != nil {
+		return olterrors.NewErrCommunication("send-olt-reboot-failed-event", log.Fields{
+			"device-id": deviceID, "raised-ts": raisedTs}, err)
+	}
+	logger.Debugw(ctx, "olt-reboot-failed-event-sent-to-kafka", log.Fields{
+		"device-id": deviceID, "raised-ts": raisedTs})
+	return nil
+}
 
 func (em *OpenOltEventMgr) populateContextWithSerialDeviceID(context map[string]string, intfID, onuID uint32) string {
 	var serialNumber = ""