Fix the snmp alarms on device configuration
Change-Id: Ia15df8cf2c112e00f7d6930272a97cb447e98fe8
diff --git a/protocols/snmp/api/src/main/java/org/onosproject/snmp/SnmpDeviceConfig.java b/protocols/snmp/api/src/main/java/org/onosproject/snmp/SnmpDeviceConfig.java
index b39180a..47446ea 100644
--- a/protocols/snmp/api/src/main/java/org/onosproject/snmp/SnmpDeviceConfig.java
+++ b/protocols/snmp/api/src/main/java/org/onosproject/snmp/SnmpDeviceConfig.java
@@ -39,7 +39,8 @@
@Override
public boolean isValid() {
- return hasOnlyFields(IP, PORT, USERNAME, PASSWORD) &&
+ return hasOnlyFields(PROTOCOL, NOTIFICATION_PROTOCOL, IP, PORT,
+ NOTIFICATION_PORT, USERNAME, PASSWORD) &&
ip() != null;
}
diff --git a/providers/snmp/alarm/src/main/java/org/onosproject/provider/snmp/alarm/impl/SnmpAlarmProvider.java b/providers/snmp/alarm/src/main/java/org/onosproject/provider/snmp/alarm/impl/SnmpAlarmProvider.java
index 95db153..49874dd 100644
--- a/providers/snmp/alarm/src/main/java/org/onosproject/provider/snmp/alarm/impl/SnmpAlarmProvider.java
+++ b/providers/snmp/alarm/src/main/java/org/onosproject/provider/snmp/alarm/impl/SnmpAlarmProvider.java
@@ -137,7 +137,6 @@
mastershipService.addListener(mastershipListener);
controller.getDevices().stream().forEach(d -> {
triggerProbe(d.deviceId());
- configureListeningConnection(d);
});
localIp = clusterService.getLocalNode().ip();
log.info("Started");
@@ -168,6 +167,7 @@
@Override
public void triggerProbe(DeviceId deviceId) {
requestTraps(deviceId);
+ configureListeningConnection(controller.getDevice(deviceId));
}
private void configureListeningConnection(SnmpDevice device) {