use of org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testIsisSysObjectWalk.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsisSysObjectWalk() throws Exception {
String trackerName = "isisSysObject";
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SIEGFRIE_IP));
IsisSysObjectGroupTracker tracker = new IsisSysObjectGroupTracker();
try {
m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
LOG.error("run: collection interrupted, exiting", e);
return;
}
IsIsElement eiA = tracker.getIsisElement();
System.err.println("Is-Is Sys Id: " + eiA.getIsisSysID());
System.err.println("Is-Is Sys Admin State: " + IsisAdminState.getTypeString(eiA.getIsisSysAdminState().getValue()));
assertEquals(SIEGFRIE_ISIS_SYS_ID, eiA.getIsisSysID());
assertEquals(IsisAdminState.on, eiA.getIsisSysAdminState());
}
use of org.opennms.netmgt.enlinkd.snmp.IsisSysObjectGroupTracker in project opennms by OpenNMS.
the class NodeDiscoveryIsis method runCollection.
protected void runCollection() {
final Date now = new Date();
final IsisSysObjectGroupTracker isisSysObject = new IsisSysObjectGroupTracker();
SnmpAgentConfig peer = m_linkd.getSnmpAgentConfig(getPrimaryIpAddress(), getLocation());
try {
m_linkd.getLocationAwareSnmpClient().walk(peer, isisSysObject).withDescription("isisSysObjectCollection").withLocation(getLocation()).execute().get();
} catch (ExecutionException e) {
LOG.info("run: node [{}]: ExecutionException: isisSysObjectCollection: {}", getNodeId(), e.getMessage());
return;
} catch (final InterruptedException e) {
LOG.info("run: node [{}]: InterruptedException: isisSysObjectCollection: {}", getNodeId(), e.getMessage());
return;
}
if (isisSysObject.getIsisSysId() == null) {
LOG.info("run: node [{}]: Is-Is mib not supported ", getNodeId());
return;
}
m_linkd.getQueryManager().store(getNodeId(), isisSysObject.getIsisElement());
final List<IsIsLink> links = new ArrayList<>();
final IsisISAdjTableTracker isisISAdjTableTracker = new IsisISAdjTableTracker() {
@Override
public void processIsisAdjRow(IsIsAdjRow row) {
links.add(row.getIsisLink());
}
};
try {
m_linkd.getLocationAwareSnmpClient().walk(peer, isisISAdjTableTracker).withDescription("isisISAdjTable").withLocation(getLocation()).execute().get();
} catch (ExecutionException e) {
LOG.info("run: node [{}]: ExecutionException: isisISAdjTable: {}", getNodeId(), e.getMessage());
return;
} catch (final InterruptedException e) {
LOG.info("run: node [{}]: InterruptedException: isisISAdjTable: {}", getNodeId(), e.getMessage());
return;
}
final IsisCircTableTracker isisCircTableTracker = new IsisCircTableTracker() {
@Override
public void processIsisCircRow(IsIsCircRow row) {
IsIsLink link = row.getIsisLink();
for (IsIsLink adjlink : links) {
if (link.getIsisCircIndex().intValue() == adjlink.getIsisCircIndex().intValue()) {
adjlink.setIsisCircIfIndex(link.getIsisCircIfIndex());
adjlink.setIsisCircAdminState(link.getIsisCircAdminState());
}
}
}
};
try {
m_linkd.getLocationAwareSnmpClient().walk(peer, isisCircTableTracker).withDescription("isisCircTable").withLocation(getLocation()).execute().get();
} catch (ExecutionException e) {
LOG.info("run: node [{}]: ExecutionException: isisCircTable: {}", getNodeId(), e.getMessage());
return;
} catch (final InterruptedException e) {
LOG.info("run: node [{}]: InterruptedException: isisCircTable: {}", getNodeId(), e.getMessage());
return;
}
for (IsIsLink link : links) m_linkd.getQueryManager().store(getNodeId(), link);
m_linkd.getQueryManager().reconcileIsis(getNodeId(), now);
}
Aggregations