use of org.opennms.netmgt.model.IsIsLink 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<>();
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);
}
}
}
use of org.opennms.netmgt.model.IsIsLink in project opennms by OpenNMS.
the class Nms0001EnIT method testIsIsLinks.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = FROH_IP, port = 161, resource = FROH_SNMP_RESOURCE), @JUnitSnmpAgent(host = OEDIPUS_IP, port = 161, resource = OEDIPUS_SNMP_RESOURCE), @JUnitSnmpAgent(host = SIEGFRIE_IP, port = 161, resource = SIEGFRIE_SNMP_RESOURCE) })
public void testIsIsLinks() throws Exception {
m_nodeDao.save(builder.getFroh());
m_nodeDao.save(builder.getOedipus());
m_nodeDao.save(builder.getSiegFrie());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
assertTrue(m_linkdConfig.useIsisDiscovery());
assertTrue(!m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
final OnmsNode froh = m_nodeDao.findByForeignId("linkd", FROH_NAME);
final OnmsNode oedipus = m_nodeDao.findByForeignId("linkd", OEDIPUS_NAME);
final OnmsNode siegfrie = m_nodeDao.findByForeignId("linkd", SIEGFRIE_NAME);
assertTrue(m_linkd.scheduleNodeCollection(froh.getId()));
assertTrue(m_linkd.scheduleNodeCollection(oedipus.getId()));
assertTrue(m_linkd.scheduleNodeCollection(siegfrie.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(froh.getId()));
assertEquals(2, m_isisLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(oedipus.getId()));
assertEquals(4, m_isisLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(siegfrie.getId()));
assertEquals(6, m_isisLinkDao.countAll());
List<IsisTopologyLink> links = m_isisLinkDao.getLinksForTopology();
assertEquals(3, links.size());
for (OnmsNode node : m_nodeDao.findAll()) {
assertNotNull(node.getIsisElement());
System.err.println(node.getIsisElement());
}
for (IsIsLink link : m_isisLinkDao.findAll()) System.err.println(link);
/*
*
* These are the links among the following nodes discovered using
* only the isis protocol
* froh:ae1.0(599):10.1.3.6/30
* froh:ae2.0(600):10.1.3.2/30
* oedipus:ae0.0(575):10.1.0.10/30
* oedipus:ae1.0(578):10.1.3.5/30
* siegfrie:ae2.0(552):10.1.3.1/30
* siegfrie:ae0.0(533):10.1.0.9/30
*
* siegfrie:0001 10.25.50.54:533 ----> 0001 10.25.50.62:00 1F 12 AC CB F0:0
* siegfrie:0001 10.25.50.54:552 ----> 0001 10.08.85.00:00 21 59 0E 47 C2:0
*
* froh:0001 10.08.85.00:599 ----> 0001 10.25.50.62:00 1F 12 AC CB F1:0
* froh:0001 10.08.85.00:600 ----> 0001 10.25.50.54:00 1F 12 AC C3 F2:0
*
* oedipus:0001 10.25.50.62:575 ----> 0001 10.25.50.54:00 1F 12 AC C3 F0:0
* oedipus:0001 10.25.50.62:578 ----> 0001 10.08.85.00:00 21 59 0E 47 C1:0
*
* The problem is that the association with Address is into another mib
*
* froh-192.168.239.51-walk.txt:.1.3.6.1.2.1.138.1.6.1.1.4."599".1 = Hex-STRING: 00 1F 12 AC CB F1
*
* routing table for ip address "ip route" "mask" "level" "next hop Snpa"
* froh-192.168.239.51-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13."1.1.4"."10.1.0.4" ."30" .1 = Hex-STRING: 00 1F 12 AC CB F1
* froh-192.168.239.51-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13."1.1.4"."10.1.0.8" ."30" .1 = Hex-STRING: 00 1F 12 AC CB F1
* froh-192.168.239.51-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13."1.1.4"."10.255.0.62"."32 .1 = Hex-STRING: 00 1F 12 AC CB F1
*
*
* oedipus-192.168.239.62-walk.txt:.1.2.840.10006.300.43.1.1.1.1.2.576 = Hex-STRING: 00 1F 12 AC CB F1
* oedipus-192.168.239.62-walk.txt:.1.2.840.10006.300.43.1.1.1.1.2.578 = Hex-STRING: 00 1F 12 AC CB F1
*
*
* oedipus-192.168.239.62-walk.txt:.1.3.6.1.2.1.138.1.6.1.1.4."575".1 = Hex-STRING: 00 1F 12 AC C3 F0
*
* oedipus-192.168.239.62-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13.1.1.4.10.1.0.0.30.1 = Hex-STRING: 00 1F 12 AC C3 F0
* oedipus-192.168.239.62-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13.1.1.4.10.1.3.0.30.1 = Hex-STRING: 00 1F 12 AC C3 F0
* oedipus-192.168.239.62-walk.txt:.1.3.6.1.2.1.138.1.8.1.1.13.1.1.4.10.255.0.54.32.1 = Hex-STRING: 00 1F 12 AC C3 F0
*
* siegfrie-192.168.239.54-walk.txt:.1.2.840.10006.300.43.1.1.1.1.2.532 = Hex-STRING: 00 1F 12 AC C3 F0
* siegfrie-192.168.239.54-walk.txt:.1.2.840.10006.300.43.1.1.1.1.2.533 = Hex-STRING: 00 1F 12 AC C3 F0
*/
}
use of org.opennms.netmgt.model.IsIsLink in project opennms by OpenNMS.
the class Nms6801EnIT method testIsIsLinks.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = CISCOISIS_IP, port = 161, resource = CISCOISIS_SNMP_RESOURCE) })
public void testIsIsLinks() throws Exception {
m_nodeDao.save(builder.getCiscoIosXrRouter());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
assertTrue(m_linkdConfig.useIsisDiscovery());
assertTrue(!m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
final OnmsNode ciscoiosxr = m_nodeDao.findByForeignId("linkd", CISCOISIS_NAME);
assertTrue(m_linkd.scheduleNodeCollection(ciscoiosxr.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(ciscoiosxr.getId()));
assertEquals(4, m_isisLinkDao.countAll());
assertEquals(0, m_isisLinkDao.getLinksForTopology().size());
for (OnmsNode node : m_nodeDao.findAll()) {
assertNotNull(node.getIsisElement());
System.err.println(node.getIsisElement());
assertEquals(CISCOISIS_ISIS_SYS_ID, node.getIsisElement().getIsisSysID());
assertEquals(IsisAdminState.on, node.getIsisElement().getIsisSysAdminState());
}
for (IsIsLink link : m_isisLinkDao.findAll()) {
System.err.println(link);
assertEquals(IsisAdminState.on, link.getIsisCircAdminState());
assertEquals(IsisISAdjState.up, link.getIsisISAdjState());
assertEquals("000000000000", link.getIsisISAdjNeighSNPAAddress());
assertEquals(IsisISAdjNeighSysType.l2IntermediateSystem, link.getIsisISAdjNeighSysType());
switch(link.getIsisCircIndex()) {
case 19:
assertEquals(5, link.getIsisISAdjIndex().intValue());
assertEquals(19, link.getIsisCircIfIndex().intValue());
assertEquals("093176092059", link.getIsisISAdjNeighSysID());
assertEquals(234881856, link.getIsisISAdjNbrExtendedCircID().intValue());
break;
case 20:
assertEquals(5, link.getIsisISAdjIndex().intValue());
assertEquals(20, link.getIsisCircIfIndex().intValue());
assertEquals("093176092059", link.getIsisISAdjNeighSysID());
assertEquals(234881920, link.getIsisISAdjNbrExtendedCircID().intValue());
break;
case 27:
assertEquals(3, link.getIsisISAdjIndex().intValue());
assertEquals(27, link.getIsisCircIfIndex().intValue());
assertEquals("093176090003", link.getIsisISAdjNeighSysID());
assertEquals(33554880, link.getIsisISAdjNbrExtendedCircID().intValue());
break;
case 28:
assertEquals(3, link.getIsisISAdjIndex().intValue());
assertEquals(28, link.getIsisCircIfIndex().intValue());
assertEquals("093176090003", link.getIsisISAdjNeighSysID());
assertEquals(33554944, link.getIsisISAdjNbrExtendedCircID().intValue());
break;
default:
assertTrue(false);
break;
}
}
}
use of org.opennms.netmgt.model.IsIsLink in project opennms by OpenNMS.
the class EnLinkdElementFactory method getIsisLinks.
@Override
public List<IsisLinkNode> getIsisLinks(int nodeId) {
List<IsisLinkNode> nodelinks = new ArrayList<IsisLinkNode>();
for (IsIsLink link : m_isisLinkDao.findByNodeId(Integer.valueOf(nodeId))) {
nodelinks.add(convertFromModel(nodeId, link));
}
Collections.sort(nodelinks);
return nodelinks;
}
Aggregations