use of org.opennms.netmgt.enlinkd.snmp.IsisISAdjTableTracker 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);
}
use of org.opennms.netmgt.enlinkd.snmp.IsisISAdjTableTracker in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testIsisISAdjTableWalk.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsisISAdjTableWalk() throws Exception {
final List<IsIsLink> links = new ArrayList<>();
String trackerName = "isisISAdjTable";
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SIEGFRIE_IP));
IsisISAdjTableTracker tracker = new IsisISAdjTableTracker() {
public void processIsisAdjRow(final IsIsAdjRow row) {
assertEquals(5, row.getColumnCount());
links.add(row.getIsisLink());
}
};
try {
m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
LOG.error("run: collection interrupted, exiting", e);
return;
}
assertEquals(2, links.size());
for (final IsIsLink link : links) {
assertEquals(1, link.getIsisISAdjIndex().intValue());
assertEquals(IsisISAdjState.up, link.getIsisISAdjState());
assertEquals(IsisISAdjNeighSysType.l1_IntermediateSystem, link.getIsisISAdjNeighSysType());
assertEquals(0, link.getIsisISAdjNbrExtendedCircID().intValue());
if (link.getIsisCircIndex().intValue() == 533) {
assertEquals("001f12accbf0", link.getIsisISAdjNeighSNPAAddress());
assertEquals("000110255062", link.getIsisISAdjNeighSysID());
} else if (link.getIsisCircIndex().intValue() == 552) {
assertEquals("0021590e47c2", link.getIsisISAdjNeighSNPAAddress());
assertEquals("000110088500", link.getIsisISAdjNeighSysID());
} else {
assertEquals(true, false);
}
}
}
Aggregations