Search in sources :

Example 1 with JUnitSnmpAgents

use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.

the class DragonWaveNodeSwitchingIT method testASetup.

@Test
@JUnitSnmpAgents({ @JUnitSnmpAgent(host = "192.168.255.22", resource = "classpath:/dw/walks/node3-walk.properties") })
public void testASetup() throws Exception {
    final int nextNodeId = m_nodeDao.getNextNodeId();
    final InetAddress iface = InetAddressUtils.addr("192.168.255.22");
    final EventAnticipator anticipator = m_eventSubscriber.getEventAnticipator();
    anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_ADDED_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).getEvent());
    anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(iface).getEvent());
    anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(iface).setService("SNMP").getEvent());
    anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(iface).setService("ICMP").getEvent());
    anticipator.anticipateEvent(new EventBuilder(EventConstants.REINITIALIZE_PRIMARY_SNMP_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(iface).getEvent());
    anticipator.anticipateEvent(new EventBuilder(EventConstants.PROVISION_SCAN_COMPLETE_UEI, "Provisiond").setNodeid(nextNodeId).getEvent());
    importResource("classpath:/dw/import/dw_test_import.xml");
    anticipator.verifyAnticipated(200000, 0, 0, 0, 0);
    final OnmsNode onmsNode = m_nodeDao.findAll().get(0);
    assertEquals(".1.3.6.1.4.1.7262.1", onmsNode.getSysObjectId());
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder) OnmsNode(org.opennms.netmgt.model.OnmsNode) InetAddress(java.net.InetAddress) EventAnticipator(org.opennms.netmgt.dao.mock.EventAnticipator) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 2 with JUnitSnmpAgents

use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.

the class PolicyIT method testSnmpPollPolicy.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = "10.7.15.240", port = 161, resource = "classpath:/snmpwalk-NMS-5414.properties"), @JUnitSnmpAgent(host = "10.7.15.241", port = 161, resource = "classpath:/snmpwalk-NMS-5414.properties"), @JUnitSnmpAgent(host = "10.102.251.200", port = 161, resource = "classpath:/snmpwalk-NMS-5414.properties"), @JUnitSnmpAgent(host = "10.211.140.149", port = 161, resource = "classpath:/snmpwalk-NMS-5414.properties") })
public // values created in other transactions (unless you are lucky - which sometimes we are not)
void testSnmpPollPolicy() throws Exception {
    try {
        // Create a BackgroundTask to wait for the provisioning group import to complete
        final BackgroundTask eventRecieved = anticipateEvents(EventConstants.PROVISION_SCAN_COMPLETE_UEI, EventConstants.PROVISION_SCAN_ABORTED_UEI);
        // Import the provisioning group
        m_provisioner.importModelFromResource(m_resourceLoader.getResource("classpath:/NMS-5414.xml"), Boolean.TRUE.toString());
        int nodeId = getNodeId();
        eventRecieved.await();
        final NodeScan scan = m_provisioner.createNodeScan(nodeId, getForeignSource(nodeId), getForeignId(nodeId), new OnmsMonitoringLocation());
        runScan(scan);
        Integer snmpIfId = findMatchingSnmpIf("ifDescr", "Trunk 1");
        assertEquals(1, getNodeId(snmpIfId));
        assertEquals(8193, getIfIndex(snmpIfId));
        assertEquals(0, getIpInterfaceCount(snmpIfId));
        assertEquals("P", getPollSetting(snmpIfId));
        snmpIfId = findMatchingSnmpIf("ifDescr", "VLAN 600 L3");
        assertEquals(1, getNodeId(snmpIfId));
        assertEquals(10600, getIfIndex(snmpIfId));
        assertEquals(1, getIpInterfaceCount(snmpIfId));
        assertEquals("P", getPollSetting(snmpIfId));
        snmpIfId = findMatchingSnmpIf("ifName", "ifc3 (Slot: 1 Port: 3)");
        assertEquals(1, getNodeId(snmpIfId));
        assertEquals(3, getIfIndex(snmpIfId));
        assertEquals(1, getIpInterfaceCount(snmpIfId));
        assertEquals("P", getPollSetting(snmpIfId));
        assertEquals(3, countSnmpIfsWithPollSetting("P"));
        System.err.println("Completed Successfully");
    } catch (AssertionError e) {
        throw e;
    }
}
Also used : OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 3 with JUnitSnmpAgents

