use of org.opennms.core.test.snmp.annotations.JUnitSnmpAgent in project opennms by OpenNMS.
the class InstanceStrategyIntegrationTest method testDynamicPackageConfig.
/*
* Test the behaviour when packages are not explicitely defined in the
* configuration file (i.e. dynamic packages) Verify: That the proper
* events are sent by the daemon.
*/
@Test
@JUnitSnmpAgent(host = "10.1.0.2", resource = SNMP_DATA_PATH + "10.1.0.2-walk.txt")
public void testDynamicPackageConfig() throws Exception {
// Add AP1 to a new package
addNewAccessPoint("ap1", AP1_MAC, "aruba-default-pkg");
// Add the controller in the same package
addNewController("amc1", "10.1.0.2", "aruba-default-pkg");
// Set the access point state
setOidValueForAccessPoint("10.1.0.2", AP1_MAC, 1);
// Anticipate the events
anticipateApStatusEvent(AP1_MAC, "UP");
// Initialize and start the daemon
initApmdWithConfig(getDynamicPackageConfig());
m_apm.start();
// The AP should be reported as UP even though the package is not
// explicitly defined
verifyAnticipated(POLLING_INTERVAL_DELTA);
// Delete AP1
OnmsAccessPoint ap1 = m_accessPointDao.get(AP1_MAC);
m_accessPointDao.delete(ap1);
m_accessPointDao.flush();
// Wait for the package scan to kick in
sleep(2000);
// Take the AP off-line
anticipateApStatusEvent(AP1_MAC, "DOWN");
// No event should be generated
sleep(POLLING_INTERVAL_DELTA);
assertEquals("Received unexpected events", 0, m_anticipator.getUnanticipatedEvents().size());
m_anticipator.reset();
}
Aggregations