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);
}
use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgents in project opennms by OpenNMS.
the class DragonWaveNodeSwitchingIT method testInitialSetup.
@Test
@JUnitSnmpAgents({ @JUnitSnmpAgent(host = "192.168.255.22", port = 161, resource = "classpath:/dw/walks/node1-walk.properties") })
public void testInitialSetup() 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.findByForeignId("dw", "arthur");
final String sysObjectId = onmsNode.getSysObjectId();
assertEquals(".1.3.6.1.4.1.7262.2.3", sysObjectId);
m_mockSnmpDataProvider.setDataForAddress(new SnmpAgentAddress(iface, 161), m_resourceLoader.getResource("classpath:/dw/walks/node3-walk.properties"));
assertEquals(".1.3.6.1.4.1.7262.1", SnmpUtils.get(m_snmpPeerFactory.getAgentConfig(iface), SnmpObjId.get(".1.3.6.1.2.1.1.2.0")).toDisplayString());
anticipator.reset();
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_UPDATED_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).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);
anticipator.reset();
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());
final NodeScan scan2 = m_provisioner.createNodeScan(nextNodeId, onmsNode.getForeignSource(), onmsNode.getForeignId(), onmsNode.getLocation());
runScan(scan2);
m_nodeDao.flush();
anticipator.verifyAnticipated(200000, 0, 0, 0, 0);
final OnmsNode node = m_nodeDao.findByForeignId("dw", "arthur");
final String sysObjectId2 = node.getSysObjectId();
assertEquals(".1.3.6.1.4.1.7262.1", sysObjectId2);
}
Aggregations