Search in sources :

Example 1 with AdapterOperationSchedule

use of org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperationSchedule in project opennms by OpenNMS.

the class SnmpHardwareInventoryProvisioningAdapterIT method setUp.

/**
     * Sets the up.
     *
     * @throws Exception the exception
     */
@BeforeTransaction
public void setUp() throws Exception {
    MockLogAppender.setupLogging(true);
    NetworkBuilder nb = new NetworkBuilder();
    nb.addNode("R1").setForeignSource("Cisco").setForeignId("1").setSysObjectId(".1.3.6.1.4.1.9.1.222");
    nb.addInterface("192.168.0.1").setIsSnmpPrimary("P").setIsManaged("P");
    m_nodeDao.save(nb.getCurrentNode());
    nb.addNode("R2").setForeignSource("Cisco").setForeignId("2").setSysObjectId(".1.3.6.1.4.1.9.1.222");
    nb.addInterface("192.168.0.2").setIsSnmpPrimary("P").setIsManaged("P");
    m_nodeDao.save(nb.getCurrentNode());
    nb.addNode("R3").setForeignSource("Cisco").setForeignId("3").setSysObjectId(".1.3.6.1.4.1.9.1.222");
    nb.addInterface("192.168.0.3").setIsSnmpPrimary("P").setIsManaged("P");
    m_nodeDao.save(nb.getCurrentNode());
    nb.addNode("R4").setForeignSource("Cisco").setForeignId("4").setSysObjectId(".1.3.6.1.4.1.9.1.222");
    nb.addInterface("192.168.0.4").setIsSnmpPrimary("P").setIsManaged("P");
    m_nodeDao.save(nb.getCurrentNode());
    m_nodeDao.flush();
    m_adapter.afterPropertiesSet();
    for (int i = 1; i <= 4; i++) {
        Integer nodeId = m_nodeDao.findByForeignId("Cisco", Integer.toString(i)).getId();
        AdapterOperationSchedule ops = new AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS);
        AdapterOperation op = m_adapter.new AdapterOperation(nodeId, AdapterOperationType.ADD, ops);
        m_operations.add(new TestOperation(nodeId, op));
    }
}
Also used : NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) AdapterOperationSchedule(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperationSchedule) AdapterOperation(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation) BeforeTransaction(org.springframework.test.context.transaction.BeforeTransaction)

Example 2 with AdapterOperationSchedule

use of org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperationSchedule in project opennms by OpenNMS.

the class AbstractSingleHardwareAdapterTest method setUp.

/**
     * Sets the up.
     *
     * @throws Exception the exception
     */
@BeforeTransaction
public void setUp() throws Exception {
    MockLogAppender.setupLogging(true);
    NetworkBuilder nb = new NetworkBuilder();
    nb.addNode("Test").setForeignSource("Test").setForeignId("1").setSysObjectId(".1.3.6.1.4.1.9.1.1196");
    nb.addInterface("192.168.0.1").setIsSnmpPrimary("P").setIsManaged("P");
    m_nodeDao.save(nb.getCurrentNode());
    m_nodeDao.flush();
    m_adapter.afterPropertiesSet();
    m_nodeId = m_nodeDao.findByForeignId("Test", "1").getId();
    AdapterOperationSchedule ops = new AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS);
    m_operation = m_adapter.new AdapterOperation(m_nodeId, AdapterOperationType.ADD, ops);
}
Also used : NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) AdapterOperationSchedule(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperationSchedule) AdapterOperation(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation) BeforeTransaction(org.springframework.test.context.transaction.BeforeTransaction)

Aggregations

NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)2 AdapterOperation (org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation)2 AdapterOperationSchedule (org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperationSchedule)2 BeforeTransaction (org.springframework.test.context.transaction.BeforeTransaction)2