use of org.onosproject.alarm.DeviceAlarmConfig in project onos by opennetworkinglab.
the class SnmpAlarmProvider method getAlarmTranslator.
private DeviceAlarmConfig getAlarmTranslator(SnmpDevice device) {
Driver deviceDriver = driverService.getDriver(device.deviceId());
if (deviceDriver != null && deviceDriver.hasBehaviour(DeviceAlarmConfig.class)) {
DriverData driverData = new DefaultDriverData(deviceDriver, device.deviceId());
DeviceAlarmConfig alarmTranslator = deviceDriver.createBehaviour(driverData, DeviceAlarmConfig.class);
alarmTranslator.setHandler(new DefaultDriverHandler(driverData));
return alarmTranslator;
} else {
log.warn("Device does not support alarm {}", device.deviceId());
}
return null;
}
use of org.onosproject.alarm.DeviceAlarmConfig in project onos by opennetworkinglab.
the class SnmpAlarmProvider method requestTraps.
private boolean requestTraps(DeviceId deviceId) {
SnmpDevice device = controller.getDevice(deviceId);
DeviceAlarmConfig alarmTranslator = getAlarmTranslator(device);
if (alarmTranslator != null) {
return alarmTranslator.configureDevice(localIp, device.getNotificationPort(), device.getNotificationProtocol());
} else {
log.warn("Device {} does not support alarms.", deviceId);
return false;
}
}
Aggregations