Exemplo n.º 1
0
  // test whole node down
  @Test
  public void testNodeOutageProcessingEnabled() throws Exception {

    m_pollerConfig.setNodeOutageProcessingEnabled(true);

    MockNode node = m_network.getNode(1);

    // start the poller
    startDaemons();

    resetAnticipated();
    anticipateDown(node);

    // brind down the node (duh)
    node.bringDown();

    // make sure the correct events are recieved
    verifyAnticipated(10000);

    resetAnticipated();
    anticipateUp(node);

    // bring the node back up
    node.bringUp();

    // make sure the up events are received
    verifyAnticipated(10000);
  }
Exemplo n.º 2
0
  @Test
  public void testNodeGainedServiceWhileNodeDownAndServiceUp() {

    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();

    anticipateUp(node);
    anticipateDown(svc, true);

    MockService newSvc = m_network.addService(4, "192.168.1.6", "SMTP");

    m_db.writeService(newSvc);

    Event e = MockEventUtil.createNodeGainedServiceEvent("Test", newSvc);
    m_eventMgr.sendEventToListeners(e);

    sleep(5000);
    System.err.println(m_db.getOutages());

    verifyAnticipated(8000);
  }
Exemplo n.º 3
0
  // 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);
  }
Exemplo n.º 4
0
  // test to see that node lost/regained service events come in
  @Test
  public void testNodeOutageProcessingDisabled() throws Exception {

    m_pollerConfig.setNodeOutageProcessingEnabled(false);

    MockNode node = m_network.getNode(1);

    startDaemons();

    resetAnticipated();
    anticipateServicesDown(node);

    node.bringDown();

    verifyAnticipated(10000);

    resetAnticipated();
    anticipateServicesUp(node);

    node.bringUp();

    verifyAnticipated(10000);
  }