use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerQueryManagerDaoIT method testNodeDeleted.
// nodeDeleted: EventConstants.NODE_DELETED_EVENT_UEI
@Test
public void testNodeDeleted() {
MockNode node = m_network.getNode(1);
testElementDeleted(node);
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method restoresServiceStateOnRestart.
@Test
public void restoresServiceStateOnRestart() {
MockNode node = m_network.getNode(2);
MockService criticalService = m_network.getService(2, "192.168.1.3", "ICMP");
// Bring the critical service down
anticipateDown(node);
criticalService.bringDown();
// Start the poller
startDaemons();
// Verify
verifyAnticipated(10000);
// Stop the poller
stopDaemons();
// Bring the critical service up and expect a nodeUp
// The service should restore the proper state and know that the outage
// was triggered by a node down
anticipateUp(node);
criticalService.bringUp();
// (Re)start the poller
startDaemons();
// Verify
verifyAnticipated(10000);
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method testReparentCausesStatusChange.
// test open outages for unmanaged services
@Test
public void testReparentCausesStatusChange() {
m_pollerConfig.setNodeOutageProcessingEnabled(true);
MockNode node1 = m_network.getNode(1);
MockNode node2 = m_network.getNode(2);
MockInterface dotOne = m_network.getInterface(1, "192.168.1.1");
MockInterface dotTwo = m_network.getInterface(1, "192.168.1.2");
MockInterface dotThree = m_network.getInterface(2, "192.168.1.3");
//
// Plan to bring down both nodes except the reparented interface
// the node owning the interface should be up while the other is down
// after reparenting we should got the old owner go down while the other
// comes up.
//
anticipateDown(node2);
anticipateDown(dotOne);
// bring down both nodes but bring iface back up
node1.bringDown();
node2.bringDown();
dotTwo.bringUp();
Event reparentEvent = MockEventUtil.createReparentEvent("Test", "192.168.1.2", 1, 2);
startDaemons();
verifyAnticipated(2000);
m_db.reparentInterface(dotTwo.getIpAddr(), dotTwo.getNodeId(), node2.getNodeId());
dotTwo.moveTo(node2);
resetAnticipated();
anticipateDown(node1, true);
anticipateUp(node2, true);
anticipateDown(dotThree, true);
m_eventMgr.sendEventToListeners(reparentEvent);
verifyAnticipated(20000);
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method testNodeGainedServiceWhileNodeDownAndServiceDown.
@Test
public void testNodeGainedServiceWhileNodeDownAndServiceDown() {
startDaemons();
MockNode node = m_network.getNode(4);
MockService svc = m_network.getService(4, "192.168.1.6", "SNMP");
anticipateDown(node);
node.bringDown();
verifyAnticipated(5000);
resetAnticipated();
MockService newSvc = m_network.addService(4, "192.168.1.6", "SMTP");
m_db.writeService(newSvc);
newSvc.bringDown();
Event e = MockEventUtil.createNodeGainedServiceEvent("Test", newSvc);
m_eventMgr.sendEventToListeners(e);
sleep(5000);
System.err.println(m_db.getOutages());
verifyAnticipated(8000);
anticipateUp(node);
anticipateDown(svc, true);
newSvc.bringUp();
verifyAnticipated(5000);
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method testBug709.
@Test
public void testBug709() {
m_pollerConfig.setNodeOutageProcessingEnabled(true);
MockNode node = m_network.getNode(2);
MockService icmpService = m_network.getService(2, "192.168.1.3", "ICMP");
MockService httpService = m_network.getService(2, "192.168.1.3", "HTTP");
// start the poller
startDaemons();
//
// Bring Down the HTTP service and expect nodeLostService Event
//
resetAnticipated();
anticipateDown(httpService);
// bring down the HTTP service
httpService.bringDown();
verifyAnticipated(10000);
//
// Bring Down the ICMP (on the only interface on the node) now expect
// nodeDown
// only.
//
resetAnticipated();
anticipateDown(node);
// bring down the ICMP service
icmpService.bringDown();
// make sure the down events are received
// verifyAnticipated(10000);
sleep(5000);
//
// Bring up both the node and the httpService at the same time. Expect
// both a nodeUp and a nodeRegainedService
//
resetAnticipated();
// the order matters here
anticipateUp(httpService);
anticipateUp(node);
// bring up all the services on the node
node.bringUp();
// make sure the down events are received
verifyAnticipated(10000);
}
Aggregations