<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-common</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
</plugin>
-
- <plugin>
+
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.table.miss.enforcer.rev140326;
+import java.util.concurrent.Callable;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.openflowplugin.applications.tableMissEnforcer.LLDPPacketPuntEnforcer;
+import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class LLDPPacketPuntEnforcerModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.table.miss.enforcer.rev140326.AbstractLLDPPacketPuntEnforcerModule {
+ private static final long STARTUP_LOOP_TICK = 500L;
+ private static final int STARTUP_LOOP_MAX_RETRIES = 8;
+ private static Logger LOG = LoggerFactory.getLogger(LLDPPacketPuntEnforcerModule.class);
+
public LLDPPacketPuntEnforcerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
@Override
public java.lang.AutoCloseable createInstance() {
- InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
- SalFlowService salFlowService = getRpcRegistryDependency().getRpcService(SalFlowService.class);
- return getDataBrokerDependency().registerDataChangeListener(
- LogicalDatastoreType.OPERATIONAL,
- path,
- new LLDPPacketPuntEnforcer(salFlowService),
- AsyncDataBroker.DataChangeScope.BASE);
+ final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
+ final SalFlowService salFlowService = getRpcRegistryDependency().getRpcService(SalFlowService.class);
+
+ ListenerRegistration<DataChangeListener> dataChangeListenerRegistration;
+ SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
+ try {
+ dataChangeListenerRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<DataChangeListener>>() {
+ @Override
+ public ListenerRegistration<DataChangeListener> call() throws Exception {
+ return getDataBrokerDependency().registerDataChangeListener(
+ LogicalDatastoreType.OPERATIONAL,
+ path,
+ new LLDPPacketPuntEnforcer(salFlowService),
+ AsyncDataBroker.DataChangeScope.BASE);
+ }
+ });
+ } catch (Exception e) {
+ LOG.warn("data listener registration failed: {}", e.getMessage());
+ LOG.debug("data listener registration failed.. ", e);
+ throw new IllegalStateException("LLDPPacketPuntEnforcer startup fail! System needs restart.", e);
+ }
+ return dataChangeListenerRegistration;
}
}
<groupId>org.opendaylight.openflowplugin.model</groupId>
<artifactId>model-flow-service</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-common</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
*/
package org.opendaylight.openflowplugin.applications.topology.manager;
+import java.util.concurrent.Callable;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class DataChangeListenerImpl implements DataChangeListener, AutoCloseable {
private final static Logger LOG = LoggerFactory.getLogger(DataChangeListenerImpl.class);
+ private static final long STARTUP_LOOP_TICK = 500L;
+ private static final int STARTUP_LOOP_MAX_RETRIES = 8;
protected final ListenerRegistration<DataChangeListener> dataChangeListenerRegistration;
protected OperationProcessor operationProcessor;
*/
public DataChangeListenerImpl(final OperationProcessor operationProcessor, final DataBroker dataBroker,
final InstanceIdentifier<?> ii) {
- dataChangeListenerRegistration = dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, ii,
- this, AsyncDataBroker.DataChangeScope.BASE);
+ SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
+ try {
+ dataChangeListenerRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<DataChangeListener>>() {
+ @Override
+ public ListenerRegistration<DataChangeListener> call() throws Exception {
+ return dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, ii,
+ DataChangeListenerImpl.this, AsyncDataBroker.DataChangeScope.BASE);
+
+ }
+ });
+ } catch (Exception e) {
+ LOG.warn("data listener registration failed: {}", e.getMessage());
+ LOG.debug("data listener registration failed.. ", e);
+ throw new IllegalStateException("TopologyManager startup fail! TM bundle needs restart.", e);
+ }
+
this.operationProcessor = operationProcessor;
}
<feature version="${mdsal.version}">odl-mdsal-broker</feature>
<feature version="${project.version}">odl-openflowplugin-nsf-services-li</feature>
<feature version="${openflowjava.version}">odl-openflowjava-protocol</feature>
+ <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-common/${project.version}</bundle>
<!-- TODO : remove dependency on openflowplugin in the future -->
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-impl/${project.version}</bundle>
<feature version="${mdsal.version}">odl-mdsal-broker</feature>
<feature version="${project.version}">odl-openflowplugin-nsf-model</feature>
<feature version="${openflowjava.version}">odl-openflowjava-protocol</feature>
+ <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-common/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-extension-api/${project.version}</bundle>
<connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
</scm>
-
+
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<groupId>org.opendaylight.openflowjava</groupId>
<artifactId>util</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin</groupId>
+ <artifactId>openflowplugin-common</artifactId>
+ </dependency>
</dependencies>
<build>
/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
+ * <p/>
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
protected static final Integer IDLE_TIMEOUT = 240;
protected static final short TABLE_ID = 0;
+ static final long STARTUP_LOOP_TICK = 500L;
+ static final int STARTUP_LOOP_MAX_RETRIES = 8;
+
private static final AtomicIntegerFieldUpdater<AbstractDropTest> SENT_UPDATER = AtomicIntegerFieldUpdater.newUpdater(AbstractDropTest.class, "sent");
private volatile int sent;
return new DropTestStats(this.sent, this.rcvd, this.excs);
}
- public final void clearStats(){
+ public final void clearStats() {
this.sent = 0;
this.rcvd = 0;
this.excs = 0;
package org.opendaylight.openflowplugin.testcommon;
import java.math.BigInteger;
+import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
* start listening on packetIn
*/
public void start() {
- notificationRegistration = notificationService.registerNotificationListener(this);
+ SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK,
+ STARTUP_LOOP_MAX_RETRIES);
+ try {
+ notificationRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<NotificationListener>>() {
+ @Override
+ public ListenerRegistration<NotificationListener> call() throws Exception {
+ return notificationService.registerNotificationListener(DropTestCommiter.this);
+ }
+ });
+ } catch (Exception e) {
+ LOG.warn("DropTest committer notification listener registration fail!");
+ LOG.debug("DropTest committer notification listener registration fail! ..", e);
+ throw new IllegalStateException("DropTest startup fail! Try again later.", e);
+ }
}
/**
*/
package org.opendaylight.openflowplugin.testcommon;
-import static org.opendaylight.openflowplugin.testcommon.AbstractDropTest.BUFFER_ID;
-import static org.opendaylight.openflowplugin.testcommon.AbstractDropTest.HARD_TIMEOUT;
-import static org.opendaylight.openflowplugin.testcommon.AbstractDropTest.IDLE_TIMEOUT;
-import static org.opendaylight.openflowplugin.testcommon.AbstractDropTest.PRIORITY;
-import static org.opendaylight.openflowplugin.testcommon.AbstractDropTest.TABLE_ID;
-
import java.math.BigInteger;
+import java.util.concurrent.Callable;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
* start listening on packetIn
*/
public void start() {
- notificationRegistration = notificationService.registerNotificationListener(this);
+ SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK,
+ STARTUP_LOOP_MAX_RETRIES);
+ try {
+ notificationRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<NotificationListener>>() {
+ @Override
+ public ListenerRegistration<NotificationListener> call() throws Exception {
+ return notificationService.registerNotificationListener(DropTestRpcSender.this);
+ }
+ });
+ } catch (Exception e) {
+ LOG.warn("DropTest sender notification listener registration fail!");
+ LOG.debug("DropTest sender notification listener registration fail! ..", e);
+ throw new IllegalStateException("DropTest startup fail! Try again later.", e);
+ }
}
@Override