use of org.onosproject.snmp.SnmpDeviceConfig in project onos by opennetworkinglab.
the class SnmpDeviceProvider method connectDevices.
// Method to register devices provided via net-cfg under devices/ tree
private void connectDevices() {
Set<DeviceId> deviceSubjects = netCfgService.getSubjects(DeviceId.class, SnmpDeviceConfig.class);
deviceSubjects.forEach(deviceId -> {
SnmpDeviceConfig config = netCfgService.getConfig(deviceId, SnmpDeviceConfig.class);
if (config.version() == SnmpConstants.version2c) {
buildDevice(new DefaultSnmpDevice(config));
} else if (config.version() == SnmpConstants.version3) {
buildDevice(new DefaultSnmpv3Device(config));
} else {
throw new SnmpException(String.format("Invalid snmp version %d", config.version()));
}
});
}
Aggregations