Search in sources :

Example 1 with OnmsIpInterfaceRequisition

use of org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition in project opennms by OpenNMS.

the class ProvisionerIT method testDnsVisit.

/**
     * We have to ignore this test until there is a DNS service available in the test harness
     * 
     * @throws ForeignSourceRepositoryException
     * @throws MalformedURLException
     */
@Test(timeout = 300000)
@JUnitDNSServer(port = 9153, zones = { @DNSZone(name = "opennms.com.", v4address = "1.2.3.4", entries = { @DNSEntry(hostname = "www", address = "1.2.3.4") }) })
public void testDnsVisit() throws ForeignSourceRepositoryException, MalformedURLException {
    final Requisition requisition = m_foreignSourceRepository.importResourceRequisition(new UrlResource("dns://localhost:9153/opennms.com"));
    final CountingVisitor visitor = new CountingVisitor() {

        @Override
        public void visitNode(final OnmsNodeRequisition req) {
            LOG.debug("visitNode: {}/{} {}", req.getForeignSource(), req.getForeignId(), req.getNodeLabel());
            m_nodes.add(req);
            m_nodeCount++;
        }

        @Override
        public void visitInterface(final OnmsIpInterfaceRequisition req) {
            LOG.debug("visitInterface: {}", req.getIpAddr());
            m_ifaces.add(req);
            m_ifaceCount++;
        }
    };
    requisition.visit(visitor);
    verifyDnsImportCounts(visitor);
}
Also used : OnmsIpInterfaceRequisition(org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition) UrlResource(org.springframework.core.io.UrlResource) OnmsNodeCategoryRequisition(org.opennms.netmgt.provision.persist.OnmsNodeCategoryRequisition) OnmsNodeRequisition(org.opennms.netmgt.provision.persist.OnmsNodeRequisition) Requisition(org.opennms.netmgt.provision.persist.requisition.Requisition) OnmsMonitoredServiceRequisition(org.opennms.netmgt.provision.persist.OnmsMonitoredServiceRequisition) OnmsServiceCategoryRequisition(org.opennms.netmgt.provision.persist.OnmsServiceCategoryRequisition) OnmsIpInterfaceRequisition(org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition) OnmsAssetRequisition(org.opennms.netmgt.provision.persist.OnmsAssetRequisition) OnmsNodeRequisition(org.opennms.netmgt.provision.persist.OnmsNodeRequisition) JUnitDNSServer(org.opennms.core.test.dns.annotations.JUnitDNSServer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 JUnitDNSServer (org.opennms.core.test.dns.annotations.JUnitDNSServer)1 OnmsAssetRequisition (org.opennms.netmgt.provision.persist.OnmsAssetRequisition)1 OnmsIpInterfaceRequisition (org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition)1 OnmsMonitoredServiceRequisition (org.opennms.netmgt.provision.persist.OnmsMonitoredServiceRequisition)1 OnmsNodeCategoryRequisition (org.opennms.netmgt.provision.persist.OnmsNodeCategoryRequisition)1 OnmsNodeRequisition (org.opennms.netmgt.provision.persist.OnmsNodeRequisition)1 OnmsServiceCategoryRequisition (org.opennms.netmgt.provision.persist.OnmsServiceCategoryRequisition)1 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)1 UrlResource (org.springframework.core.io.UrlResource)1