Search in sources :

Example 1 with AdapterOperation

use of org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation 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 AdapterOperation

use of org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation 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)

Example 3 with AdapterOperation

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

the class RancidProvisioningAdapterIT method setUp.

@Before
public void setUp() throws Exception {
    NetworkBuilder nb = new NetworkBuilder();
    nb.addNode("test.example.com").setForeignSource("rancid").setForeignId("1");
    nb.addInterface("192.168.0.1");
    m_nodeDao.save(nb.getCurrentNode());
    m_nodeDao.flush();
    m_addOperation = m_adapter.new AdapterOperation(m_nodeDao.findByForeignId("rancid", "1").getId(), AdapterOperationType.ADD, new SimpleQueuedProvisioningAdapter.AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS));
    m_deleteOperation = m_adapter.new AdapterOperation(m_nodeDao.findByForeignId("rancid", "1").getId(), AdapterOperationType.DELETE, new SimpleQueuedProvisioningAdapter.AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS));
}
Also used : NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) AdapterOperation(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation) Before(org.junit.Before)

Example 4 with AdapterOperation

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

the class DnsProvisioningAdapterTest method setUp.

@Before
public void setUp() throws Exception {
    NetworkBuilder nb = new NetworkBuilder();
    nb.addNode("test.example.com").setForeignSource("dns").setForeignId("1");
    nb.addInterface("192.168.0.1");
    m_nodeDao.save(nb.getCurrentNode());
    m_nodeDao.flush();
    // Call afterPropertiesSet() again so that the adapter is 
    // aware of the node that we just added.
    m_adapter.afterPropertiesSet();
    m_addOperation = m_adapter.new AdapterOperation(m_nodeDao.findByForeignId("dns", "1").getId(), AdapterOperationType.ADD, new SimpleQueuedProvisioningAdapter.AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS));
    m_deleteOperation = m_adapter.new AdapterOperation(m_nodeDao.findByForeignId("dns", "1").getId(), AdapterOperationType.DELETE, new SimpleQueuedProvisioningAdapter.AdapterOperationSchedule(0, 1, 1, TimeUnit.SECONDS));
}
Also used : NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) AdapterOperation(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation) Before(org.junit.Before)

Aggregations

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