use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents 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.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms0002EnIT method testNetworkLinksCiscoJuniperLldp.
/*
*
* nodelabel | snmpifname | ifindex | parent | parentif | parentifindex
* --------------------+--------------+---------+--------------------+------------+---------------
* r-de-pots-amka-001 | Fa6/0/0 | 164 | r-de-juet-luck-001 | ge-0/0/0.0 | 510
* r-de-juet-luck-001 | ge-0/0/2.100 | 549 | s-de-juet-luck-001 | Fa0/1 | 10001
* r-de-juet-luck-001 | ge-0/0/2.950 | 550 | s-de-juet-luck-001 | Fa0/1 | 10001 *
*
* The links are mostly from the bridge forwarding table protocol in fact the
* ge-0/0/2.100 and ge-0/0/2.950 are logical interface for vlan 100 and
* vlan 950 on juniper router. with the same mac address 54e032ef3102
* So both vlan 100 and vlan 950 will address the same link
* No way to get layer 2 link because no STP is enabled on Juniper device
*
*/
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = Rluck001_IP, port = 161, resource = Rluck001_SNMP_RESOURCE), @JUnitSnmpAgent(host = Sluck001_IP, port = 161, resource = Sluck001_SNMP_RESOURCE) })
public void testNetworkLinksCiscoJuniperLldp() throws Exception {
m_nodeDao.save(builder.getRluck001());
m_nodeDao.save(builder.getSluck001());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(true);
m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
assertTrue(m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(!m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useIsisDiscovery());
final OnmsNode routerJuniper = m_nodeDao.findByForeignId("linkd", Rluck001_NAME);
final OnmsNode switchCisco = m_nodeDao.findByForeignId("linkd", Sluck001_NAME);
assertTrue(m_linkd.scheduleNodeCollection(routerJuniper.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switchCisco.getId()));
assertEquals(0, m_lldpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(routerJuniper.getId()));
final List<LldpLink> topologyA = m_lldpLinkDao.findAll();
printLldpTopology(topologyA);
assertEquals(1, m_lldpLinkDao.countAll());
for (final OnmsNode node : m_nodeDao.findAll()) {
if (node.getLldpElement() != null)
printLldpElement(node.getLldpElement());
}
assertTrue(m_linkd.runSingleSnmpCollection(switchCisco.getId()));
Thread.sleep(1000);
assertTrue(m_linkd.runSingleSnmpCollection(switchCisco.getId()));
final List<LldpLink> topologyB = m_lldpLinkDao.findAll();
printLldpTopology(topologyB);
assertEquals(2, topologyB.size());
for (final OnmsNode node : m_nodeDao.findAll()) {
if (node.getLldpElement() != null)
printLldpElement(node.getLldpElement());
}
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms4930EnIT method testNms4930Bft.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DLINK1_IP, port = 161, resource = DLINK1_SNMP_RESOURCE) })
public void testNms4930Bft() throws Exception {
final OnmsNode dlink1 = m_nodeDao.findByForeignId("linkd", DLINK1_NAME);
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(true);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useIsisDiscovery());
assertTrue(m_linkd.scheduleNodeCollection(dlink1.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(dlink1.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
List<BridgeMacLink> links = m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(dlink1.getId());
assertEquals(59, links.size());
for (BridgeMacLink link : links) {
System.err.println(link.printTopology());
if (BridgeDot1qTpFdbStatus.DOT1D_TP_FDB_STATUS_SELF == link.getBridgeDot1qTpFdbStatus())
continue;
assertEquals(BridgeDot1qTpFdbStatus.DOT1D_TP_FDB_STATUS_LEARNED, link.getBridgeDot1qTpFdbStatus());
link.setBridgeMacLinkLastPollTime(link.getBridgeMacLinkCreateTime());
m_bridgeMacLinkDao.save(link);
}
assertEquals(58, m_bridgeMacLinkDao.countAll());
for (BridgeMacLink maclink : m_bridgeMacLinkDao.findAll()) {
assertEquals(null, maclink.getBridgeDot1qTpFdbStatus());
assertNotNull(maclink.getBridgePortIfIndex());
assertNotNull(maclink.getBridgePort());
assertNotNull(maclink.getNode());
assertNotNull(maclink.getMacAddress());
System.err.println(maclink.printTopology());
}
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms4930EnIT method testNms4930NetworkReverse.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DLINK1_IP, port = 161, resource = DLINK1_SNMP_RESOURCE), @JUnitSnmpAgent(host = DLINK2_IP, port = 161, resource = DLINK2_SNMP_RESOURCE) })
public void testNms4930NetworkReverse() throws Exception {
final OnmsNode dlink1 = m_nodeDao.findByForeignId("linkd", DLINK1_NAME);
final OnmsNode dlink2 = m_nodeDao.findByForeignId("linkd", DLINK2_NAME);
final OnmsNode nodebetweendlink1dlink2 = m_nodeDao.findByForeignId("linkd", "10.100.1.7");
final OnmsNode nodeonlink1dport6 = m_nodeDao.findByForeignId("linkd", "10.100.2.6");
assertNotNull(nodebetweendlink1dlink2);
assertNotNull(nodeonlink1dport6);
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(true);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useIsisDiscovery());
assertTrue(m_linkd.scheduleNodeCollection(dlink2.getId()));
assertTrue(m_linkd.scheduleNodeCollection(dlink1.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(dlink2.getId()));
assertTrue(m_linkd.runTopologyDiscovery(dlink2.getId()));
checkTopologyDlink2(dlink2);
assertTrue(m_linkd.runSingleSnmpCollection(dlink1.getId()));
assertTrue(m_linkd.runTopologyDiscovery(dlink1.getId()));
checkTopology(dlink1, dlink2, nodeonlink1dport6, nodebetweendlink1dlink2);
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents 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;
}
}
}
Aggregations