use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class ProvisionerIT method testDowntimeModelDeleteServiceEventDiscoveryEnabledDeletionDisabledDiscoveredNode.
@Test
@JUnitSnmpAgents({ @JUnitSnmpAgent(host = "198.51.100.201", resource = "classpath:/snmpTestData3.properties"), @JUnitSnmpAgent(host = "198.51.100.204", resource = "classpath:/snmpTestData3.properties") })
public void testDowntimeModelDeleteServiceEventDiscoveryEnabledDeletionDisabledDiscoveredNode() throws Exception {
System.setProperty("org.opennms.provisiond.enableDiscovery", "true");
assertTrue(m_provisionService.isDiscoveryEnabled());
final NewSuspectScan scan = m_provisioner.createNewSuspectScan(addr("198.51.100.201"), null, null);
runScan(scan);
assertEquals(2, m_ipInterfaceDao.findAll().size());
LOG.debug("ifaces = {}", m_ipInterfaceDao.findAll());
final List<OnmsIpInterface> ifaces = m_ipInterfaceDao.findByIpAddress("198.51.100.201");
assertEquals(1, ifaces.size());
final OnmsNode node = ifaces.iterator().next().getNode();
assertEquals(2, node.getIpInterfaces().size());
// SNMP on each of the 2 interfaces
assertEquals(2, getMonitoredServiceDao().findAll().size());
m_eventAnticipator.reset();
// the service and interface should be deleted
// since there is another interface, the node remains
m_eventAnticipator.anticipateEvent(serviceDeleted(node.getId(), "198.51.100.201", "SNMP"));
m_eventAnticipator.anticipateEvent(interfaceDeleted(node.getId(), "198.51.100.201"));
getScheduledExecutor().resume();
m_mockEventIpcManager.sendEventToListeners(deleteService(node.getId(), "198.51.100.201", "SNMP"));
m_eventAnticipator.waitForAnticipated(10000);
m_eventAnticipator.verifyAnticipated();
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class ProvisionerIT method testDowntimeModelDeleteServiceEventDiscoveryEnabledDeletionDisabledDiscoveredNodeSingleInterface.
@Test
@JUnitSnmpAgents({ @JUnitSnmpAgent(host = "198.51.100.201", resource = "classpath:/snmpwalk-system.properties") })
public void testDowntimeModelDeleteServiceEventDiscoveryEnabledDeletionDisabledDiscoveredNodeSingleInterface() throws Exception {
System.setProperty("org.opennms.provisiond.enableDiscovery", "true");
assertTrue(m_provisionService.isDiscoveryEnabled());
final NewSuspectScan scan = m_provisioner.createNewSuspectScan(addr("198.51.100.201"), null, null);
runScan(scan);
assertEquals(1, m_ipInterfaceDao.findAll().size());
LOG.debug("ifaces = {}", m_ipInterfaceDao.findAll());
final List<OnmsIpInterface> ifaces = m_ipInterfaceDao.findByIpAddress("198.51.100.201");
assertEquals(1, ifaces.size());
final OnmsNode node = ifaces.iterator().next().getNode();
assertEquals(1, node.getIpInterfaces().size());
m_eventAnticipator.reset();
// everything up to the node should be deleted, since there is only a single interface with a single service
// since there is another interface, the node remains
m_eventAnticipator.anticipateEvent(serviceDeleted(node.getId(), "198.51.100.201", "SNMP"));
m_eventAnticipator.anticipateEvent(interfaceDeleted(node.getId(), "198.51.100.201"));
m_eventAnticipator.anticipateEvent(nodeDeleted(node.getId()));
getScheduledExecutor().resume();
m_mockEventIpcManager.sendEventToListeners(deleteService(node.getId(), "198.51.100.201", "SNMP"));
m_eventAnticipator.waitForAnticipated(10000);
m_eventAnticipator.verifyAnticipated();
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms0123EnIT method testItpn0111Lldp.
/*
*
*
*/
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = ITPN0111_IP, port = 161, resource = ITPN0111_SNMP_RESOURCE) })
public void testItpn0111Lldp() throws Exception {
m_nodeDao.save(builder.getItpn0111());
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 itpn0111 = m_nodeDao.findByForeignId("linkd", ITPN0111_NAME);
assertTrue(m_linkd.scheduleNodeCollection(itpn0111.getId()));
assertEquals(0, m_lldpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(itpn0111.getId()));
for (final OnmsNode node : m_nodeDao.findAll()) {
if (node.getLldpElement() != null)
printLldpElement(node.getLldpElement());
}
final List<LldpLink> topologyA = m_lldpLinkDao.findAll();
assertEquals(4, topologyA.size());
printLldpTopology(topologyA);
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms17216EnIT method testNetwork17216CdpLinks.
/*
* switch1 GigabitEthernet 0/9 0/10 0/11 0/12 ---> switch2 GigabitEthernet 0/1 0/2 0/3 0/4
* switch1 GigabitEthernet0/1 ---> router1 FastEthernet0/0
*
* switch2 GigabitEthernet 0/1 0/2 0/3 0/4 ---> switch1 GigabitEthernet 0/9 0/10 0/11 0/12
* switch2 GigabitEthernet 0/19 Gi0/20 ---> switch3 FastEthernet 0/19 0/20
*
* switch3 FastEthernet 0/19 0/20 ---> switch2 GigabitEthernet 0/19 0/20
* switch3 FastEthernet 0/23 0/24 ---> switch5 FastEthernet 0/1 0/13
*
* switch4 FastEthernet0/1 ---> router3 GigabitEthernet0/1
*
* switch5 FastEthernet 0/1 0/13 ---> switch3 FastEthernet 0/23 0/24
*
* router1 FastEthernet0/0 ---> switch1 GigabitEthernet0/1
* router1 Serial0/0/0 ---> router2 Serial0/0/0
*
* router2 Serial0/0/0 ---> router1 Serial0/0/0
* router2 Serial0/0/1 ---> router3 Serial0/0/1
*
* router3 GigabitEthernet0/0 ---> router4 GigabitEthernet0/1
* router3 GigabitEthernet0/1 ---> switch4 FastEthernet0/1
* router3 Serial0/0/1 ---> router2 Serial0/0/1
*
* router4 GigabitEthernet0/1 ---> router3 GigabitEthernet0/0
*
*/
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SWITCH1_IP, port = 161, resource = SWITCH1_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH2_IP, port = 161, resource = SWITCH2_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH3_IP, port = 161, resource = SWITCH3_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH4_IP, port = 161, resource = SWITCH4_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH5_IP, port = 161, resource = SWITCH5_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER1_IP, port = 161, resource = ROUTER1_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER2_IP, port = 161, resource = ROUTER2_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER3_IP, port = 161, resource = ROUTER3_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER4_IP, port = 161, resource = ROUTER4_SNMP_RESOURCE) })
public void testNetwork17216CdpLinks() throws Exception {
m_nodeDao.save(builder.getSwitch1());
m_nodeDao.save(builder.getSwitch2());
m_nodeDao.save(builder.getSwitch3());
m_nodeDao.save(builder.getSwitch4());
m_nodeDao.save(builder.getSwitch5());
m_nodeDao.save(builder.getRouter1());
m_nodeDao.save(builder.getRouter2());
m_nodeDao.save(builder.getRouter3());
m_nodeDao.save(builder.getRouter4());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(true);
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());
final OnmsNode switch1 = m_nodeDao.findByForeignId("linkd", SWITCH1_NAME);
final OnmsNode switch2 = m_nodeDao.findByForeignId("linkd", SWITCH2_NAME);
final OnmsNode switch3 = m_nodeDao.findByForeignId("linkd", SWITCH3_NAME);
final OnmsNode switch4 = m_nodeDao.findByForeignId("linkd", SWITCH4_NAME);
final OnmsNode switch5 = m_nodeDao.findByForeignId("linkd", SWITCH5_NAME);
final OnmsNode router1 = m_nodeDao.findByForeignId("linkd", ROUTER1_NAME);
final OnmsNode router2 = m_nodeDao.findByForeignId("linkd", ROUTER2_NAME);
final OnmsNode router3 = m_nodeDao.findByForeignId("linkd", ROUTER3_NAME);
final OnmsNode router4 = m_nodeDao.findByForeignId("linkd", ROUTER4_NAME);
assertTrue(m_linkd.scheduleNodeCollection(switch1.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch2.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch3.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch4.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch5.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router1.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router2.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router3.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router4.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(switch1.getId()));
assertEquals(5, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch2.getId()));
assertEquals(11, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch3.getId()));
assertEquals(15, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch4.getId()));
assertEquals(16, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch5.getId()));
assertEquals(18, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router1.getId()));
assertEquals(20, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router2.getId()));
assertEquals(22, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router3.getId()));
assertEquals(25, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router4.getId()));
assertEquals(26, m_cdpLinkDao.countAll());
assertEquals(13, m_cdpLinkDao.findLinksForTopology().size());
for (final OnmsNode node : m_nodeDao.findAll()) {
assertNotNull(node.getCdpElement());
printCdpElement(node.getCdpElement());
assertEquals(TruthValue.TRUE, node.getCdpElement().getCdpGlobalRun());
if (node.getId().intValue() == switch1.getId().intValue()) {
assertEquals(SWITCH1_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch2.getId().intValue()) {
assertEquals(SWITCH2_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch3.getId().intValue()) {
assertEquals(SWITCH3_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch4.getId().intValue()) {
assertEquals(SWITCH4_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch5.getId().intValue()) {
assertEquals(SWITCH5_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router1.getId().intValue()) {
assertEquals(ROUTER1_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router2.getId().intValue()) {
assertEquals(ROUTER2_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router3.getId().intValue()) {
assertEquals(ROUTER3_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router4.getId().intValue()) {
assertEquals(ROUTER4_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else {
assertTrue(false);
}
}
for (CdpLink link : m_cdpLinkDao.findAll()) {
printCdpLink(link);
assertEquals(CiscoNetworkProtocolType.ip, link.getCdpCacheAddressType());
if (link.getNode().getId().intValue() == switch1.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10101 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10101), link.getCdpInterfaceName());
assertEquals(ROUTER1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(24)T1, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Fri 19-Jun-09 15:13 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER1_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco 2811", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(7), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10109 && link.getCdpCacheDeviceIndex().intValue() == 5) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10109), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10101), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10110 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10110), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10102), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10111 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10111), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10103), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10112 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10112), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10104), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch2.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10101 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10101), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10109), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10102 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10102), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10110), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10103 && link.getCdpCacheDeviceIndex().intValue() == 5) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10103), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10111), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10104 && link.getCdpCacheDeviceIndex().intValue() == 6) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10104), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10112), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10119 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10119), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10019), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10120 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10120), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10020), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch3.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10019 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10019), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10119), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10020 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10020), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10120), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10023 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10023), link.getCdpInterfaceName());
assertEquals(SWITCH5_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH5_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10001), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10024 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10024), link.getCdpInterfaceName());
assertEquals(SWITCH5_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH5_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10013), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch4.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10001 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH4_IF_IFDESCR_MAP.get(10001), link.getCdpInterfaceName());
assertEquals(ROUTER3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(9), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch5.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10001 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10001), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10023), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10013 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10013), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10024), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router1.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 7 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(7), link.getCdpInterfaceName());
assertEquals(10101, SWITCH1_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10101), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(12, ROUTER2_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER2_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(12), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router2.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 12 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(12), link.getCdpInterfaceName());
assertEquals(13, ROUTER1_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(24)T1, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Fri 19-Jun-09 15:13 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER1_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco 2811", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(13, ROUTER3_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router3.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 8 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(8), link.getCdpInterfaceName());
assertEquals(3, ROUTER4_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER4_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER4_IF_IFDESCR_MAP.get(3), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 9 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(9), link.getCdpInterfaceName());
assertEquals(SWITCH4_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH4_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH4_IF_IFDESCR_MAP.get(10001), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(13, ROUTER2_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER2_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router4.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 3 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER4_IF_IFDESCR_MAP.get(3), link.getCdpInterfaceName());
assertEquals(8, ROUTER3_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(8), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else {
assertTrue(false);
}
}
}
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
*/
}
Aggregations