Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Package adaptercore provides APIs for the openOLT adapter |
| 18 | package adaptercore |
| 19 | |
| 20 | import ( |
| 21 | "fmt" |
Scott Baker | 5129015 | 2019-10-24 14:23:20 -0700 | [diff] [blame] | 22 | "github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif" |
| 23 | "github.com/opencord/voltha-lib-go/v2/pkg/log" |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 24 | oop "github.com/opencord/voltha-protos/go/openolt" |
| 25 | "github.com/opencord/voltha-protos/go/voltha" |
| 26 | ) |
| 27 | |
| 28 | const ( |
| 29 | onuDiscoveryEvent = "ONU_DISCOVERY" |
| 30 | onuLosEvent = "ONU_LOSS_OF_SIGNAL" |
| 31 | onuLobEvent = "ONU_LOSS_OF_BURST" |
| 32 | onuLopcMissEvent = "ONU_LOPC_MISS" |
| 33 | onuLopcMicErrorEvent = "ONU_LOPC_MIC_ERROR" |
| 34 | oltLosEvent = "OLT_LOSS_OF_SIGNAL" |
Daniele Rossi | 051466a | 2019-07-26 13:39:37 +0000 | [diff] [blame] | 35 | oltIndicationDown = "OLT_DOWN_INDICATION" |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 36 | onuDyingGaspEvent = "ONU_DYING_GASP" |
| 37 | onuSignalsFailEvent = "ONU_SIGNALS_FAIL" |
| 38 | onuStartupFailEvent = "ONU_STARTUP_FAIL" |
| 39 | onuSignalDegradeEvent = "ONU_SIGNAL_DEGRADE" |
| 40 | onuDriftOfWindowEvent = "ONU_DRIFT_OF_WINDOW" |
| 41 | onuActivationFailEvent = "ONU_ACTIVATION_FAIL" |
| 42 | onuProcessingErrorEvent = "ONU_PROCESSING_ERROR" |
| 43 | onuTiwiEvent = "ONU_TRANSMISSION_WARNING" |
| 44 | onuLossOmciEvent = "ONU_LOSS_OF_OMCI_CHANNEL" |
| 45 | ) |
| 46 | |
| 47 | const ( |
| 48 | pon = voltha.EventSubCategory_PON |
| 49 | olt = voltha.EventSubCategory_OLT |
| 50 | ont = voltha.EventSubCategory_ONT |
| 51 | onu = voltha.EventSubCategory_ONU |
| 52 | nni = voltha.EventSubCategory_NNI |
| 53 | service = voltha.EventCategory_SERVICE |
| 54 | security = voltha.EventCategory_SECURITY |
| 55 | equipment = voltha.EventCategory_EQUIPMENT |
| 56 | processing = voltha.EventCategory_PROCESSING |
| 57 | environment = voltha.EventCategory_ENVIRONMENT |
| 58 | communication = voltha.EventCategory_COMMUNICATION |
| 59 | ) |
| 60 | |
| 61 | // OpenOltEventMgr struct contains |
| 62 | type OpenOltEventMgr struct { |
kdarapu | 381c690 | 2019-07-31 18:23:16 +0530 | [diff] [blame] | 63 | eventProxy adapterif.EventProxy |
Devmalya Paul | 90ca301 | 2019-09-02 21:55:45 -0400 | [diff] [blame] | 64 | handler *DeviceHandler |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | // NewEventMgr is a Function to get a new event manager struct for the OpenOLT to process and publish OpenOLT event |
Devmalya Paul | 90ca301 | 2019-09-02 21:55:45 -0400 | [diff] [blame] | 68 | func NewEventMgr(eventProxy adapterif.EventProxy, handler *DeviceHandler) *OpenOltEventMgr { |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 69 | var em OpenOltEventMgr |
| 70 | em.eventProxy = eventProxy |
Devmalya Paul | 90ca301 | 2019-09-02 21:55:45 -0400 | [diff] [blame] | 71 | em.handler = handler |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 72 | return &em |
| 73 | } |
| 74 | |
| 75 | // ProcessEvents is function to process and publish OpenOLT event |
| 76 | func (em *OpenOltEventMgr) ProcessEvents(alarmInd *oop.AlarmIndication, deviceID string, raisedTs int64) { |
| 77 | |
| 78 | switch alarmInd.Data.(type) { |
| 79 | case *oop.AlarmIndication_LosInd: |
| 80 | log.Infow("Received LOS indication", log.Fields{"alarm_ind": alarmInd}) |
| 81 | em.oltLosIndication(alarmInd.GetLosInd(), deviceID, raisedTs) |
| 82 | |
| 83 | case *oop.AlarmIndication_OnuAlarmInd: |
| 84 | log.Infow("Received onu alarm indication ", log.Fields{"alarm_ind": alarmInd}) |
| 85 | em.onuAlarmIndication(alarmInd.GetOnuAlarmInd(), deviceID, raisedTs) |
| 86 | |
| 87 | case *oop.AlarmIndication_DyingGaspInd: |
| 88 | log.Infow("Received dying gasp indication", log.Fields{"alarm_ind": alarmInd}) |
| 89 | em.onuDyingGaspIndication(alarmInd.GetDyingGaspInd(), deviceID, raisedTs) |
| 90 | |
| 91 | case *oop.AlarmIndication_OnuActivationFailInd: |
| 92 | log.Infow("Received onu activation fail indication ", log.Fields{"alarm_ind": alarmInd}) |
| 93 | em.onuActivationFailIndication(alarmInd.GetOnuActivationFailInd(), deviceID, raisedTs) |
| 94 | |
| 95 | case *oop.AlarmIndication_OnuLossOmciInd: |
| 96 | log.Infow("Received onu loss omci indication ", log.Fields{"alarm_ind": alarmInd}) |
| 97 | em.onuLossOmciIndication(alarmInd.GetOnuLossOmciInd(), deviceID, raisedTs) |
| 98 | |
| 99 | case *oop.AlarmIndication_OnuDriftOfWindowInd: |
| 100 | log.Infow("Received onu drift of window indication ", log.Fields{"alarm_ind": alarmInd}) |
| 101 | em.onuDriftOfWindowIndication(alarmInd.GetOnuDriftOfWindowInd(), deviceID, raisedTs) |
| 102 | |
| 103 | case *oop.AlarmIndication_OnuSignalDegradeInd: |
| 104 | log.Infow("Received onu signal degrade indication ", log.Fields{"alarm_ind": alarmInd}) |
| 105 | em.onuSignalDegradeIndication(alarmInd.GetOnuSignalDegradeInd(), deviceID, raisedTs) |
| 106 | |
| 107 | case *oop.AlarmIndication_OnuSignalsFailInd: |
| 108 | log.Infow("Received onu signal fail indication ", log.Fields{"alarm_ind": alarmInd}) |
| 109 | em.onuSignalsFailIndication(alarmInd.GetOnuSignalsFailInd(), deviceID, raisedTs) |
| 110 | |
| 111 | case *oop.AlarmIndication_OnuProcessingErrorInd: |
| 112 | log.Infow("Received onu startup fail indication ", log.Fields{"alarm_ind": alarmInd}) |
| 113 | log.Infow("Not implemented yet", log.Fields{"alarm_ind": alarmInd}) |
| 114 | case *oop.AlarmIndication_OnuTiwiInd: |
| 115 | log.Infow("Received onu transmission warning indication ", log.Fields{"alarm_ind": alarmInd}) |
| 116 | log.Infow("Not implemented yet", log.Fields{"alarm_ind": "Onu-Transmission-indication"}) |
| 117 | default: |
| 118 | log.Errorw("Received unknown indication type", log.Fields{"alarm_ind": alarmInd}) |
| 119 | |
| 120 | } |
| 121 | } |
| 122 | |
Daniele Rossi | 051466a | 2019-07-26 13:39:37 +0000 | [diff] [blame] | 123 | // oltUpDownIndication handles Up and Down state of an OLT |
| 124 | func (em *OpenOltEventMgr) oltUpDownIndication(oltIndication *oop.OltIndication, deviceID string, raisedTs int64) { |
| 125 | var de voltha.DeviceEvent |
| 126 | context := make(map[string]string) |
| 127 | /* Populating event context */ |
| 128 | context["oper-state"] = string(oltIndication.OperState) |
| 129 | /* Populating device event body */ |
| 130 | de.Context = context |
| 131 | de.ResourceId = deviceID |
| 132 | if oltIndication.OperState == "down" { |
| 133 | de.DeviceEventName = fmt.Sprintf("%s_%s", oltIndicationDown, "RAISE_EVENT") |
| 134 | } else if oltIndication.OperState == "up" { |
| 135 | de.DeviceEventName = fmt.Sprintf("%s_%s", oltIndicationDown, "CLEAR_EVENT") |
| 136 | } |
| 137 | /* Send event to KAFKA */ |
| 138 | if err := em.eventProxy.SendDeviceEvent(&de, communication, olt, raisedTs); err != nil { |
| 139 | log.Errorw("Failed to send OLT event", log.Fields{"err": err}) |
| 140 | } |
| 141 | log.Infow("OLT UpDown event sent to KAFKA", log.Fields{}) |
| 142 | } |
| 143 | |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 144 | // OnuDiscoveryIndication is an exported method to handle ONU discovery event |
| 145 | func (em *OpenOltEventMgr) OnuDiscoveryIndication(onuDisc *oop.OnuDiscIndication, deviceID string, OnuID uint32, serialNumber string, raisedTs int64) { |
| 146 | var de voltha.DeviceEvent |
| 147 | context := make(map[string]string) |
| 148 | /* Populating event context */ |
| 149 | context["onu-id"] = string(OnuID) |
| 150 | context["intf-id"] = string(onuDisc.IntfId) |
| 151 | context["serial-number"] = serialNumber |
| 152 | /* Populating device event body */ |
| 153 | de.Context = context |
| 154 | de.ResourceId = deviceID |
| 155 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuDiscoveryEvent, "RAISE_EVENT") |
| 156 | /* Send event to KAFKA */ |
| 157 | if err := em.eventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil { |
| 158 | log.Errorw("Failed to send ONU discovery event", log.Fields{"serial-number": serialNumber, "intf-id": onuDisc.IntfId}) |
| 159 | } |
| 160 | log.Infow("ONU discovery event sent to KAFKA", log.Fields{"serial-number": serialNumber, "intf-id": onuDisc.IntfId}) |
| 161 | } |
| 162 | |
| 163 | func (em *OpenOltEventMgr) oltLosIndication(oltLos *oop.LosIndication, deviceID string, raisedTs int64) { |
| 164 | var de voltha.DeviceEvent |
| 165 | context := make(map[string]string) |
| 166 | /* Populating event context */ |
| 167 | context["intf-id"] = string(oltLos.IntfId) |
| 168 | /* Populating device event body */ |
| 169 | de.Context = context |
| 170 | de.ResourceId = deviceID |
| 171 | if oltLos.Status == "on" { |
| 172 | de.DeviceEventName = fmt.Sprintf("%s_%s", oltLosEvent, "RAISE_EVENT") |
| 173 | } else { |
| 174 | de.DeviceEventName = fmt.Sprintf("%s_%s", oltLosEvent, "CLEAR_EVENT") |
| 175 | } |
| 176 | /* Send event to KAFKA */ |
| 177 | if err := em.eventProxy.SendDeviceEvent(&de, communication, olt, raisedTs); err != nil { |
| 178 | log.Errorw("Failed to send OLT loss of signal event", log.Fields{"intf-id": oltLos.IntfId}) |
| 179 | } |
| 180 | log.Infow("OLT LOS event sent to KAFKA", log.Fields{"intf-id": oltLos.IntfId}) |
| 181 | } |
| 182 | |
| 183 | func (em *OpenOltEventMgr) onuDyingGaspIndication(dgi *oop.DyingGaspIndication, deviceID string, raisedTs int64) { |
| 184 | var de voltha.DeviceEvent |
Devmalya Paul | 90ca301 | 2019-09-02 21:55:45 -0400 | [diff] [blame] | 185 | var serialNumber string |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 186 | context := make(map[string]string) |
| 187 | /* Populating event context */ |
Devmalya Paul | 90ca301 | 2019-09-02 21:55:45 -0400 | [diff] [blame] | 188 | serialNumber = "" |
| 189 | if onu, ok := em.handler.onus[em.handler.formOnuKey(dgi.IntfId, dgi.OnuId)]; ok { |
| 190 | serialNumber = onu.serialNumber |
| 191 | } |
| 192 | context["serial-number"] = serialNumber |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 193 | context["intf-id"] = string(dgi.IntfId) |
| 194 | context["onu-id"] = string(dgi.OnuId) |
| 195 | /* Populating device event body */ |
| 196 | de.Context = context |
| 197 | de.ResourceId = deviceID |
| 198 | if dgi.Status == "on" { |
| 199 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuDyingGaspEvent, "RAISE_EVENT") |
| 200 | } else { |
| 201 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuDyingGaspEvent, "CLEAR_EVENT") |
| 202 | } |
| 203 | /* Send event to KAFKA */ |
| 204 | if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil { |
| 205 | log.Errorw("Failed to send ONU Dying gasp event", log.Fields{"intf-id": dgi.IntfId, "onu-id": dgi.OnuId}) |
| 206 | } |
| 207 | log.Infow("ONU dying gasp event sent to KAFKA", log.Fields{"intf-id": dgi.IntfId}) |
| 208 | } |
| 209 | |
| 210 | func (em *OpenOltEventMgr) onuAlarmIndication(onuAlarm *oop.OnuAlarmIndication, deviceID string, raisedTs int64) { |
| 211 | var de voltha.DeviceEvent |
| 212 | context := make(map[string]string) |
| 213 | /* Populating event context */ |
| 214 | context["intf-id"] = string(onuAlarm.IntfId) |
| 215 | context["onu-id"] = string(onuAlarm.OnuId) |
| 216 | /* Populating device event body */ |
| 217 | de.Context = context |
| 218 | de.ResourceId = deviceID |
| 219 | if onuAlarm.LosStatus == "on" { |
| 220 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLosEvent, "RAISE_EVENT") |
| 221 | } else if onuAlarm.LosStatus == "off" { |
| 222 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLosEvent, "CLEAR_EVENT") |
| 223 | } else if onuAlarm.LobStatus == "on" { |
| 224 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLobEvent, "RAISE_EVENT") |
| 225 | } else if onuAlarm.LobStatus == "off" { |
| 226 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLobEvent, "CLEAR_EVENT") |
| 227 | } else if onuAlarm.LopcMissStatus == "on" { |
| 228 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLopcMissEvent, "RAISE_EVENT") |
| 229 | } else if onuAlarm.LopcMissStatus == "off" { |
| 230 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLopcMissEvent, "CLEAR_EVENT") |
| 231 | } else if onuAlarm.LopcMicErrorStatus == "on" { |
| 232 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLopcMicErrorEvent, "RAISE_EVENT") |
| 233 | } else if onuAlarm.LopcMicErrorStatus == "off" { |
| 234 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLopcMicErrorEvent, "CLEAR_EVENT") |
| 235 | } |
| 236 | /* Send event to KAFKA */ |
| 237 | if err := em.eventProxy.SendDeviceEvent(&de, communication, onu, raisedTs); err != nil { |
| 238 | log.Errorw("Failed to send ONU Los event", log.Fields{"onu-id": onuAlarm.OnuId, "intf-id": onuAlarm.IntfId}) |
| 239 | } |
| 240 | log.Infow("ONU LOS event sent to KAFKA", log.Fields{"onu-id": onuAlarm.OnuId, "intf-id": onuAlarm.IntfId}) |
| 241 | } |
| 242 | |
| 243 | func (em *OpenOltEventMgr) onuActivationFailIndication(oaf *oop.OnuActivationFailureIndication, deviceID string, raisedTs int64) { |
| 244 | var de voltha.DeviceEvent |
| 245 | context := make(map[string]string) |
| 246 | /* Populating event context */ |
| 247 | context["intf-id"] = string(oaf.IntfId) |
| 248 | context["onu-id"] = string(oaf.OnuId) |
| 249 | /* Populating device event body */ |
| 250 | de.Context = context |
| 251 | de.ResourceId = deviceID |
| 252 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuActivationFailEvent, "RAISE_EVENT") |
| 253 | /* Send event to KAFKA */ |
| 254 | if err := em.eventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil { |
| 255 | log.Errorw("Failed to send ONU activation failure event", log.Fields{"onu-id": oaf.OnuId, "intf-id": oaf.IntfId}) |
| 256 | } |
| 257 | log.Infow("ONU activation failure event sent to KAFKA", log.Fields{"onu-id": oaf.OnuId, "intf-id": oaf.IntfId}) |
| 258 | } |
| 259 | |
| 260 | func (em *OpenOltEventMgr) onuLossOmciIndication(onuLossOmci *oop.OnuLossOfOmciChannelIndication, deviceID string, raisedTs int64) { |
| 261 | var de voltha.DeviceEvent |
| 262 | context := make(map[string]string) |
| 263 | /* Populating event context */ |
| 264 | context["intf-id"] = string(onuLossOmci.IntfId) |
| 265 | context["onu-id"] = string(onuLossOmci.OnuId) |
| 266 | /* Populating device event body */ |
| 267 | de.Context = context |
| 268 | de.ResourceId = deviceID |
| 269 | if onuLossOmci.Status == "on" { |
| 270 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLossOmciEvent, "RAISE_EVENT") |
| 271 | } else { |
| 272 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuLossOmciEvent, "CLEAR_EVENT") |
| 273 | } |
| 274 | /* Send event to KAFKA */ |
| 275 | if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil { |
| 276 | log.Errorw("Failed to send ONU loss of OMCI channel event", log.Fields{"onu-id": onuLossOmci.OnuId, "intf-id": onuLossOmci.IntfId}) |
| 277 | } |
| 278 | log.Infow("ONU loss of OMCI channel event sent to KAFKA", log.Fields{"onu-id": onuLossOmci.OnuId, "intf-id": onuLossOmci.IntfId}) |
| 279 | } |
| 280 | |
| 281 | func (em *OpenOltEventMgr) onuDriftOfWindowIndication(onuDriftWindow *oop.OnuDriftOfWindowIndication, deviceID string, raisedTs int64) { |
| 282 | var de voltha.DeviceEvent |
| 283 | context := make(map[string]string) |
| 284 | /* Populating event context */ |
| 285 | context["intf-id"] = string(onuDriftWindow.IntfId) |
| 286 | context["onu-id"] = string(onuDriftWindow.OnuId) |
| 287 | context["drift"] = string(onuDriftWindow.OnuId) |
| 288 | context["new-eqd"] = string(onuDriftWindow.OnuId) |
| 289 | /* Populating device event body */ |
| 290 | de.Context = context |
| 291 | de.ResourceId = deviceID |
| 292 | if onuDriftWindow.Status == "on" { |
| 293 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuDriftOfWindowEvent, "RAISE_EVENT") |
| 294 | } else { |
| 295 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuDriftOfWindowEvent, "CLEAR_EVENT") |
| 296 | } |
| 297 | /* Send event to KAFKA */ |
| 298 | if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil { |
| 299 | log.Errorw("Failed to send ONU drift of window event", log.Fields{"onu-id": onuDriftWindow.OnuId, "intf-id": onuDriftWindow.IntfId}) |
| 300 | } |
| 301 | log.Infow("ONU drift of window event sent to KAFKA", log.Fields{"onu-id": onuDriftWindow.OnuId, "intf-id": onuDriftWindow.IntfId}) |
| 302 | } |
| 303 | |
| 304 | func (em *OpenOltEventMgr) onuSignalDegradeIndication(onuSignalDegrade *oop.OnuSignalDegradeIndication, deviceID string, raisedTs int64) { |
| 305 | var de voltha.DeviceEvent |
| 306 | context := make(map[string]string) |
| 307 | /* Populating event context */ |
| 308 | context["intf-id"] = string(onuSignalDegrade.IntfId) |
| 309 | context["onu-id"] = string(onuSignalDegrade.OnuId) |
| 310 | /* Populating device event body */ |
| 311 | de.Context = context |
| 312 | de.ResourceId = deviceID |
| 313 | if onuSignalDegrade.Status == "on" { |
| 314 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuSignalDegradeEvent, "RAISE_EVENT") |
| 315 | } else { |
| 316 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuSignalDegradeEvent, "CLEAR_EVENT") |
| 317 | } |
| 318 | /* Send event to KAFKA */ |
| 319 | if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil { |
| 320 | log.Errorw("Failed to send ONU signals degrade event", log.Fields{"onu-id": onuSignalDegrade.OnuId, "intf-id": onuSignalDegrade.IntfId}) |
| 321 | } |
| 322 | log.Infow("ONU signal degrade event sent to KAFKA", log.Fields{"onu-id": onuSignalDegrade.OnuId, "intf-id": onuSignalDegrade.IntfId}) |
| 323 | } |
| 324 | |
| 325 | func (em *OpenOltEventMgr) onuSignalsFailIndication(onuSignalsFail *oop.OnuSignalsFailureIndication, deviceID string, raisedTs int64) { |
| 326 | var de voltha.DeviceEvent |
| 327 | context := make(map[string]string) |
| 328 | /* Populating event context */ |
| 329 | context["onu-id"] = string(onuSignalsFail.OnuId) |
| 330 | context["intf-id"] = string(onuSignalsFail.IntfId) |
| 331 | context["inverse-bit-error-rate"] = string(onuSignalsFail.InverseBitErrorRate) |
| 332 | /* Populating device event body */ |
| 333 | de.Context = context |
| 334 | de.ResourceId = deviceID |
| 335 | if onuSignalsFail.Status == "on" { |
| 336 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuSignalsFailEvent, "RAISE_EVENT") |
| 337 | } else { |
| 338 | de.DeviceEventName = fmt.Sprintf("%s_%s", onuSignalsFailEvent, "CLEAR_EVENT") |
| 339 | } |
| 340 | /* Send event to KAFKA */ |
| 341 | if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil { |
| 342 | log.Errorw("Failed to send ONU signals fail event", log.Fields{"onu-id": onuSignalsFail.OnuId, "intf-id": onuSignalsFail.IntfId}) |
| 343 | } |
| 344 | log.Infow("ONU signals fail event sent to KAFKA", log.Fields{"onu-id": onuSignalsFail.OnuId, "intf-id": onuSignalsFail.IntfId}) |
| 345 | } |