use of org.opennms.netmgt.enlinkd.snmp.IsisCircTableTracker 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 [{}]. Agent error while scanning the isisSysObjectCollection table", getNodeId(), e);
return;
} catch (final InterruptedException e) {
LOG.info("run: node [{}]. Is-Is Linkd node collection interrupted, exiting", getNodeId(), e);
return;
}
if (isisSysObject.getIsisSysId() == null) {
LOG.info("run: node [{}], address {}. Is-Is mib not supported ", getNodeId(), getPrimaryIpAddressString());
return;
}
m_linkd.getQueryManager().store(getNodeId(), isisSysObject.getIsisElement());
final List<IsIsLink> links = new ArrayList<IsIsLink>();
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.error("run: node [{}]. Is-Is collection execution failed, exiting", getNodeId(), e);
return;
} catch (final InterruptedException e) {
LOG.error("run: node [{}]. Is-Is collection interrupted, exiting", getNodeId(), e);
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.error("run: node [{}]. Is-Is collection execution failed, exiting", getNodeId(), e);
return;
} catch (final InterruptedException e) {
LOG.error("run: node [{}]. Is-Is collection interrupted, exiting", getNodeId(), e);
return;
}
for (IsIsLink link : links) m_linkd.getQueryManager().store(getNodeId(), link);
m_linkd.getQueryManager().reconcileIsis(getNodeId(), now);
}
use of org.opennms.netmgt.enlinkd.snmp.IsisCircTableTracker in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testIsisCircTableWalk.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsisCircTableWalk() throws Exception {
final List<IsIsLink> links = new ArrayList<IsIsLink>();
String trackerName = "isisCircTable";
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SIEGFRIE_IP));
IsisCircTableTracker tracker = new IsisCircTableTracker() {
public void processIsisCircRow(final IsIsCircRow row) {
assertEquals(2, 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(12, links.size());
for (final IsIsLink link : links) {
if (link.getIsisCircIndex().intValue() == 533) {
assertEquals(533, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 552) {
assertEquals(552, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 13) {
assertEquals(13, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.off, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 16) {
assertEquals(16, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 504) {
assertEquals(504, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 507) {
assertEquals(507, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 508) {
assertEquals(508, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 512) {
assertEquals(512, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 514) {
assertEquals(514, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 531) {
assertEquals(531, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 572) {
assertEquals(572, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else if (link.getIsisCircIndex().intValue() == 573) {
assertEquals(573, link.getIsisCircIfIndex().intValue());
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
} else {
assertEquals(true, false);
}
}
}
Aggregations