VOL-3444 Handling of ONT Activation Failure and generation of an alarm
Change-Id: Ibb931634616722f00b930bafaab84bdd67459192
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index 584cfe0..df7b5cf 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -130,9 +130,6 @@
case *oop.AlarmIndication_DyingGaspInd:
logger.Debugw(ctx, "received-dying-gasp-indication", log.Fields{"alarm-ind": alarmInd})
err = em.onuDyingGaspIndication(ctx, alarmInd.GetDyingGaspInd(), deviceID, raisedTs)
- case *oop.AlarmIndication_OnuActivationFailInd:
- logger.Debugw(ctx, "received-onu-activation-fail-indication ", log.Fields{"alarm-ind": alarmInd})
- err = em.onuActivationFailIndication(ctx, alarmInd.GetOnuActivationFailInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuLossOmciInd:
logger.Debugw(ctx, "received-onu-loss-omci-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuLossOmciIndication(ctx, alarmInd.GetOnuLossOmciInd(), deviceID, raisedTs)
@@ -423,25 +420,25 @@
return nil
}
-func (em *OpenOltEventMgr) onuActivationFailIndication(ctx context.Context, oaf *oop.OnuActivationFailureIndication, deviceID string, raisedTs int64) error {
+func (em *OpenOltEventMgr) onuActivationIndication(ctx context.Context, eventName string, onuInd *oop.OnuIndication, deviceID string, raisedTs int64) error {
var de voltha.DeviceEvent
context := make(map[string]string)
/* Populating event context */
- context[ContextOnuPonIntfID] = strconv.FormatUint(uint64(oaf.IntfId), base10)
- context[ContextOnuOnuID] = strconv.FormatUint(uint64(oaf.OnuId), base10)
- context[ContextOnuFailureReaseon] = strconv.FormatUint(uint64(oaf.FailReason), base10)
+ context[ContextOnuPonIntfID] = strconv.FormatUint(uint64(onuInd.IntfId), base10)
+ context[ContextOnuOnuID] = strconv.FormatUint(uint64(onuInd.OnuId), base10)
+ context[ContextOnuFailureReaseon] = onuInd.FailReason.String()
- em.populateContextWithSerialDeviceID(context, oaf.IntfId, oaf.OnuId)
+ em.populateContextWithSerialDeviceID(context, onuInd.IntfId, onuInd.OnuId)
/* Populating device event body */
de.Context = context
de.ResourceId = deviceID
- de.DeviceEventName = fmt.Sprintf("%s_%s", onuActivationFailEvent, "RAISE_EVENT")
+ de.DeviceEventName = eventName
/* Send event to KAFKA */
if err := em.eventProxy.SendDeviceEvent(ctx, &de, voltha.EventCategory_EQUIPMENT, voltha.EventSubCategory_PON, raisedTs); err != nil {
return err
}
- logger.Debugw(ctx, "onu-activation-failure-event-sent-to-kafka", log.Fields{"onu-id": oaf.OnuId, "intf-id": oaf.IntfId})
+ logger.Debugw(ctx, "onu-activation-failure-event-sent-to-kafka", log.Fields{"onu-id": onuInd.OnuId, "intf-id": onuInd.IntfId})
return nil
}