VOL-1863 Changing the omci indication forwarding to happen in a go routine
Change-Id: I55c67f6ae22e422f9ed9412e5e2f29a3d082f3fc
diff --git a/adaptercore/device_handler.go b/adaptercore/device_handler.go
index f5e5ffb..5bf9417 100644
--- a/adaptercore/device_handler.go
+++ b/adaptercore/device_handler.go
@@ -242,6 +242,7 @@
// readIndications to read the indications from the OLT device
func (dh *DeviceHandler) readIndications() {
+ defer log.Errorw("Indications ended", log.Fields{})
indications, err := dh.Client.EnableIndication(context.Background(), new(oop.Empty))
if err != nil {
log.Errorw("Failed to read indications", log.Fields{"err": err})
@@ -340,9 +341,7 @@
case *oop.Indication_OmciInd:
omciInd := indication.GetOmciInd()
log.Infow("Received Omci indication ", log.Fields{"OmciInd": omciInd})
- if err := dh.omciIndication(omciInd); err != nil {
- log.Errorw("send-omci-indication-errr", log.Fields{"error": err, "omciInd": omciInd})
- }
+ go dh.omciIndication(omciInd)
case *oop.Indication_PktInd:
pktInd := indication.GetPktInd()
log.Infow("Received pakcet indication ", log.Fields{"PktInd": pktInd})
@@ -606,7 +605,7 @@
}, nil
}
-func (dh *DeviceHandler) omciIndication(omciInd *oop.OmciIndication) error {
+func (dh *DeviceHandler) omciIndication(omciInd *oop.OmciIndication) {
log.Debugw("omci indication", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId})
var deviceType string
var deviceID string
@@ -622,8 +621,8 @@
onuDevice, err := dh.coreProxy.GetChildDevice(context.TODO(), dh.device.Id, kwargs)
if err != nil {
- log.Errorw("onu not found", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId})
- return err
+ log.Errorw("onu not found", log.Fields{"intfID": omciInd.IntfId, "onuID": omciInd.OnuId, "error": err})
+ return
}
deviceType = onuDevice.Type
deviceID = onuDevice.Id
@@ -642,10 +641,10 @@
if sendErr := dh.AdapterProxy.SendInterAdapterMessage(context.Background(), omciMsg,
ic.InterAdapterMessageType_OMCI_REQUEST, dh.deviceType, deviceType,
deviceID, proxyDeviceID, ""); sendErr != nil {
- log.Errorw("send omci request error", log.Fields{"fromAdapter": dh.deviceType, "toAdapter": deviceType, "onuID": deviceID, "proxyDeviceID": proxyDeviceID})
- return sendErr
+ log.Errorw("send omci request error", log.Fields{"fromAdapter": dh.deviceType, "toAdapter": deviceType, "onuID": deviceID, "proxyDeviceID": proxyDeviceID, "error": sendErr})
+ return
}
- return nil
+ return
}
//ProcessInterAdapterMessage sends the proxied messages to the target device