use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms7918EnIT method testNms7918TwoSteps.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = ASW01_IP, port = 161, resource = ASW01_SNMP_RESOURCE), @JUnitSnmpAgent(host = SAMASW01_IP, port = 161, resource = SAMASW01_SNMP_RESOURCE), @JUnitSnmpAgent(host = STCASW01_IP, port = 161, resource = STCASW01_SNMP_RESOURCE) })
public void testNms7918TwoSteps() throws Exception {
final OnmsNode stcasw01 = m_nodeDao.findByForeignId("linkd", STCASW01_NAME);
final OnmsNode samasw01 = m_nodeDao.findByForeignId("linkd", SAMASW01_NAME);
final OnmsNode asw01 = m_nodeDao.findByForeignId("linkd", ASW01_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);
m_linkdConfig.getConfiguration().setMaxBft(2);
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(!m_linkdConfig.useCdpDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useIsisDiscovery());
assertTrue(m_linkd.scheduleNodeCollection(asw01.getId()));
assertTrue(m_linkd.scheduleNodeCollection(samasw01.getId()));
assertTrue(m_linkd.scheduleNodeCollection(stcasw01.getId()));
assertEquals(0, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(asw01.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(samasw01.getId()));
assertEquals(2, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runTopologyDiscovery(asw01.getId()));
checkAsw01SamAsw01Topology(asw01, samasw01);
assertTrue(m_linkd.runTopologyDiscovery(samasw01.getId()));
checkAsw01SamAsw01Topology(asw01, samasw01);
assertTrue(m_linkd.runSingleSnmpCollection(stcasw01.getId()));
assertTrue(m_linkd.runTopologyDiscovery(stcasw01.getId()));
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms7918EnIT method testNms7918STCASW01Bft.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = STCASW01_IP, port = 161, resource = STCASW01_SNMP_RESOURCE) })
public void testNms7918STCASW01Bft() throws Exception {
final OnmsNode stcasw01 = m_nodeDao.findByForeignId("linkd", STCASW01_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(stcasw01.getId()));
assertTrue(!m_linkd.scheduleNodeCollection(stcasw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(stcasw01.getId()));
assertEquals(1, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runTopologyDiscovery(stcasw01.getId()));
assertNull(m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(stcasw01.getId()));
assertEquals(1, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(34, m_bridgeMacLinkDao.countAll());
for (BridgeMacLink link : m_bridgeMacLinkDao.findAll()) {
System.err.println(link.printTopology());
}
assertTrue(m_linkd.runSingleSnmpCollection(stcasw01.getId()));
assertEquals(1, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(34, m_bridgeMacLinkDao.countAll());
Thread.sleep(5000);
assertTrue(m_linkd.runTopologyDiscovery(stcasw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(34, m_bridgeMacLinkDao.countAll());
for (BridgeMacLink link : m_bridgeMacLinkDao.findAll()) {
System.err.println(link.printTopology());
}
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms7918EnIT method testNms7918STCASW01BftCollection.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = STCASW01_IP, port = 161, resource = STCASW01_SNMP_RESOURCE) })
public void testNms7918STCASW01BftCollection() throws Exception {
final OnmsNode stcasw01 = m_nodeDao.findByForeignId("linkd", STCASW01_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(stcasw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(stcasw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
List<BridgeMacLink> links = m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(stcasw01.getId());
assertEquals(34, links.size());
for (BridgeMacLink link : links) {
System.err.println(link.printTopology());
}
assertTrue(m_linkd.runTopologyDiscovery(stcasw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms7918EnIT method testNms7918ASW01BftCollection.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = ASW01_IP, port = 161, resource = ASW01_SNMP_RESOURCE) })
public void testNms7918ASW01BftCollection() throws Exception {
final OnmsNode asw01 = m_nodeDao.findByForeignId("linkd", ASW01_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(asw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(asw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
List<BridgeMacLink> links = m_linkd.getQueryManager().useBridgeTopologyUpdateBFT(asw01.getId());
assertEquals(40, links.size());
;
for (BridgeMacLink link : links) {
System.err.println(link.printTopology());
}
assertTrue(m_linkd.runTopologyDiscovery(asw01.getId()));
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class Nms7918EnIT method testNms7918ThreeSteps.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = ASW01_IP, port = 161, resource = ASW01_SNMP_RESOURCE), @JUnitSnmpAgent(host = SAMASW01_IP, port = 161, resource = SAMASW01_SNMP_RESOURCE), @JUnitSnmpAgent(host = STCASW01_IP, port = 161, resource = STCASW01_SNMP_RESOURCE) })
public void testNms7918ThreeSteps() throws Exception {
final OnmsNode stcasw01 = m_nodeDao.findByForeignId("linkd", STCASW01_NAME);
final OnmsNode samasw01 = m_nodeDao.findByForeignId("linkd", SAMASW01_NAME);
final OnmsNode asw01 = m_nodeDao.findByForeignId("linkd", ASW01_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(asw01.getId()));
assertTrue(m_linkd.scheduleNodeCollection(samasw01.getId()));
assertTrue(m_linkd.scheduleNodeCollection(stcasw01.getId()));
assertEquals(0, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(asw01.getId()));
assertEquals(1, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(0, m_bridgeBridgeLinkDao.countAll());
assertEquals(0, m_bridgeMacLinkDao.countAll());
assertTrue(m_linkd.runTopologyDiscovery(asw01.getId()));
checkAsw01Topology(asw01);
assertTrue(m_linkd.runSingleSnmpCollection(samasw01.getId()));
assertTrue(m_linkd.runTopologyDiscovery(samasw01.getId()));
checkAsw01SamAsw01Topology(asw01, samasw01);
assertTrue(m_linkd.runSingleSnmpCollection(stcasw01.getId()));
assertTrue(m_linkd.runTopologyDiscovery(stcasw01.getId()));
checkTopology(asw01, stcasw01, samasw01);
}
Aggregations