VOL-1556 Add alarm simulation to voltha-go core
Change-Id: I23dcd720909a3e23cb203fd1ae32eada5fc4e34e
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
old mode 100644
new mode 100755
index f37244f..f9da623
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -496,7 +496,7 @@
}
// Notify the logical device manager to setup a logical port if needed
if port.Type == voltha.Port_ETHERNET_NNI || port.Type == voltha.Port_ETHERNET_UNI {
- if device , err := dMgr.GetDevice(deviceId); err == nil {
+ if device, err := dMgr.GetDevice(deviceId); err == nil {
go dMgr.logicalDeviceMgr.addLogicalPort(device, port)
} else {
log.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceId})
@@ -992,3 +992,16 @@
}
return nil
}
+
+func (dMgr *DeviceManager) simulateAlarm(ctx context.Context, simulatereq *voltha.SimulateAlarmRequest, ch chan interface{}) {
+ log.Debugw("simulateAlarm", log.Fields{"id": simulatereq.Id, "Indicator": simulatereq.Indicator, "IntfId": simulatereq.IntfId,
+ "PortTypeName": simulatereq.PortTypeName, "OnuDeviceId": simulatereq.OnuDeviceId, "InverseBitErrorRate": simulatereq.InverseBitErrorRate,
+ "Drift": simulatereq.Drift, "NewEqd": simulatereq.NewEqd, "OnuSerialNumber": simulatereq.OnuSerialNumber, "Operation": simulatereq.Operation})
+ var res interface{}
+ if agent := dMgr.getDeviceAgent(simulatereq.Id); agent != nil {
+ res = agent.simulateAlarm(ctx, simulatereq)
+ log.Debugw("SimulateAlarm-result", log.Fields{"result": res})
+ }
+ //TODO CLI always get successful response
+ sendResponse(ctx, ch, res)
+}