import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.PostConstruct;
import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationNotificationListener;
import org.opendaylight.serviceutils.upgrade.UpgradeState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.MessagesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.MessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleRemoveFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleRemoveFlowCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleRemoveGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.BundleRemoveGroupCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.bundle.remove.flow._case.RemoveFlowCaseDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.bundle.inner.message.grouping.bundle.inner.message.bundle.remove.group._case.RemoveGroupCaseDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.GetActiveBundleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.GetActiveBundleOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
+import org.opendaylight.yangtools.util.concurrent.FluentFutures;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcError;
private static final String SERVICE_NAME = "ArbitratorReconciliationManager";
private static final String SEPARATOR = ":";
+ private static final BundleRemoveFlowCase DELETE_ALL_FLOW = new BundleRemoveFlowCaseBuilder()
+ .setRemoveFlowCaseData(
+ new RemoveFlowCaseDataBuilder(new FlowBuilder().setTableId(OFConstants.OFPTT_ALL).build()).build())
+ .build();
+ private static final BundleRemoveGroupCase DELETE_ALL_GROUP = new BundleRemoveGroupCaseBuilder()
+ .setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder(new GroupBuilder()
+ .setGroupType(GroupTypes.GroupAll)
+ .setGroupId(new GroupId(OFConstants.OFPG_ALL))
+ .build()).build())
+ .build();
+
private final SalBundleService salBundleService;
private final ReconciliationManager reconciliationManager;
private final RoutedRpcRegistration routedRpcReg;
private final UpgradeState upgradeState;
private NotificationRegistration registration;
- private final ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
+ private final ListeningExecutorService executor = MoreExecutors.listeningDecorator(
+ Executors.newFixedThreadPool(THREAD_POOL_SIZE));
private final Map<Uint64, BundleDetails> bundleIdMap = new ConcurrentHashMap<>();
@Inject
return reconcileConfiguration(node);
}
LOG.trace("arbitrator reconciliation is disabled");
- return Futures.immediateFuture(true);
+ return FluentFutures.immediateTrueFluentFuture();
}
@Override
LOG.trace("Stopping arbitrator reconciliation for node {}", datapathId);
bundleIdMap.remove(datapathId);
deregisterRpc(node);
- return Futures.immediateFuture(true);
+ return FluentFutures.immediateTrueFluentFuture();
}
@Override
private ListenableFuture<Boolean> reconcileConfiguration(DeviceInfo node) {
LOG.info("Triggering arbitrator reconciliation for device {}", node.getDatapathId());
ArbitratorReconciliationTask upgradeReconTask = new ArbitratorReconciliationTask(node);
- return JdkFutureAdapters.listenInPoolThread(executor.submit(upgradeReconTask));
+ return executor.submit(upgradeReconTask);
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
private Messages createMessages(final NodeRef nodeRef) {
final List<Message> messages = new ArrayList<>();
- messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(
- new BundleRemoveFlowCaseBuilder()
- .setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder(getDeleteAllFlow()).build())
- .build()).build());
-
- messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(
- new BundleRemoveGroupCaseBuilder()
- .setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder(getDeleteAllGroup()).build())
- .build()).build());
+ messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(DELETE_ALL_FLOW).build());
+ messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(DELETE_ALL_GROUP).build());
LOG.debug("The size of the flows and group messages created in createMessage() {}", messages.size());
return new MessagesBuilder().setMessage(messages).build();
}
- private Flow getDeleteAllFlow() {
- final FlowBuilder flowBuilder = new FlowBuilder();
- flowBuilder.setTableId(OFConstants.OFPTT_ALL);
- return flowBuilder.build();
- }
-
- private Group getDeleteAllGroup() {
- final GroupBuilder groupBuilder = new GroupBuilder();
- groupBuilder.setGroupType(GroupTypes.GroupAll);
- groupBuilder.setGroupId(new GroupId(OFConstants.OFPG_ALL));
- return groupBuilder.build();
- }
-
private class ArbitratorReconciliationTask implements Callable<Boolean> {
final DeviceInfo deviceInfo;
return salBundleService
.addBundleMessages(addBundleMessagesInput);
}
- return Futures.immediateFuture(null);
+ return FluentFutures.immediateNullFluentFuture();
}, MoreExecutors.directExecutor());
Uint64 nodeId = getDpnIdFromNodeName(node);
try {
if (addBundleMessagesFuture.get().isSuccessful()) {
bundleIdMap.put(nodeId, new BundleDetails(bundleIdValue,
- Futures.immediateFuture(null)));
+ FluentFutures.immediateNullFluentFuture()));
LOG.debug("Arbitrator reconciliation initial task has been completed for node {} and open up"
+ " for application programming.", nodeId);
return true;
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
AddFlowInput addFlowInput = builder.build();
- LOG.debug("RPC invocation for adding flow-id {} with input {}", flowId, addFlowInput.toString());
+ LOG.debug("RPC invocation for adding flow-id {} with input {}", flowId, addFlowInput);
LoggingFutures.addErrorLogging(flowService.addFlow(addFlowInput), LOG, "addFlow");
if (i % batchSize == 0) {
@Override
public void createStaleMarkEntity(InstanceIdentifier<Flow> identifier, Flow del,
InstanceIdentifier<FlowCapableNode> nodeIdent) {
- LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent.toString(), del.toString());
+ LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent, del);
StaleFlow staleFlow = makeStaleFlow(identifier, del, nodeIdent);
persistStaleFlow(staleFlow, nodeIdent);
}
getFlowId(addFlowInput.getFlowRef()), nodeId);
} else {
LOG.error("Flow add with id {} failed for node {} with error {}", getFlowId(addFlowInput.getFlowRef()),
- nodeId, rpcResult.getErrors().toString());
+ nodeId, rpcResult.getErrors());
resultFuture.set(RpcResultBuilder.<AddFlowOutput>failed()
.withRpcErrors(rpcResult.getErrors()).build());
}
getFlowId(updateFlowInput.getFlowRef()), nodeId);
} else {
LOG.error("Flow update with id {} failed for node {} with error {}",
- getFlowId(updateFlowInput.getFlowRef()), nodeId, rpcResult.getErrors().toString());
+ getFlowId(updateFlowInput.getFlowRef()), nodeId, rpcResult.getErrors());
resultFuture.set(RpcResultBuilder.<UpdateFlowOutput>failed()
.withRpcErrors(rpcResult.getErrors()).build());
}
@Override
public ListenableFuture<RpcResult<ReconcileNodeOutput>> reconcileNode(ReconcileNodeInput input) {
- LOG.debug("Triggering reconciliation for node: {}", input.getNodeId().toString());
+ LOG.debug("Triggering reconciliation for node: {}", input.getNodeId());
Node nodeDpn = buildNode(input.getNodeId().longValue());
InstanceIdentifier<FlowCapableNode> connectedNode = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, nodeDpn.key()).augmentation(FlowCapableNode.class).build();
.getNodeListener().reconcileConfiguration(connectedNode);
Futures.addCallback(futureResult, new ResultCallBack(futureResult, rpcResult),
MoreExecutors.directExecutor());
- LOG.debug("Completing reconciliation for node: {}", input.getNodeId().toString());
+ LOG.debug("Completing reconciliation for node: {}", input.getNodeId());
return rpcResult;
}
@Override
public void createStaleMarkEntity(InstanceIdentifier<Group> identifier, Group del,
InstanceIdentifier<FlowCapableNode> nodeIdent) {
- LOG.debug("Creating Stale-Mark entry for the switch {} for Group {} ", nodeIdent.toString(), del.toString());
+ LOG.debug("Creating Stale-Mark entry for the switch {} for Group {} ", nodeIdent, del);
StaleGroup staleGroup = makeStaleGroup(identifier, del, nodeIdent);
persistStaleGroup(staleGroup, nodeIdent);
@Override
public void createStaleMarkEntity(InstanceIdentifier<Meter> identifier, Meter del,
InstanceIdentifier<FlowCapableNode> nodeIdent) {
- LOG.debug("Creating Stale-Mark entry for the switch {} for meter {} ", nodeIdent.toString(), del.toString());
+ LOG.debug("Creating Stale-Mark entry for the switch {} for meter {} ", nodeIdent, del);
StaleMeter staleMeter = makeStaleMeter(del);
persistStaleMeter(staleMeter, nodeIdent);
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>karaf4-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
</parent>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-karaf</artifactId>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>5.0.3</version>
+ <version>5.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
// Empty request case
}
case multipart-request-meter-stats {
- leaf meter-id {
+ leaf stat-meter-id {
type meter-types:meter-id;
}
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>5.0.3</version>
+ <version>5.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
*/
package org.opendaylight.openflowjava.protocol.api.connection;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error;
public DeviceRequestFailedException(final String message, @NonNull final Error error) {
super(message);
- this.error = Preconditions.checkNotNull(error);
+ this.error = requireNonNull(error);
}
public DeviceRequestFailedException(final String message, @NonNull final Error error, final Throwable cause) {
super(message, cause);
- this.error = Preconditions.checkNotNull(error);
+ this.error = requireNonNull(error);
}
@NonNull public Error getError() {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;
*/
public DelegatingInboundHandler(final MessageConsumer connectionAdapter) {
LOG.trace("Creating DelegatingInboundHandler");
- consumer = Preconditions.checkNotNull(connectionAdapter);
+ consumer = requireNonNull(connectionAdapter);
}
@Override
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import io.netty.bootstrap.Bootstrap;
* @param workerGroup - shared worker group
*/
public TcpConnectionInitializer(EventLoopGroup workerGroup, boolean isEpollEnabled) {
- Preconditions.checkNotNull(workerGroup, "WorkerGroup can't be null");
- this.workerGroup = workerGroup;
+ this.workerGroup = requireNonNull(workerGroup, "WorkerGroup can't be null");
this.isEpollEnabled = isEpollEnabled;
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import io.netty.buffer.ByteBuf;
/**
*/
public VersionMessageWrapper(final short version, final ByteBuf messageBuffer) {
this.version = version;
- this.messageBuffer = Preconditions.checkNotNull(messageBuffer);
+ this.messageBuffer = requireNonNull(messageBuffer);
}
/**
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalCause;
AbstractConnectionAdapter(@NonNull final Channel channel, @Nullable final InetSocketAddress address,
@Nullable final int channelOutboundQueueSize) {
- this.channel = Preconditions.checkNotNull(channel);
+ this.channel = requireNonNull(channel);
this.address = address;
responseCache = CacheBuilder.newBuilder().concurrencyLevel(1)
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.concurrent.Future;
protected final Runnable flushRunnable = this::flush;
AbstractOutboundQueueManager(final ConnectionAdapterImpl parent, final InetSocketAddress address, final T handler) {
- this.parent = Preconditions.checkNotNull(parent);
- this.handler = Preconditions.checkNotNull(handler);
+ this.parent = requireNonNull(parent);
+ this.handler = requireNonNull(handler);
this.address = address;
/* Note: don't wish to use reflection here */
currentQueue = initializeStackedOutboudnqueue();
* selected by communication pipeline.
*/
protected Object makeMessageListenerWrapper(@NonNull final OfHeader msg) {
- Preconditions.checkArgument(msg != null);
-
+ checkArgument(msg != null);
if (address == null) {
return new MessageListenerWrapper(msg, LOG_ENCODER_LISTENER);
}
*/
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import io.netty.util.concurrent.Future;
}
AbstractRpcListener(final Object message, final String failureInfo) {
- this.failureInfo = Preconditions.checkNotNull(failureInfo);
- this.message = Preconditions.checkNotNull(message);
+ this.failureInfo = requireNonNull(failureInfo);
+ this.message = requireNonNull(message);
}
public final ListenableFuture<RpcResult<T>> getResult() {
@Override
public final Object takeMessage() {
final Object ret = message;
- Preconditions.checkState(ret != null, "Message has already been taken");
+ checkState(ret != null, "Message has already been taken");
message = null;
return ret;
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.FutureCallback;
import io.netty.channel.Channel;
import java.util.ArrayList;
protected final AbstractOutboundQueueManager<?, ?> manager;
AbstractStackedOutboundQueue(final AbstractOutboundQueueManager<?, ?> manager) {
- this.manager = Preconditions.checkNotNull(manager);
+ this.manager = requireNonNull(manager);
firstSegment = StackedSegment.create(0L);
uncompletedSegments.add(firstSegment);
unflushedSegments.add(firstSegment);
// Ensure we have the appropriate segment for the specified XID
final StackedSegment slowSegment = firstSegment;
final int slowOffset = (int) (xid - slowSegment.getBaseXid());
- Verify.verify(slowOffset >= 0);
+ verify(slowOffset >= 0);
// Now, we let's see if we need to allocate a new segment
ensureSegment(slowSegment, slowOffset);
protected OutboundQueueEntry getEntry(final Long xid) {
final StackedSegment fastSegment = firstSegment;
final long calcOffset = xid - fastSegment.getBaseXid();
- Preconditions.checkArgument(calcOffset >= 0, "Commit of XID %s does not match up with base XID %s",
+ checkArgument(calcOffset >= 0, "Commit of XID %s does not match up with base XID %s",
xid, fastSegment.getBaseXid());
- Verify.verify(calcOffset <= Integer.MAX_VALUE);
+ verify(calcOffset <= Integer.MAX_VALUE);
final int fastOffset = (int) calcOffset;
if (fastOffset >= StackedSegment.SEGMENT_SIZE) {
synchronized (unflushedSegments) {
final StackedSegment slowSegment = firstSegment;
final long slowCalcOffset = xid - slowSegment.getBaseXid();
- Verify.verify(slowCalcOffset >= 0 && slowCalcOffset <= Integer.MAX_VALUE);
+ verify(slowCalcOffset >= 0 && slowCalcOffset <= Integer.MAX_VALUE);
slowOffset = (int) slowCalcOffset;
LOG.debug("Queue {} recalculated offset of XID {} to {}", this, xid, slowOffset);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
private final InetSocketAddress address;
ChannelOutboundQueue(final Channel channel, final int queueDepth, final InetSocketAddress address) {
- Preconditions.checkArgument(queueDepth > 0, "Queue depth has to be positive");
+ checkArgument(queueDepth > 0, "Queue depth has to be positive");
/*
* This looks like a good trade-off for throughput. Alternative is
* to less throughput.
*/
this.queue = new LinkedBlockingQueue<>(queueDepth);
- this.channel = Preconditions.checkNotNull(channel);
+ this.channel = requireNonNull(channel);
this.maxWorkTime = TimeUnit.MICROSECONDS.toNanos(DEFAULT_WORKTIME_MICROS);
this.address = address;
}
}
private void conditionalFlush(final ChannelHandlerContext ctx) {
- Preconditions.checkState(ctx.channel().equals(channel),
- "Inconsistent channel %s with context %s", channel, ctx);
+ checkState(ctx.channel().equals(channel), "Inconsistent channel %s with context %s", channel, ctx);
conditionalFlush();
}
*/
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.cache.Cache;
import java.util.concurrent.TimeoutException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
ResponseExpectedRpcListener(final Object message, final String failureInfo,
final Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache, final RpcResponseKey key) {
super(message, failureInfo);
- this.cache = Preconditions.checkNotNull(cache);
- this.key = Preconditions.checkNotNull(key);
+ this.cache = requireNonNull(cache);
+ this.key = requireNonNull(key);
}
public void discard() {
*/
package org.opendaylight.openflowjava.protocol.impl.core.connection;
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.FinalizableReferenceQueue;
import com.google.common.base.FinalizableSoftReference;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import java.lang.ref.Reference;
import java.util.concurrent.ConcurrentLinkedDeque;
import org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException;
StackedSegment(final long baseXid, final OutboundQueueEntry[] entries) {
this.baseXid = baseXid;
this.endXid = baseXid + SEGMENT_SIZE;
- this.entries = Preconditions.checkNotNull(entries);
+ this.entries = requireNonNull(entries);
}
static StackedSegment create(final long baseXid) {
lastBarrierOffset = offset;
final boolean success = completeEntry(entry, response);
- Verify.verify(success, "Barrier request failed to complete");
+ verify(success, "Barrier request failed to complete");
completeCount++;
} else if (completeEntry(entry, response)) {
completeCount++;
@Override
public void serialize(final MultipartRequestMeterStats multipartRequestMeterStats, final ByteBuf byteBuf) {
byteBuf.writeInt(MoreObjects
- .firstNonNull(multipartRequestMeterStats.getMeterId(), new MeterId(OFConstants.OFPM_ALL))
+ .firstNonNull(multipartRequestMeterStats.getStatMeterId(), new MeterId(OFConstants.OFPM_ALL))
.getValue().intValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_BODY);
}
.setVersion(getVersion())
.setRequestMore(false)
.setMultipartRequestBody(new MultipartRequestMeterStatsBuilder()
- .setMeterId(input.getMeterId())
+ .setStatMeterId(input.getMeterId())
.build())
.build();
}
private static final byte PADDING_IN_MULTIPART_REQUEST_METER_BODY = 4;
private static final long METER_ID = 42;
private static final MultipartRequestMeterStats BODY = new MultipartRequestMeterStatsBuilder()
- .setMeterId(new MeterId(METER_ID))
+ .setStatMeterId(new MeterId(METER_ID))
.build();
private MultipartRequestMeterStatsSerializer serializer;
assertEquals(out.readableBytes(), 0);
}
-}
\ No newline at end of file
+}
.buildRequest(new Xid(Uint32.valueOf(42L)), input))
.getMultipartRequestBody();
- assertEquals(METER_NO, body.getMeterId().getValue());
+ assertEquals(METER_NO, body.getStatMeterId().getValue());
}
@Override
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>5.0.3</version>
+ <version>5.0.4</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>6.0.0</version>
+ <version>6.0.1</version>
<relativePath/>
</parent>
*/
package org.opendaylight.openflowjava.protocol.impl.clients;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.SettableFuture;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.EventLoopGroup;
import java.util.concurrent.Callable;
import org.slf4j.LoggerFactory;
-
/**
* Callable client class, inspired by SimpleClient class.
* Simulating device/switch connected to controller.
final ScenarioHandler scenarioHandler,
final Bootstrap bootstrap,
final EventLoopGroup eventExecutors) {
-
- Preconditions.checkNotNull(ipAddress, "IP address cannot be null");
- Preconditions.checkNotNull(scenarioHandler, "Scenario handler cannot be null");
this.port = port;
this.securedClient = securedClient;
- this.ipAddress = ipAddress;
+ this.ipAddress = requireNonNull(ipAddress, "IP address cannot be null");
this.workerGroup = eventExecutors;
this.bootstrap = bootstrap;
this.name = name;
- this.scenarioHandler = scenarioHandler;
+ this.scenarioHandler = requireNonNull(scenarioHandler, "Scenario handler cannot be null");
}
@Override
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public Boolean call() throws Exception {
- Preconditions.checkNotNull(bootstrap);
- Preconditions.checkNotNull(workerGroup);
+ requireNonNull(bootstrap);
+ requireNonNull(workerGroup);
LOG.info("Switch {} trying connect to controller", this.name);
SimpleClientInitializer clientInitializer = new SimpleClientInitializer(isOnlineFuture, securedClient);
clientInitializer.setScenario(scenarioHandler);