@Test @JUnitSnmpAgents( value = {@JUnitSnmpAgent(host = Sluck001_IP, port = 161, resource = Sluck001_SNMP_RESOURCE)}) public void testNetworkLinksCiscoJuniperVlan() throws Exception { m_nodeDao.save(builder.getSluck001()); m_nodeDao.flush(); Package example1 = m_linkdConfig.getPackage("example1"); example1.setUseIsisDiscovery(false); example1.setUseIpRouteDiscovery(false); example1.setUseOspfDiscovery(false); example1.setUseLldpDiscovery(false); example1.setUseCdpDiscovery(false); example1.setUseBridgeDiscovery(false); example1.setEnableVlanDiscovery(true); example1.setSaveStpNodeTable(false); example1.setSaveStpInterfaceTable(false); example1.setSaveRouteTable(false); final OnmsNode switchCisco = m_nodeDao.findByForeignId("linkd", Sluck001_NAME); assertTrue(m_linkd.scheduleNodeCollection(switchCisco.getId())); assertTrue(m_linkd.runSingleSnmpCollection(switchCisco.getId())); assertEquals(7, m_vlanDao.countAll()); }
/* * fixed a fake link found using cdp: * caused by duplicated ip address s * r-uk-nott-newt-103:Fa0:(1)<------>(4):Fa3:r-ro-suce-pict-001 */ @Test @JUnitSnmpAgents( value = { @JUnitSnmpAgent(host = RPict001_IP, port = 161, resource = RPict001_SNMP_RESOURCE), @JUnitSnmpAgent(host = RNewt103_IP, port = 161, resource = RNewt103_SNMP_RESOURCE) }) public void testCdpFakeLinkRoUk() throws Exception { m_nodeDao.save(builder.getRPict001()); m_nodeDao.save(builder.getRNewt103()); m_nodeDao.flush(); Package example1 = m_linkdConfig.getPackage("example1"); example1.setUseIsisDiscovery(false); example1.setUseIpRouteDiscovery(false); example1.setUseOspfDiscovery(false); example1.setUseLldpDiscovery(false); example1.setUseCdpDiscovery(true); example1.setUseBridgeDiscovery(false); example1.setEnableVlanDiscovery(false); example1.setSaveStpNodeTable(false); example1.setSaveStpInterfaceTable(false); example1.setSaveRouteTable(false); final OnmsNode routerRo = m_nodeDao.findByForeignId("linkd", RPict001_NAME); final OnmsNode routerUk = m_nodeDao.findByForeignId("linkd", RNewt103_NAME); assertTrue(m_linkd.scheduleNodeCollection(routerRo.getId())); assertTrue(m_linkd.scheduleNodeCollection(routerUk.getId())); assertTrue(m_linkd.runSingleSnmpCollection(routerRo.getId())); assertTrue(m_linkd.runSingleSnmpCollection(routerUk.getId())); assertEquals(0, m_dataLinkInterfaceDao.countAll()); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); assertEquals(0, m_dataLinkInterfaceDao.countAll()); }
@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(); Package example1 = m_linkdConfig.getPackage("example1"); example1.setUseIsisDiscovery(false); example1.setUseIpRouteDiscovery(false); example1.setUseOspfDiscovery(false); example1.setUseLldpDiscovery(true); example1.setUseCdpDiscovery(false); example1.setUseBridgeDiscovery(false); example1.setEnableVlanDiscovery(false); example1.setSaveStpNodeTable(false); example1.setSaveStpInterfaceTable(false); example1.setSaveRouteTable(false); HibernateEventWriter queryManager = (HibernateEventWriter) m_linkd.getQueryManager(); assertEquals( 107, queryManager.getFromSysnameIfName(RDeEssnBrue_NAME, "Gi1/3/11").getIfIndex().intValue()); assertEquals( 260, queryManager.getFromSysnameIfName(RDeEssnBrue_NAME, "Gi2/3/11").getIfIndex().intValue()); assertEquals( 1025, queryManager.getFromSysnameIfIndex(SDeEssnBrue165_NAME, 1025).getIfIndex().intValue()); assertEquals( 2025, queryManager.getFromSysnameIfName(SDeEssnBrue165_NAME, "2/25").getIfIndex().intValue()); 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())); assertTrue(m_linkd.runSingleSnmpCollection(routerCisco.getId())); assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu081.getId())); assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu121.getId())); assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu142.getId())); assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu165.getId())); assertEquals(0, m_dataLinkInterfaceDao.countAll()); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); for (DataLinkInterface link : m_dataLinkInterfaceDao.findAll()) { printLink(link); } assertEquals(6, m_dataLinkInterfaceDao.countAll()); }