use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.

the class Nms0123EnIT method testItpn0112Lldp.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = ITPN0112_IP, port = 161, resource = ITPN0112_SNMP_RESOURCE) })
public void testItpn0112Lldp() throws Exception {
    m_nodeDao.save(builder.getItpn0112());
    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 itpn0112 = m_nodeDao.findByForeignId("linkd", ITPN0112_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(itpn0112.getId()));
    assertEquals(0, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(itpn0112.getId()));
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getLldpElement() != null)
            printLldpElement(node.getLldpElement());
    }
    final List<LldpLink> topologyA = m_lldpLinkDao.findAll();
    assertEquals(2, topologyA.size());
    printLldpTopology(topologyA);
}
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 4 with JUnitSnmpAgents

use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.

the class Nms10205bEnIT method testNetwork10205bOspfLinks.

/*
     * 
MUMBAI_10.205.56.5: 
===================
root@Mumbai> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.14     ge-0/0/1.0             Full      192.168.9.1      128    31 ---->Bangalore
192.168.5.18     ge-0/0/2.0             Full      192.168.20.1     128    34 ---->Bagmane
192.168.5.22     ge-0/1/1.0             Full      192.168.22.1     128    38 ---->Mysore
192.168.5.10     ge-0/1/2.0             Full      192.168.7.1      128    35 ---->Delhi

DELHI_10.205.56.7:
==================
admin@Delhi> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.1.6      ge-1/0/1.0             Full      192.168.9.1      128    31  ---->Bangalore
192.168.5.9      ge-1/0/2.0             Full      192.168.5.1      128    39  ---->Mumbai
172.16.7.2       ge-1/1/6.0             Full      10.205.56.1      128    33  ---->Space_ex_sw1

BANGALORE_10.205.56.9:
======================
root@Bangalore> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.13     ge-0/0/0.0             Full      192.168.5.1      128    33  ---->Mumbai
192.168.1.5      ge-0/0/1.0             Full      192.168.7.1      128    32  ---->Delhi
172.16.9.2       ge-0/0/3.0             Full      10.205.56.2      128    34  ---->Space_ex_sw2
192.168.1.10     ge-0/1/0.0             Full      192.168.20.1     128    38  ---->Bagmane

Bagmane_10.205.56.20:
====================
admin@Bagmane> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.17     ge-1/0/0.0             Full      192.168.5.1      128    30 ----> Mumbai
172.16.20.2      ge-1/0/2.0             Full      10.205.56.42     128    31 ----> J6350_42
192.168.1.9      ge-1/0/4.0             Full      192.168.9.1      128    32 ----> Bangalore
192.168.1.14     ge-1/0/5.0             Full      192.168.22.1     128    33 ----> Mysore

Mysore_10.205.56.22:
===================
admin@Mysore> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.21     ge-0/0/1.0             Full      192.168.5.1      128    32 ----> Mumbai
192.168.1.13     ge-0/1/1.0             Full      192.168.20.1     128    38 ----> bagmane

Space-EX-SW1_10.205.56.1:
=========================
root@Space-EX-SW1> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
172.16.10.2      ge-0/0/0.0             Full      10.205.56.2      128    34 ----> Space_ex_sw2
172.16.7.1       ge-0/0/6.0             Full      192.168.7.1      128    32 ----> Delhi

Space-EX-SW2_10.205.56.2: 
=========================
root@Space-EX-SW2> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
172.16.10.1      ge-0/0/0.0             Full      10.205.56.1      128    35 ----> Space_ex_sw1
172.16.9.1       ge-0/0/3.0             Full      192.168.9.1      128    32 ----> Bangalore

*/
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = MUMBAI_IP, port = 161, resource = MUMBAI_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = DELHI_IP, port = 161, resource = DELHI_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = BANGALORE_IP, port = 161, resource = BANGALORE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = BAGMANE_IP, port = 161, resource = BAGMANE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = MYSORE_IP, port = 161, resource = MYSORE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SPACE_EX_SW1_IP, port = 161, resource = SPACE_EX_SW1_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SPACE_EX_SW2_IP, port = 161, resource = SPACE_EX_SW2_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = J6350_42_IP, port = 161, resource = J6350_42_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SRX_100_IP, port = 161, resource = SRX_100_SNMP_RESOURCE_B) })
public void testNetwork10205bOspfLinks() throws Exception {
    m_nodeDao.save(builder.getMumbai());
    m_nodeDao.save(builder.getDelhi());
    m_nodeDao.save(builder.getBangalore());
    m_nodeDao.save(builder.getBagmane());
    m_nodeDao.save(builder.getMysore());
    m_nodeDao.save(builder.getSpaceExSw1());
    m_nodeDao.save(builder.getSpaceExSw2());
    m_nodeDao.save(builder.getJ635042());
    m_nodeDao.save(builder.getSRX100());
    m_nodeDao.flush();
    final OnmsNode mumbai = m_nodeDao.findByForeignId("linkd", MUMBAI_NAME);
    final OnmsNode delhi = m_nodeDao.findByForeignId("linkd", DELHI_NAME);
    final OnmsNode bangalore = m_nodeDao.findByForeignId("linkd", BANGALORE_NAME);
    final OnmsNode bagmane = m_nodeDao.findByForeignId("linkd", BAGMANE_NAME);
    final OnmsNode mysore = m_nodeDao.findByForeignId("linkd", MYSORE_NAME);
    final OnmsNode spaceexsw1 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW1_NAME);
    final OnmsNode spaceexsw2 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW2_NAME);
    final OnmsNode j635042 = m_nodeDao.findByForeignId("linkd", J6350_42_NAME);
    final OnmsNode srx100 = m_nodeDao.findByForeignId("linkd", SRX_100_NAME);
    m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
    m_linkdConfig.getConfiguration().setUseCdpDiscovery(false);
    m_linkdConfig.getConfiguration().setUseOspfDiscovery(true);
    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(mumbai.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(delhi.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bangalore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bagmane.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(mysore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw1.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw2.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(j635042.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(srx100.getId()));
    assertEquals(0, m_ospfLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(mumbai.getId()));
    final List<OspfLink> topologyA = m_ospfLinkDao.findAll();
    printOspfTopology(topologyA);
    assertEquals(4, topologyA.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(delhi.getId()));
    final List<OspfLink> topologyB = m_ospfLinkDao.findAll();
    printOspfTopology(topologyB);
    assertEquals(7, topologyB.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(bangalore.getId()));
    final List<OspfLink> topologyC = m_ospfLinkDao.findAll();
    printOspfTopology(topologyC);
    assertEquals(11, topologyC.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(bagmane.getId()));
    final List<OspfLink> topologyD = m_ospfLinkDao.findAll();
    printOspfTopology(topologyD);
    assertEquals(15, topologyD.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(mysore.getId()));
    final List<OspfLink> topologyE = m_ospfLinkDao.findAll();
    printOspfTopology(topologyE);
    assertEquals(17, topologyE.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw1.getId()));
    final List<OspfLink> topologyF = m_ospfLinkDao.findAll();
    printOspfTopology(topologyF);
    assertEquals(19, topologyF.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw2.getId()));
    final List<OspfLink> topologyG = m_ospfLinkDao.findAll();
    printOspfTopology(topologyG);
    assertEquals(21, topologyG.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    Thread.sleep(1000);
    assertTrue(m_linkd.runSingleSnmpCollection(j635042.getId()));
    final List<OspfLink> topologyH = m_ospfLinkDao.findAll();
    printOspfTopology(topologyH);
    assertEquals(22, topologyH.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
    assertTrue(m_linkd.runSingleSnmpCollection(srx100.getId()));
    final List<OspfLink> topologyI = m_ospfLinkDao.findAll();
    printOspfTopology(topologyI);
    assertEquals(22, topologyI.size());
    for (final OnmsNode node : m_nodeDao.findAll()) {
        if (node.getOspfElement() != null)
            printOspfElement(node.getOspfElement());
    }
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OspfLink(org.opennms.netmgt.model.OspfLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 5 with JUnitSnmpAgents

use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.

the class Nms10205bEnIT method testNetwork10205bLldpLinks.

/*
     * 
MUMBAI_10.205.56.5: (LLDP is not supported on this device_family=m320)
===================
root@Mumbai> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.14     ge-0/0/1.0             Full      192.168.9.1      128    31 ---->Bangalore
192.168.5.18     ge-0/0/2.0             Full      192.168.20.1     128    34 ---->Bagmane
192.168.5.22     ge-0/1/1.0             Full      192.168.22.1     128    38 ---->Mysore
192.168.5.10     ge-0/1/2.0             Full      192.168.7.1      128    35 ---->Delhi

DELHI_10.205.56.7:
==================
admin@Delhi> show lldp neighbors
Local Interface Chassis Id        Port info     System Name
ge-1/1/6        00:23:9c:02:3b:40  ge-0/0/6.0   Space-EX-SW1
ge-1/1/5        80:71:1f:c7:0f:c0  ge-1/0/1     Bagmane
admin@Delhi> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.1.6      ge-1/0/1.0             Full      192.168.9.1      128    31  ---->Bangalore
192.168.5.9      ge-1/0/2.0             Full      192.168.5.1      128    39  ---->Mumbai
172.16.7.2       ge-1/1/6.0             Full      10.205.56.1      128    33  ---->Space_ex_sw1


BANGALORE_10.205.56.9: (LLDP is not supported on this device_family=m7i)
======================
root@Bangalore> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.13     ge-0/0/0.0             Full      192.168.5.1      128    33  ---->Mumbai
192.168.1.5      ge-0/0/1.0             Full      192.168.7.1      128    32  ---->Delhi
172.16.9.2       ge-0/0/3.0             Full      10.205.56.2      128    34  ---->Space_ex_sw2
192.168.1.10     ge-0/1/0.0             Full      192.168.20.1     128    38  ---->Bagmane

Bagmane_10.205.56.20:
====================
admin@Bagmane> show lldp neighbors
Local Interface Chassis Id        Port info     System Name
ge-1/0/1        00:22:83:f1:67:c0  ge-1/1/5     Delhi
ge-1/0/3        00:26:88:6a:9a:80  ge-1/0/6.0   sw21
ge-1/0/2        2c:6b:f5:5d:c1:00  TO-BAMANE    J6350-2
admin@Bagmane> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.17     ge-1/0/0.0             Full      192.168.5.1      128    30 ----> Mumbai
172.16.20.2      ge-1/0/2.0             Full      10.205.56.42     128    31 ----> J6350_42
192.168.1.9      ge-1/0/4.0             Full      192.168.9.1      128    32 ----> Bangalore
192.168.1.14     ge-1/0/5.0             Full      192.168.22.1     128    33 ----> Mysore

Mysore_10.205.56.22:(LLDP is not supported on this device_family=m10i)
===================
admin@Mysore> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.5.21     ge-0/0/1.0             Full      192.168.5.1      128    32 ----> Mumbai
192.168.1.13     ge-0/1/1.0             Full      192.168.20.1     128    38 ----> bagmane

Space-EX-SW1_10.205.56.1:
=========================
root@Space-EX-SW1> show lldp neighbors
Local Interface    Parent Interface    Chassis Id          Port info          System Name
ge-0/0/0.0         -                   00:21:59:cf:4c:00   ge-0/0/0.0         Space-EX-SW2
ge-0/0/6.0         -                   00:22:83:f1:67:c0   ge-1/1/6           Delhi
ge-0/0/4.0         -                   00:26:88:6a:9a:80   ge-2/0/33.0        sw21
root@Space-EX-SW1> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
172.16.10.2      ge-0/0/0.0             Full      10.205.56.2      128    34 ----> Space_ex_sw2
172.16.7.1       ge-0/0/6.0             Full      192.168.7.1      128    32 ----> Delhi

Space-EX-SW2_10.205.56.2: 
=========================
root@Space-EX-SW2> show lldp neighbors
Local Interface    Parent Interface    Chassis Id          Port info     System Name
ge-0/0/0.0         -                   00:23:9c:02:3b:40   TO-EX-SW1    Space-EX-SW1
me0.0              -                   00:26:88:6a:9a:80   ge-0/0/15.0  sw21
root@Space-EX-SW2> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
172.16.10.1      ge-0/0/0.0             Full      10.205.56.1      128    35 ----> Space_ex_sw1
172.16.9.1       ge-0/0/3.0             Full      192.168.9.1      128    32 ----> Bangalore

*/
/*
     * 

MUMBAI_10.205.56.5: (LLDP is not supported on this device_family=m320)
===================

DELHI_10.205.56.7:
==================
admin@Delhi> show lldp neighbors
Local Interface Chassis Id        Port info     System Name
ge-1/1/6        00:23:9c:02:3b:40  ge-0/0/6.0   Space-EX-SW1
ge-1/1/5        80:71:1f:c7:0f:c0  ge-1/0/1     Bagmane

BANGALORE_10.205.56.9: (LLDP is not supported on this device_family=m7i)
======================

Bagmane_10.205.56.20:
====================
admin@Bagmane> show lldp neighbors
Local Interface Chassis Id        Port info     System Name
ge-1/0/1        00:22:83:f1:67:c0  ge-1/1/5     Delhi
ge-1/0/3        00:26:88:6a:9a:80  ge-1/0/6.0   sw21
ge-1/0/2        2c:6b:f5:5d:c1:00  TO-BAMANE    J6350-2

Mysore_10.205.56.22:(LLDP is not supported on this device_family=m10i)
===================

Space-EX-SW1_10.205.56.1:
=========================
root@Space-EX-SW1> show lldp neighbors
Local Interface    Parent Interface    Chassis Id          Port info          System Name
ge-0/0/0.0         -                   00:21:59:cf:4c:00   ge-0/0/0.0         Space-EX-SW2
ge-0/0/6.0         -                   00:22:83:f1:67:c0   ge-1/1/6           Delhi
ge-0/0/4.0         -                   00:26:88:6a:9a:80   ge-2/0/33.0        sw21

Space-EX-SW2_10.205.56.2: 
=========================
root@Space-EX-SW2> show lldp neighbors
Local Interface    Parent Interface    Chassis Id          Port info     System Name
ge-0/0/0.0         -                   00:23:9c:02:3b:40   TO-EX-SW1    Space-EX-SW1
me0.0              -                   00:26:88:6a:9a:80   ge-0/0/15.0  sw21

J6350-42_10.205.56.42:
=========================
does not support lldp rem table but
is linked to bagmane

SRX-100_10.205.56.23:
=========================
support LLDP 
it has a link to Mysore that does not support LLDP
 
     */
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = MUMBAI_IP, port = 161, resource = MUMBAI_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = DELHI_IP, port = 161, resource = DELHI_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = BANGALORE_IP, port = 161, resource = BANGALORE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = BAGMANE_IP, port = 161, resource = BAGMANE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = MYSORE_IP, port = 161, resource = MYSORE_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SPACE_EX_SW1_IP, port = 161, resource = SPACE_EX_SW1_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SPACE_EX_SW2_IP, port = 161, resource = SPACE_EX_SW2_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = J6350_42_IP, port = 161, resource = J6350_42_SNMP_RESOURCE_B), @JUnitSnmpAgent(host = SRX_100_IP, port = 161, resource = SRX_100_SNMP_RESOURCE_B) })
public void testNetwork10205bLldpLinks() throws Exception {
    m_nodeDao.save(builder.getMumbai());
    m_nodeDao.save(builder.getDelhi());
    m_nodeDao.save(builder.getBangalore());
    m_nodeDao.save(builder.getBagmane());
    m_nodeDao.save(builder.getMysore());
    m_nodeDao.save(builder.getSpaceExSw1());
    m_nodeDao.save(builder.getSpaceExSw2());
    m_nodeDao.save(builder.getJ635042());
    m_nodeDao.save(builder.getSRX100());
    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 mumbai = m_nodeDao.findByForeignId("linkd", MUMBAI_NAME);
    final OnmsNode delhi = m_nodeDao.findByForeignId("linkd", DELHI_NAME);
    final OnmsNode bangalore = m_nodeDao.findByForeignId("linkd", BANGALORE_NAME);
    final OnmsNode bagmane = m_nodeDao.findByForeignId("linkd", BAGMANE_NAME);
    final OnmsNode mysore = m_nodeDao.findByForeignId("linkd", MYSORE_NAME);
    final OnmsNode spaceexsw1 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW1_NAME);
    final OnmsNode spaceexsw2 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW2_NAME);
    final OnmsNode j635042 = m_nodeDao.findByForeignId("linkd", J6350_42_NAME);
    final OnmsNode srx100 = m_nodeDao.findByForeignId("linkd", SRX_100_NAME);
    assertTrue(m_linkd.scheduleNodeCollection(mumbai.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(delhi.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bangalore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bagmane.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(mysore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw1.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw2.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(j635042.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(srx100.getId()));
    assertEquals(0, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(mumbai.getId()));
    assertEquals(0, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(delhi.getId()));
    assertEquals(2, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(bangalore.getId()));
    assertEquals(2, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(bagmane.getId()));
    assertEquals(5, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(mysore.getId()));
    assertEquals(5, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw1.getId()));
    assertEquals(8, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw2.getId()));
    assertEquals(10, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(j635042.getId()));
    assertEquals(10, m_lldpLinkDao.countAll());
    assertTrue(m_linkd.runSingleSnmpCollection(srx100.getId()));
    assertEquals(10, m_lldpLinkDao.countAll());
    final List<LldpLink> topologyC = m_lldpLinkDao.findAll();
    printLldpTopology(topologyC);
    assertEquals(10, topologyC.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)

Aggregations

JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)66 Test (org.junit.Test)64 OnmsNode (org.opennms.netmgt.model.OnmsNode)38 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)23 LldpLink (org.opennms.netmgt.model.LldpLink)14 ArrayList (java.util.ArrayList)8 BridgeMacLink (org.opennms.netmgt.model.BridgeMacLink)8 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)6 EventAnticipator (org.opennms.netmgt.dao.mock.EventAnticipator)4 LldpLocPortGetter (org.opennms.netmgt.enlinkd.snmp.LldpLocPortGetter)4 CdpLink (org.opennms.netmgt.model.CdpLink)4 IsIsLink (org.opennms.netmgt.model.IsIsLink)4 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 LldpElement (org.opennms.netmgt.model.LldpElement)3 OspfLink (org.opennms.netmgt.model.OspfLink)3 InetAddress (java.net.InetAddress)2 CdpGlobalGroupTracker (org.opennms.netmgt.enlinkd.snmp.CdpGlobalGroupTracker)2 LldpLocalGroupTracker (org.opennms.netmgt.enlinkd.snmp.LldpLocalGroupTracker)2 LldpRemTableTracker (org.opennms.netmgt.enlinkd.snmp.LldpRemTableTracker)2