本文整理汇总了Java中com.btisystems.pronx.ems.core.snmp.ISnmpSession.walkDevice方法的典型用法代码示例。如果您正苦于以下问题:Java ISnmpSession.walkDevice方法的具体用法?Java ISnmpSession.walkDevice怎么用?Java ISnmpSession.walkDevice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.btisystems.pronx.ems.core.snmp.ISnmpSession
的用法示例。
在下文中一共展示了ISnmpSession.walkDevice方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateDescription
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
private DeviceDescription populateDescription(ISnmpSession session, Device device) {
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress().getHostAddress());
try {
session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
System.class)));
com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System systemTree =
(com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System)
networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System.class));
if (systemTree != null) {
// TODO SNMP sys-contacts may be verbose; ONOS-GUI doesn't abbreviate fields neatly;
// so cut it here until supported in prop displayer
String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20);
return new DefaultDeviceDescription(device.id().uri(), device.type(),
manufacturer, UNKNOWN, UNKNOWN, UNKNOWN,
device.chassisId(), (SparseAnnotations) device.annotations());
}
} catch (IOException ex) {
throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
}
return null;
}
示例2: populateDescription
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
private DeviceDescription populateDescription(ISnmpSession session, Device device) {
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress().getHostAddress());
try {
session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
System.class)));
com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System systemTree =
(com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System)
networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System.class));
if (systemTree != null) {
String[] systemComponents = systemTree.getSysDescr().split(";");
return new DefaultDeviceDescription(device.id().uri(), device.type(),
systemComponents[0], systemComponents[2],
systemComponents[3], UNKNOWN, device.chassisId(),
(SparseAnnotations) device.annotations());
}
} catch (IOException ex) {
throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
}
return null;
}
示例3: consumeAlarms
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
@Override
public List<Alarm> consumeAlarms() {
SnmpController controller = checkNotNull(handler().get(SnmpController.class));
ISnmpSession session;
List<Alarm> alarms = new ArrayList<>();
DeviceId deviceId = handler().data().deviceId();
try {
session = controller.getSession(deviceId);
log.debug("Getting alarms for BTI 7000 device at {}", deviceId);
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress().getHostAddress());
session.walkDevice(networkDevice, Collections.singletonList(
CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class)));
IActAlarmTable deviceAlarms = (IActAlarmTable) networkDevice.getRootObject()
.getEntity(CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class));
if ((deviceAlarms != null) && (deviceAlarms.getActAlarmEntry() != null)
&& (!deviceAlarms.getActAlarmEntry().isEmpty())) {
deviceAlarms.getActAlarmEntry().values().stream().forEach((alarm) -> {
DefaultAlarm.Builder alarmBuilder = new DefaultAlarm.Builder(
deviceId, alarm.getActAlarmDescription(),
mapAlarmSeverity(alarm.getActAlarmSeverity()),
getLocalDateAndTime(alarm.getActAlarmDateAndTime(), null, null).getTime())
.forSource(AlarmEntityId.alarmEntityId("other:" + alarm.getActAlarmInstanceIdx()));
alarms.add(alarmBuilder.build());
});
}
log.debug("Conditions retrieved: {}", deviceAlarms);
} catch (IOException ex) {
log.error("Error reading alarms for device {}.", deviceId, ex);
alarms.add(controller.buildWalkFailedAlarm(deviceId));
}
return ImmutableList.copyOf(alarms);
}
示例4: consumeAlarms
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
@Override
public List<Alarm> consumeAlarms() {
SnmpController controller = checkNotNull(handler().get(SnmpController.class));
List<Alarm> alarms = new ArrayList<>();
ISnmpSession session;
DeviceId deviceId = handler().data().deviceId();
try {
session = controller.getSession(deviceId);
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress()
.getHostAddress());
session.walkDevice(networkDevice, Collections.singletonList(
CLASS_REGISTRY.getClassToOidMap().get(IfTable.class)));
IfTable interfaceTable = (IfTable) networkDevice.getRootObject()
.getEntity(CLASS_REGISTRY.getClassToOidMap().get(IfTable.class));
if (interfaceTable != null) {
interfaceTable.getEntries().values().stream().forEach((ifEntry) -> {
if (ifEntry.getIfAdminStatus() == 1 && ifEntry.getIfOperStatus() == 2) {
alarms.add(new DefaultAlarm.Builder(deviceId, "Link Down.",
Alarm.SeverityLevel.CRITICAL,
System.currentTimeMillis())
.forSource(AlarmEntityId
.alarmEntityId("port:" + ifEntry.
getIfDescr())).build());
}
log.debug("Interface: " + ifEntry);
});
}
} catch (IOException ex) {
log.error("Error reading alarms for device {}.", deviceId, ex);
alarms.add(controller.buildWalkFailedAlarm(deviceId));
}
return ImmutableList.copyOf(alarms);
}
示例5: consumeAlarms
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
@Override
public List<Alarm> consumeAlarms() {
SnmpController controller = checkNotNull(handler().get(SnmpController.class));
ISnmpSession session;
List<Alarm> alarms = new ArrayList<>();
DeviceId deviceId = handler().data().deviceId();
try {
session = controller.getSession(deviceId);
log.debug("Getting alarms for BTI 7000 device at {}", deviceId);
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress().getHostAddress());
session.walkDevice(networkDevice, Collections.singletonList(
CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class)));
IActAlarmTable deviceAlarms = (IActAlarmTable) networkDevice.getRootObject()
.getEntity(CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class));
if ((deviceAlarms != null) && (deviceAlarms.getActAlarmEntry() != null)
&& (!deviceAlarms.getActAlarmEntry().isEmpty())) {
deviceAlarms.getActAlarmEntry().values().forEach((alarm) -> {
DefaultAlarm.Builder alarmBuilder = new DefaultAlarm.Builder(
deviceId, alarm.getActAlarmDescription(),
mapAlarmSeverity(alarm.getActAlarmSeverity()),
getLocalDateAndTime(alarm.getActAlarmDateAndTime(), null, null).getTime())
.forSource(AlarmEntityId.alarmEntityId("other:" + alarm.getActAlarmInstanceIdx()));
alarms.add(alarmBuilder.build());
});
}
log.debug("Conditions retrieved: {}", deviceAlarms);
} catch (IOException ex) {
log.error("Error reading alarms for device {}.", deviceId, ex);
alarms.add(controller.buildWalkFailedAlarm(deviceId));
}
return ImmutableList.copyOf(alarms);
}
示例6: consumeAlarms
import com.btisystems.pronx.ems.core.snmp.ISnmpSession; //导入方法依赖的package包/类
@Override
public List<Alarm> consumeAlarms() {
SnmpController controller = checkNotNull(handler().get(SnmpController.class));
List<Alarm> alarms = new ArrayList<>();
ISnmpSession session;
DeviceId deviceId = handler().data().deviceId();
try {
session = controller.getSession(deviceId);
NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
session.getAddress()
.getHostAddress());
session.walkDevice(networkDevice, Collections.singletonList(
CLASS_REGISTRY.getClassToOidMap().get(IfTable.class)));
IfTable interfaceTable = (IfTable) networkDevice.getRootObject()
.getEntity(CLASS_REGISTRY.getClassToOidMap().get(IfTable.class));
if (interfaceTable != null) {
interfaceTable.getEntries().values().forEach((ifEntry) -> {
if (ifEntry.getIfAdminStatus() == 1 && ifEntry.getIfOperStatus() == 2) {
alarms.add(new DefaultAlarm.Builder(deviceId, "Link Down.",
Alarm.SeverityLevel.CRITICAL,
System.currentTimeMillis())
.forSource(AlarmEntityId
.alarmEntityId("port:" + ifEntry.
getIfDescr())).build());
}
log.debug("Interface: " + ifEntry);
});
}
} catch (IOException ex) {
log.error("Error reading alarms for device {}.", deviceId, ex);
alarms.add(controller.buildWalkFailedAlarm(deviceId));
}
return ImmutableList.copyOf(alarms);
}