Search in sources :

Example 1 with ReadyRunnable

use of org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable in project opennms by OpenNMS.

the class EnhancedLinkd method deleteNode.

void deleteNode(int nodeid) {
    LOG.info("deleteNode: deleting LinkableNode for node {}", nodeid);
    Date now = new Date();
    BroadcastDomain domain = m_queryMgr.getBroadcastDomain(nodeid);
    LOG.debug("deleteNode: {}, found broadcast domain: nodes {}, macs {}", nodeid, domain.getBridgeNodesOnDomain(), domain.getMacsOnDomain());
    // must be calculated the topology for nodeid...
    domain.getLock(this);
    LOG.info("deleteNode: node: {}, start: merging topology for domain", nodeid);
    domain.clearTopologyForBridge(nodeid);
    LOG.info("deleteNode: node: {}, end: merging topology for domain", nodeid);
    LOG.info("deleteNode: node: {}, start: save topology for domain", nodeid);
    m_queryMgr.store(domain, now);
    LOG.info("deleteNode: node: {}, end: save topology for domain", nodeid);
    domain.removeBridge(nodeid);
    domain.releaseLock(this);
    Node node = removeNode(nodeid);
    if (node == null) {
        LOG.warn("deleteNode: node not found: {}", nodeid);
    } else {
        Collection<NodeDiscovery> collections = getSnmpCollections(node);
        LOG.info("deleteNode: fetched SnmpCollections from scratch, iterating over {} objects to delete", collections.size());
        for (NodeDiscovery collection : collections) {
            ReadyRunnable rr = getReadyRunnable(collection);
            if (rr == null) {
                LOG.warn("deleteNode: found null ReadyRunnable");
                continue;
            } else {
                rr.unschedule();
            }
        }
        NodeDiscovery topology = getNodeBridgeDiscoveryTopology(node);
        ReadyRunnable rr = getReadyRunnable(topology);
        if (rr == null) {
            LOG.warn("deleteNode: found null ReadyRunnable");
        } else {
            rr.unschedule();
        }
    }
    m_queryMgr.delete(nodeid);
    m_queryMgr.cleanBroadcastDomains();
}
Also used : BroadcastDomain(org.opennms.netmgt.model.topology.BroadcastDomain) ReadyRunnable(org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable) Date(java.util.Date)

Example 2 with ReadyRunnable

use of org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable in project opennms by OpenNMS.

the class EnhancedLinkd method rescheduleNodeCollection.

void rescheduleNodeCollection(int nodeid) {
    LOG.info("rescheduleNodeCollection: suspend collection LinkableNode for node {}", nodeid);
    Node node = getNode(nodeid);
    if (node == null) {
        LOG.warn("rescheduleNodeCollection: node not found: {}", nodeid);
    } else {
        Collection<NodeDiscovery> collections = getSnmpCollections(node);
        LOG.info("rescheduleNodeCollection: fetched SnmpCollections from scratch, iterating over {} objects to rescheduling", collections.size());
        for (NodeDiscovery collection : collections) {
            ReadyRunnable rr = getReadyRunnable(collection);
            if (rr == null) {
                LOG.warn("rescheduleNodeCollection: found null ReadyRunnable");
                continue;
            } else {
                rr.unschedule();
                rr.schedule();
            }
        }
    }
}
Also used : ReadyRunnable(org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable)

Example 3 with ReadyRunnable

use of org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable in project opennms by OpenNMS.

the class EnhancedLinkd method wakeUpNodeCollection.

void wakeUpNodeCollection(int nodeid) {
    Node node = getNode(nodeid);
    if (node == null) {
        LOG.warn("wakeUpNodeCollection: node not found during scheduling with ID {}", nodeid);
        scheduleNodeCollection(nodeid);
    } else {
        // get collections
        // get readyRunnuble
        // wakeup RR
        Collection<NodeDiscovery> collections = getSnmpCollections(node);
        LOG.info("wakeUpNodeCollection: fetched SnmpCollections from scratch, iterating over {} objects to wake them up", collections.size());
        for (NodeDiscovery collection : collections) {
            ReadyRunnable rr = getReadyRunnable(collection);
            if (rr == null) {
                LOG.warn("wakeUpNodeCollection: found null ReadyRunnable for nodeid {}", nodeid);
                continue;
            } else {
                rr.wakeUp();
            }
        }
    }
}
Also used : ReadyRunnable(org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable)

Example 4 with ReadyRunnable

use of org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable in project opennms by OpenNMS.

the class EnhancedLinkd method suspendNodeCollection.

void suspendNodeCollection(int nodeid) {
    LOG.info("suspendNodeCollection: suspend collection LinkableNode for node {}", nodeid);
    Node node = getNode(nodeid);
    if (node == null) {
        LOG.warn("suspendNodeCollection: found null ReadyRunnable");
    } else {
        // get collections
        // get readyRunnuble
        // suspend RR
        Collection<NodeDiscovery> collections = getSnmpCollections(node);
        LOG.info("suspendNodeCollection: fetched SnmpCollections from scratch, iterating over {} objects to suspend them down", collections.size());
        for (NodeDiscovery collection : collections) {
            ReadyRunnable rr = getReadyRunnable(collection);
            if (rr == null) {
                LOG.warn("suspendNodeCollection: suspend: node not found: {}", nodeid);
                continue;
            } else {
                rr.suspend();
            }
        }
    }
}
Also used : ReadyRunnable(org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable)

Aggregations

ReadyRunnable (org.opennms.netmgt.enlinkd.scheduler.ReadyRunnable)4 Date (java.util.Date)1 BroadcastDomain (org.opennms.netmgt.model.topology.BroadcastDomain)1