Search in sources :

Example 1 with SimpleTaskRetryLooper

use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.

the class FlowForwarder method registrationListener.

@SuppressWarnings("IllegalCatch")
private void registrationListener(final DataBroker db) {
    final DataTreeIdentifier<Flow> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
    try {
        SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
        listenerRegistration = looper.loopUntilNoException(() -> db.registerDataTreeChangeListener(treeId, FlowForwarder.this));
    } catch (final Exception e) {
        LOG.warn("FRM Flow DataTreeChange listener registration fail!");
        LOG.debug("FRM Flow DataTreeChange listener registration fail ..", e);
        throw new IllegalStateException("FlowForwarder startup fail! System needs restart.", e);
    }
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) SimpleTaskRetryLooper(org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) StaleFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow)

Example 2 with SimpleTaskRetryLooper

use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.

the class LLDPPacketPuntEnforcer method start.

@SuppressWarnings("IllegalCatch")
public void start() {
    final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
    final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
    SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
    try {
        listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, LLDPPacketPuntEnforcer.this));
    } catch (Exception e) {
        throw new IllegalStateException("registerDataTreeChangeListener failed", e);
    }
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) SimpleTaskRetryLooper(org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)

Example 3 with SimpleTaskRetryLooper

use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.

the class DeviceMastershipManager method registerNodeListener.

@SuppressWarnings("IllegalCatch")
private void registerNodeListener() {
    final InstanceIdentifier<FlowCapableNode> flowNodeWildCardIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
    final DataTreeIdentifier<FlowCapableNode> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, flowNodeWildCardIdentifier);
    try {
        SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
        listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(treeId, DeviceMastershipManager.this));
    } catch (Exception e) {
        LOG.warn("Data listener registration failed: {}", e.getMessage());
        LOG.debug("Data listener registration failed ", e);
        throw new IllegalStateException("Node listener registration failed!", e);
    }
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) SimpleTaskRetryLooper(org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)

Example 4 with SimpleTaskRetryLooper

use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.

the class DefaultConfigPusher method start.

@SuppressWarnings("checkstyle:IllegalCatch")
public void start() {
    try {
        final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
        final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
        final SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
        listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, DefaultConfigPusher.this));
    } catch (Exception e) {
        LOG.error("DataTreeChangeListener registration failed: {}", e);
        throw new IllegalStateException("DefaultConfigPusher startup failed!", e);
    }
    LOG.info("DefaultConfigPusher has started.");
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) SimpleTaskRetryLooper(org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)

Aggregations

DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)4 SimpleTaskRetryLooper (org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper)4 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)3 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)3 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)1 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)1 StaleFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow)1