Search in sources :

Example 61 with OnmsNode

use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.

the class Nms0002EnIT method testCiscoAlcatelEssnBrueLldp.

/*      Alcatel Lucent due
     *           nodelabel      | snmpifname | ifindex  |       parent       | parentif | parentifindex 
     *      --------------------+------------+----------+--------------------+----------+---------------
     *       s-de-essn-brue-121 | management | 13600001 | r-de-essn-brue-001 | Po121    |           364
     *       r-de-essn-brue-001 | Te2/4/4    |      301 | r-de-essn-glad-004 | Te1/4    |             4
     *       r-de-essn-brue-001 | Tu8        |      313 | r-de-hann-tre5-021 | Tu8      |            12
     *       r-de-essn-brue-001 | Te1/4/4    |      148 | r-de-essn-ruhr-004 | Te1/4    |             4
     *       r-de-essn-brue-001 | Tu9        |      315 | r-de-hann-tre7-020 | Tu9      |            18
     *       s-de-essn-brue-121 | management | 13600001 | r-de-essn-brue-001 | Po121A   |           525
     *       s-de-essn-brue-147 | management | 13600001 | r-de-essn-brue-001 | Po147    |           376
     *       
     *       
     *       Those are the detected links....the local link are with s-121 and s-147
     *       we have a walk from s-165
     *       On the other side there are a lot of cdp connection on the cisco.
     *       
     *       The actual walks are inconsistent....the alcatel has a link to router using lldp but the cisco does not!
     *       LLDP
     *       link from r-de-essn-brue-01:GigabitEthernet1/3/11:(ifindex 107) to s-de-essn-brue-165::(ifindex 1025)
     *       link from r-de-essn-brue-01:GigabitEthernet2/3/11:(ifindex 260) to s-de-essn-brue-165:Alcatel-Lucent 2/25 (ifindex 2025)
     *
     *       STP
     *       link from r-de-essn-brue-01:Port-channel165:(ifindex 381) to s-de-essn-brue-165:Dynamic Aggregate Number 10 ref 40000010 size 2:(ifindex 40000010)
     *
     *       ifindex 381 correspond to bridgeport: 5826 ---96c2
     *       
     *                  96c2 ----> 1730 but 16c2---> 5826
     *       I found from Qbridge that an interface 40000010 is used...this is not the bridge id....it is the
     *       ifindex...Dynamic Aggregate Number 10 ref 40000010 size 2  ----mac 0:e0:b1:bf:58:4c
     *       
     *       stp info...the stp root port is 40000010
     *
     *       Alcatel 165
     *       the interface number is 171 port. 6x(26+2 module port) + management+ loopback+ aggregate
     *       the bridge port number is 156 each module ethernet interface have 26 associated bridge port
     *       the stpport has 155 entries ....no way of linking the stpport to the bridgeport
     *       with criteria....
     *       
     *       bridge port to ifindex ---- M is the module id
     *       index 01-26
     *       bridge port {M}{(M-1)*index+3+index} ---> {M}0{index} 
     *       Modulo 1       1-1001        26--1026
     *       Modulo 2       129-2001     154--2026
     *       Modulo 3       257-3001     282--3026
     *       Modulo 4       385-4001     410--4026
     *       Modulo 5       513-5001     538--5026
     *       Modulo 6       641-6001     666--3026
     *       
     *       stp  155 port
     *       Modulo 1      1-1           26-26 ---manca 25 --25 ---the interface used in port channel
     *       Modulo 2      33-129        58-154---manca 57 --25 ---the interface used in port channel
     *       Modulo 3      65-257        90-282            --26          
     *       Modulo 4      97-385        122-410           --26
     *       Modulo 5      129-513       154-538           --26
     *       Modulo 6      161-641       186-666           --26
     *       aggregated    1034                            -- 1
     *       
     *       designated port = 1->7400->1024
     *       N=26
     *       formula....ifindex = M*1000+port
     *                  bridgeport = (M-1)*(100+N+2) + port
     *                  stpport = (M-1)*(N+6)+port
     *                  
     *       formula....ifindex = M*1000+port
     *                  bridgeport = (M-1)*(128) + port
     *                  stpport = (M-1)*(32)+port
     *                  (30+2)^2=900+120+4=1024
     *                  
     *                  ifindex=40000010=40000000+10=40*1000*1000+10
     *                  1034=(M-1)*32+port= 1024+10=32*32+10=
     *                  M=32---> stpport=31*128+10=3978
     *                  ifindex=31010
     *                  
     *                  
     *                  designate bridge 96c2---> bridgeport=1730---che non esiste su cisco
     *                  ancora mi trovo che la designated port e' una aggregata
     *                  ma sul router ho una chiara indicazione che la porta
     *                  
     */
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = RDeEssnBrue_IP, port = 161, resource = RDeEssnBrue_SNMP_RESOURCE), @JUnitSnmpAgent(host = SDeEssnBrue081_IP, port = 161, resource = SDeEssnBrue081_SNMP_RESOURCE), @JUnitSnmpAgent(host = SDeEssnBrue121_IP, port = 161, resource = SDeEssnBrue121_SNMP_RESOURCE), @JUnitSnmpAgent(host = SDeEssnBrue142_IP, port = 161, resource = SDeEssnBrue142_SNMP_RESOURCE), @JUnitSnmpAgent(host = SDeEssnBrue165_IP, port = 161, resource = SDeEssnBrue165_SNMP_RESOURCE) })
public void testCiscoAlcatelEssnBrueLldp() {
    m_nodeDao.save(builder.getRDeEssnBrue());
    m_nodeDao.save(builder.getSDeEssnBrue081());
    m_nodeDao.save(builder.getSDeEssnBrue121());
    m_nodeDao.save(builder.getSDeEssnBrue142());
    m_nodeDao.save(builder.getSDeEssnBrue165());
    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 routerCisco = m_nodeDao.findByForeignId("linkd", RDeEssnBrue_NAME);
    final OnmsNode swicthAlu081 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue081_NAME);
    final OnmsNode swicthAlu121 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue121_NAME);
    final OnmsNode swicthAlu142 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue142_NAME);
    final OnmsNode swicthAlu165 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue165_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(routerCisco.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu081.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu121.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu142.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu165.getId()));
    assertEquals(0, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(routerCisco.getId()));
    assertEquals(0, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu081.getId()));
    assertEquals(1, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu121.getId()));
    assertEquals(2, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu142.getId()));
    assertEquals(4, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu165.getId()));
    final List<LldpLink> topologyB = m_lldpLinkDao.findAll();
    printLldpTopology(topologyB);
    assertEquals(6, topologyB.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getLldpElement() != null)
            printLldpElement(node.getLldpElement());
    }
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) LldpLink(org.opennms.netmgt.model.LldpLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 62 with OnmsNode

use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.

the class Nms7467EnIT method testCisco01Links.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = CISCO_WS_C2948_IP, port = 161, resource = CISCO_WS_C2948_SNMP_RESOURCE) })
public void testCisco01Links() throws Exception {
    m_nodeDao.save(builder.getCiscoWsC2948());
    m_nodeDao.flush();
    m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
    m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
    m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
    m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
    assertTrue(!m_linkdConfig.useIsisDiscovery());
    assertTrue(!m_linkdConfig.useBridgeDiscovery());
    assertTrue(!m_linkdConfig.useOspfDiscovery());
    assertTrue(!m_linkdConfig.useLldpDiscovery());
    assertTrue(m_linkdConfig.useCdpDiscovery());
    final OnmsNode cisco01 = m_nodeDao.findByForeignId("linkd", CISCO_WS_C2948_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(cisco01.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(cisco01.getId()));
    for (final OnmsNode node : m_nodeDao.findAll()) {
        assertNotNull(node.getCdpElement());
        printCdpElement(node.getCdpElement());
        assertEquals(TruthValue.TRUE, node.getCdpElement().getCdpGlobalRun());
        assertEquals(CISCO_WS_C2948_GLOBAL_DEVICEID, node.getCdpElement().getCdpGlobalDeviceId());
        assertEquals(CdpGlobalDeviceIdFormat.other, node.getCdpElement().getCdpGlobalDeviceIdFormat());
    }
    assertEquals(5, m_cdpLinkDao.countAll());
    for (CdpLink link : m_cdpLinkDao.findAll()) {
        assertNotNull(link);
        printCdpLink(link);
    }
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) CdpLink(org.opennms.netmgt.model.CdpLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 63 with OnmsNode

use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.

the class Nms7563EnIT method testCisco01Links.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = CISCO01_IP, port = 161, resource = CISCO01_SNMP_RESOURCE) })
public void testCisco01Links() throws Exception {
    m_nodeDao.save(builder.getCisco01());
    m_nodeDao.flush();
    m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
    m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
    m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
    assertTrue(!m_linkdConfig.useIsisDiscovery());
    assertTrue(!m_linkdConfig.useBridgeDiscovery());
    assertTrue(!m_linkdConfig.useOspfDiscovery());
    assertTrue(m_linkdConfig.useLldpDiscovery());
    assertTrue(m_linkdConfig.useCdpDiscovery());
    final OnmsNode cisco01 = m_nodeDao.findByForeignId("linkd", CISCO01_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(cisco01.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(cisco01.getId()));
    for (final OnmsNode node : m_nodeDao.findAll()) {
        assertNotNull(node.getLldpElement());
        printLldpElement(node.getLldpElement());
        assertEquals(LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_MACADDRESS, node.getLldpElement().getLldpChassisIdSubType());
        assertEquals(CISCO01_LLDP_CHASSID_ID, node.getLldpElement().getLldpChassisId());
        assertEquals(CISCO01_LLDP_SYSNAME, node.getLldpElement().getLldpSysname());
        assertNotNull(node.getCdpElement());
        printCdpElement(node.getCdpElement());
        assertEquals(TruthValue.TRUE, node.getCdpElement().getCdpGlobalRun());
        assertEquals(CISCO01_CDP_GLOBAL_DEVICE_ID, node.getCdpElement().getCdpGlobalDeviceId());
    }
    assertEquals(1, m_lldpLinkDao.countAll());
    for (LldpLink link : m_lldpLinkDao.findAll()) {
        assertNotNull(link);
        printLldpLink(link);
        assertEquals(8, link.getLldpLocalPortNum().intValue());
        assertNull(link.getLldpPortIfindex());
        assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_INTERFACENAME, link.getLldpPortIdSubType());
        assertEquals("Fa0/8", link.getLldpPortId());
        assertEquals("FastEthernet0/8", link.getLldpPortDescr());
        assertEquals(LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_MACADDRESS, link.getLldpRemChassisIdSubType());
        assertEquals(SWITCH02_LLDP_CHASSID_ID, link.getLldpRemChassisId());
        assertEquals(SWITCH02_LLDP_SYSNAME, link.getLldpRemSysname());
        assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, link.getLldpRemPortIdSubType());
        assertEquals("24", link.getLldpRemPortId());
        assertEquals("24", link.getLldpRemPortDescr());
    }
    assertEquals(0, m_cdpLinkDao.countAll());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) LldpLink(org.opennms.netmgt.model.LldpLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 64 with OnmsNode

use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.

the class Nms7777DWEnIT method testLldpNoLinks.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DW_IP, port = 161, resource = DW_SNMP_RESOURCE) })
public void testLldpNoLinks() throws Exception {
    m_nodeDao.save(builder.getDragonWaveRouter());
    m_nodeDao.flush();
    m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
    m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
    m_linkdConfig.getConfiguration().setUseIsisDiscovery(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 dw = m_nodeDao.findByForeignId("linkd", DW_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(dw.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(dw.getId()));
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getLldpElement() != null)
            printLldpElement(node.getLldpElement());
    }
    assertEquals(0, m_lldpLinkDao.countAll());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 65 with OnmsNode

use of org.opennms.netmgt.model.OnmsNode in project opennms by OpenNMS.

the class Nms7918EnIT method testNms7918SAMASW01BftCollection.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SAMASW01_IP, port = 161, resource = SAMASW01_SNMP_RESOURCE) })
public void testNms7918SAMASW01BftCollection() throws Exception {
    final OnmsNode samasw01 = m_nodeDao.findByForeignId("linkd", SAMASW01_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(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
    List<BridgeMacLink> links = m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(samasw01.getId());
    assertEquals(31, links.size());
    for (BridgeMacLink link : links) {
        System.err.println(link.printTopology());
    }
    assertTrue(m_linkd.runTopologyDiscovery(samasw01.getId()));
    assertEquals(0, m_bridgeBridgeLinkDao.countAll());
    assertEquals(0, m_bridgeMacLinkDao.countAll());
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) BridgeMacLink(org.opennms.netmgt.model.BridgeMacLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Aggregations

OnmsNode (org.opennms.netmgt.model.OnmsNode)496 Test (org.junit.Test)209 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)116 Transactional (org.springframework.transaction.annotation.Transactional)84 ArrayList (java.util.ArrayList)52 Date (java.util.Date)49 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)38 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)38 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)38 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)37 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)36 InetAddress (java.net.InetAddress)35 Before (org.junit.Before)32 OnmsCategory (org.opennms.netmgt.model.OnmsCategory)31 OnmsResource (org.opennms.netmgt.model.OnmsResource)28 HashMap (java.util.HashMap)27 CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)26 File (java.io.File)25 List (java.util.List)25 Path (javax.ws.rs.Path)23