package org.opendaylight.openflowplugin.applications.frm.impl;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.openflowplugin.applications.frm.ForwardingRulesManager;
import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleFlowInstanceIdentifier(staleFlow, nodeIdent),
staleFlow, false);
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleFlowResultFuture(submitFuture);
}
- private void handleStaleFlowResultFuture(CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
+ private void handleStaleFlowResultFuture(ListenableFuture<Void> submitFuture) {
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.JdkFutureAdapters;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.applications.frm.FlowNodeReconciliation;
connectedNode.toString());
reconciliationPreProcess(connectedNode);
}
- LOG.debug("Bundle based reconciliation status : {}",
- provider.isBundleBasedReconciliationEnabled() ? "Enable" : "Disable");
if (provider.isBundleBasedReconciliationEnabled()) {
BundleBasedReconciliationTask bundleBasedReconTask = new BundleBasedReconciliationTask(connectedNode);
return JdkFutureAdapters.listenInPoolThread(executor.submit(bundleBasedReconTask));
Optional<FlowCapableNode> flowNode = Optional.absent();
BundleId bundleIdValue = new BundleId(BUNDLE_ID.getAndIncrement());
BigInteger dpnId = getDpnIdFromNodeName(node);
- LOG.debug("Triggering bundle based reconciliation for device :{}", dpnId);
+ LOG.info("Triggering bundle based reconciliation for device : {}", dpnId);
ReadOnlyTransaction trans = provider.getReadTranaction();
try {
flowNode = trans.read(LogicalDatastoreType.CONFIGURATION, nodeIdentity).get();
LOG.debug("FlowNode present for Datapath ID {}", dpnId);
final NodeRef nodeRef = new NodeRef(nodeIdentity.firstIdentifierOf(Node.class));
+ final ControlBundleInput closeBundleInput = new ControlBundleInputBuilder().setNode(nodeRef)
+ .setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS)
+ .setType(BundleControlType.ONFBCTCLOSEREQUEST).build();
+
final ControlBundleInput openBundleInput = new ControlBundleInputBuilder().setNode(nodeRef)
.setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS).setType(BundleControlType.ONFBCTOPENREQUEST)
.build();
.setNode(nodeRef).setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS)
.setMessages(createMessages(nodeRef, flowNode)).build();
- ListenableFuture<RpcResult<ControlBundleOutput>> openBundle
- = salBundleService.controlBundle(openBundleInput);
+ /* Close previously opened bundle on the openflow switch if any */
+ ListenableFuture<RpcResult<ControlBundleOutput>> closeBundle
+ = salBundleService.controlBundle(closeBundleInput);
- ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessagesFuture = Futures
- .transformAsync(JdkFutureAdapters.listenInPoolThread(openBundle), rpcResult -> {
+ /* Open a new bundle on the switch */
+ ListenableFuture<RpcResult<ControlBundleOutput>> openBundle =
+ Futures.transformAsync(closeBundle,
+ rpcResult -> salBundleService.controlBundle(openBundleInput),
+ MoreExecutors.directExecutor());
+
+ /* Push groups and flows via bundle add messages */
+ ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessagesFuture
+ = Futures.transformAsync(openBundle, rpcResult -> {
if (rpcResult.isSuccessful()) {
- return JdkFutureAdapters
- .listenInPoolThread(salBundleService.addBundleMessages(addBundleMessagesInput));
+ return salBundleService.addBundleMessages(addBundleMessagesInput);
}
return Futures.immediateFuture(null);
}, MoreExecutors.directExecutor());
+
+ /* Commit the bundle on the openflow switch */
ListenableFuture<RpcResult<ControlBundleOutput>> commitBundleFuture
= Futures.transformAsync(addBundleMessagesFuture, rpcResult -> {
if (rpcResult.isSuccessful()) {
- return JdkFutureAdapters
- .listenInPoolThread(salBundleService.controlBundle(commitBundleInput));
+ return salBundleService.controlBundle(commitBundleInput);
}
return Futures.immediateFuture(null);
}, MoreExecutors.directExecutor());
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleFlowIId);
}
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleEntityDeletionResultFuture(submitFuture);
}
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleGroupIId);
}
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleEntityDeletionResultFuture(submitFuture);
}
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleMeterIId);
}
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleEntityDeletionResultFuture(submitFuture);
}
return nodeIdent.child(StaleMeter.class, new StaleMeterKey(new MeterId(staleMeter.getMeterId())));
}
- private void handleStaleEntityDeletionResultFuture(
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
+ private void handleStaleEntityDeletionResultFuture(ListenableFuture<Void> submitFuture) {
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.Objects;
import java.util.Optional;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
boolean result = false;
InstanceIdentifier<Node> nodeIid = ident.firstIdentifierOf(Node.class);
final ReadOnlyTransaction transaction = dataService.newReadOnlyTransaction();
- CheckedFuture<com.google.common.base.Optional<Node>, ReadFailedException> future = transaction
+ ListenableFuture<com.google.common.base.Optional<Node>> future = transaction
.read(LogicalDatastoreType.OPERATIONAL, nodeIid);
try {
- com.google.common.base.Optional<Node> optionalDataObject = future.checkedGet();
+ com.google.common.base.Optional<Node> optionalDataObject = future.get();
if (optionalDataObject.isPresent()) {
result = true;
} else {
LOG.debug("{}: Failed to read {}", Thread.currentThread().getStackTrace()[1], nodeIid);
}
- } catch (ReadFailedException e) {
+ } catch (ExecutionException | InterruptedException e) {
LOG.warn("Failed to read {} ", nodeIid, e);
}
transaction.close();
package org.opendaylight.openflowplugin.applications.frm.impl;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.openflowplugin.applications.frm.ForwardingRulesManager;
import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleGroupInstanceIdentifier(staleGroup, nodeIdent),
staleGroup, false);
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleGroupResultFuture(submitFuture);
}
- private void handleStaleGroupResultFuture(CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
+ private void handleStaleGroupResultFuture(ListenableFuture<Void> submitFuture) {
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
package org.opendaylight.openflowplugin.applications.frm.impl;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.openflowplugin.applications.frm.ForwardingRulesManager;
import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleMeterInstanceIdentifier(staleMeter, nodeIdent),
staleMeter, false);
- CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+ ListenableFuture<Void> submitFuture = writeTransaction.submit();
handleStaleMeterResultFuture(submitFuture);
}
- private void handleStaleMeterResultFuture(CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
+ private void handleStaleMeterResultFuture(ListenableFuture<Void> submitFuture) {
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.openflowplugin.applications.southboundcli.alarm.AlarmAgent;
import org.opendaylight.openflowplugin.applications.southboundcli.util.OFNode;
import org.opendaylight.openflowplugin.applications.southboundcli.util.ShellUtil;
}
try {
tx.merge(LogicalDatastoreType.OPERATIONAL, instanceIdentifier, counterBuilder.build(), true);
- tx.submit().checkedGet();
- } catch (TransactionCommitFailedException e) {
+ tx.submit().get();
+ } catch (InterruptedException | ExecutionException e) {
LOG.error("Exception while submitting counter {}", nodeId, e);
}
}
package org.opendaylight.openflowplugin.applications.southboundcli.util;
import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).build();
try {
- CheckedFuture<Optional<Nodes>, ReadFailedException> checkedFuture =
- tx.read(LogicalDatastoreType.OPERATIONAL, path);
- Optional<Nodes> result = checkedFuture.get();
+ Optional<Nodes> result = tx.read(LogicalDatastoreType.OPERATIONAL, path).get();
if (result.isPresent()) {
nodes = result.get().getNode();
}
ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(NODE_PREFIX + nodeId))).build();
- Optional<Node> result;
+
try {
- CheckedFuture<Optional<Node>, ReadFailedException> checkedFuture =
- tx.read(LogicalDatastoreType.OPERATIONAL, path);
- result = checkedFuture.get();
+ Optional<Node> result = tx.read(LogicalDatastoreType.OPERATIONAL, path).get();
if (result.isPresent()) {
Node node = result.get();
String name = null;
.builder(ReconciliationCounter.class).build();
List<ReconcileCounter> output = Collections.emptyList();
try {
- CheckedFuture<Optional<ReconciliationCounter>, ReadFailedException> checkedFuture =
- tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
- Optional<ReconciliationCounter> result = checkedFuture.get();
+ Optional<ReconciliationCounter> result =
+ tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).get();
if (result.isPresent()) {
output = result.get().getReconcileCounter();
}
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.openflowplugin.common.txchain.TransactionChainManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
try {
// read that checks if link exists (if we do not do this we might get an exception on delete)
linkOptional = manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL,
- TopologyManagerUtil.linkPath(toTopologyLink(notification), iiToTopology)).checkedGet();
- } catch (ReadFailedException e) {
+ TopologyManagerUtil.linkPath(toTopologyLink(notification), iiToTopology)).get();
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Error occurred when trying to read Link: {}", e.getMessage());
LOG.debug("Error occurred when trying to read Link.. ", e);
}
package org.opendaylight.openflowplugin.applications.topology.manager;
import com.google.common.base.Optional;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.openflowplugin.common.txchain.TransactionChainManager;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
private boolean isFlowTopologyExist(final InstanceIdentifier<Topology> path) {
try {
Optional<Topology> ofTopology = this.transactionChainManager
- .readFromTransaction(LogicalDatastoreType.OPERATIONAL, path).checkedGet();
+ .readFromTransaction(LogicalDatastoreType.OPERATIONAL, path).get();
LOG.debug("OpenFlow topology exist in the operational data store at {}", path);
if (ofTopology.isPresent()) {
return true;
}
- } catch (ReadFailedException e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("OpenFlow topology read operation failed!", e);
}
return false;
import java.util.Collection;
import java.util.Optional;
+import java.util.concurrent.ExecutionException;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
nodeOptional = Optional.empty();
try {
nodeOptional = Optional.ofNullable(
- manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, node).checkedGet().orNull());
- } catch (ReadFailedException e) {
+ manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, node).get().orNull());
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Error occurred when trying to read NodeConnector: {}", e.getMessage());
LOG.debug("Error occurred when trying to read NodeConnector.. ", e);
}
import com.google.common.base.Optional;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.openflowplugin.common.txchain.TransactionChainManager;
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.TpId;
InstanceIdentifier<Topology> topology) {
Optional<Topology> topologyOptional = Optional.absent();
try {
- topologyOptional = manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, topology).checkedGet();
- } catch (ReadFailedException e) {
+ topologyOptional = manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, topology).get();
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Error reading topology data for topology {}: {}", topology, e.getMessage());
LOG.debug("Error reading topology data for topology.. ", e);
}
final InstanceIdentifier<Topology> topology) {
Optional<Topology> topologyOptional = Optional.absent();
try {
- topologyOptional = manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, topology).checkedGet();
- } catch (ReadFailedException e) {
+ topologyOptional = manager.readFromTransaction(LogicalDatastoreType.OPERATIONAL, topology).get();
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Error reading topology data for topology {}: {}", topology, e.getMessage());
LOG.debug("Error reading topology data for topology..", e);
}
-# -- coding utf-8 --
-#
-# Openflowplugin documentation build configuration file, created by
-# sphinx-quickstart on Mon Nov 15 214732 2017.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.') or your custom
-# ones.
-extensions = []
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = '.rst'
-
-# The encoding of source files.
-#
-# source_encoding = 'utf-8-sig'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = 'Openflowplugin'
-copyright = '2017, Abhijit Kumbhare, Anil Vishnoi'
-author = 'Abhijit Kumbhare, Anil Vishnoi'
-
-# The version info for the project you're documenting, acts as replacement for
-# version and release, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '0.2.0'
-# The full version, including alphabetarc tags.
-release = '0.2.0'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set language from the command line for these cases.
-language = None
-
-# There are two options for replacing today either, you set today to some
-# non-false value, then it is used
-#
-# today = ''
-#
-# Else, today_fmt is used as the format for a strftime call.
-#
-# today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
-
-# The reST default role (used for this markup `text`) to use for all
-# documents.
-#
-# default_role = None
-
-# If true, '()' will be appended to func etc. cross-reference text.
-#
-# add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function).
-#
-# add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#
-# show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-# modindex_common_prefix = []
-
-# If true, keep warnings as system message paragraphs in the built documents.
-# keep_warnings = False
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = False
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = 'alabaster'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#
-# html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-# html_theme_path = []
-
-# The name for this set of Sphinx documents.
-# project vrelease documentation by default.
-#
-# html_title = 'Openflowplugin v0.2.0'
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#
-# html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#
-# html_logo = None
-
-# The name of an image file (relative to this directory) to use as a favicon of
-# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#
-# html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named default.css will overwrite the builtin default.css.
-html_static_path = ['_static']
-
-# Add any extra paths that contain custom files (such as robots.txt or
-# .htaccess) here, relative to this directory. These files are copied
-# directly to the root of the documentation.
-#
-# html_extra_path = []
-
-# If not None, a 'Last updated on' timestamp is inserted at every page
-# bottom, using the given strftime format.
-# The empty string is equivalent to '%b %d, %Y'.
-#
-# html_last_updated_fmt = None
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#
-# html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#
-# html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#
-# html_additional_pages = {}
-
-# If false, no module index is generated.
-#
-# html_domain_indices = True
-
-# If false, no index is generated.
-#
-# html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#
-# html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#
-# html_show_sourcelink = True
-
-# If true, Created using Sphinx is shown in the HTML footer. Default is True.
-#
-# html_show_sphinx = True
-
-# If true, (C) Copyright ... is shown in the HTML footer. Default is True.
-#
-# html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a link tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#
-# html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. .xhtml).
-# html_file_suffix = None
-
-# Language to be used for generating the HTML full-text search index.
-# Sphinx supports the following languages
-# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
-# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
-#
-# html_search_language = 'en'
-
-# A dictionary with options for the search language support, empty by default.
-# 'ja' uses this config value.
-# 'zh' user can custom change `jieba` dictionary path.
-#
-# html_search_options = {'type' 'default'}
-
-# The name of a javascript file (relative to the configuration directory) that
-# implements a search results scorer. If empty, the default will be used.
-#
-# html_search_scorer = 'scorer.js'
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'Openflowplugindoc'
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize' 'letterpaper',
-
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize' '10pt',
-
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble' '',
-
- # Latex figure (float) alignment
- #
- # 'figure_align' 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- (master_doc, 'Openflowplugin.tex', 'Openflowplugin Documentation',
- 'Abhijit Kumbhare, Anil Vishnoi', 'manual'),
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2018 The Linux Foundation and others.
+#
+# All rights reserved. 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
+##############################################################################
+
+from docs_conf.conf import *
+
+# Append to intersphinx_mapping
+#intersphinx_mapping['odl-releng-builder'] = ('http://docs.opendaylight.org/projects/releng-builder/en/latest/', None)
+
+linkcheck_ignore = [
+ # Ignore jenkins because it's often slow to respond.
+ 'https://jenkins.opendaylight.org/releng',
+ 'https://jenkins.opendaylight.org/sandbox',
]
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#
-# latex_logo = None
-
-# For manual documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#
-# latex_use_parts = False
-
-# If true, show page references after internal links.
-#
-# latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#
-# latex_show_urls = False
-
-# Documents to append as an appendix to all manuals.
-#
-# latex_appendices = []
-
-# It false, will not define strong, code, itleref, crossref ... but only
-# sphinxstrong, ..., sphinxtitleref, ... To help avoid clash with user added
-# packages.
-#
-# latex_keep_old_macro_names = True
-
-# If false, no module index is generated.
-#
-# latex_domain_indices = True
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- (master_doc, 'openflowplugin', 'Openflowplugin Documentation',
- [author], 1)
-]
-
-# If true, show URL addresses after external links.
-#
-# man_show_urls = False
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- (master_doc, 'Openflowplugin', 'Openflowplugin Documentation',
- author, 'Openflowplugin', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-# Documents to append as an appendix to all manuals.
-#
-# texinfo_appendices = []
-
-# If false, no module index is generated.
-#
-# texinfo_domain_indices = True
-
-# How to display URL addresses 'footnote', 'no', or 'inline'.
-#
-# texinfo_show_urls = 'footnote'
-
-# If true, do not generate a @detailmenu in the Top node's menu.
-#
-# texinfo_no_detailmenu = False
+nitpicky = True
--- /dev/null
+---
+project_cfg: opendaylight
+project: ODL OpenFlowPlugin
+version: Fluorine
+copyright: 2017, Abhijit Kumbhare, Anil Vishnoi
+author: Abhijit Kumbhare, Anil Vishnoi
--- /dev/null
+lfdocs-conf
+++ /dev/null
-[tox]
-minversion = 1.6.0
-envlist = docs
-skipsdist = true
-
-[testenv:docs]
-deps = sphinx
-commands = sphinx-build -b html -d {envtmpdir}/doctrees ./docs/ {envtmpdir}/html
\ No newline at end of file
*/
@Nonnull
public static byte[] getBits(final byte[] data, final int startOffset, final int numBits) throws BufferException {
- int startByteOffset = 0;
+ int startByteOffset;
int extranumBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
final int extraOffsetBits = startOffset % NetUtils.NUM_BITS_IN_A_BYTE;
int numBytes = numBits % NetUtils.NUM_BITS_IN_A_BYTE != 0 ? 1 + numBits / NetUtils.NUM_BITS_IN_A_BYTE
public static long toNumber(final byte[] array) {
long ret = 0;
long length = array.length;
- int value = 0;
+ int value;
for (int i = 0; i < length; i++) {
value = array[i];
if (value < 0) {
int bitsRest = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
int startOffset = array.length - length;
long ret = 0;
- int value = 0;
+ int value;
value = array[startOffset - 1] & getLSBMask(bitsRest);
value = array[startOffset - 1] < 0 ? array[startOffset - 1] + 256 : array[startOffset - 1];
*/
public static byte[] toByteArray(final Number input) {
Class<? extends Number> dataType = input.getClass();
- short size = 0;
+ short size;
long longValue = input.longValue();
if (dataType == Byte.class || dataType == byte.class) {
*/
public static byte[] toByteArray(final Number input, final int numBits) {
Class<? extends Number> dataType = input.getClass();
- short size = 0;
+ short size;
long longValue = input.longValue();
if (dataType == Short.class) {
}
if (bytes[0] == 0 && dataType == Long.class || bytes[0] == 0 && dataType == Integer.class) {
- int index = 0;
+ int index;
for (index = 0; index < length; ++index) {
if (bytes[index] != 0) {
bytes[0] = bytes[index];
* @return byte[]
*/
public static byte[] shiftBitsToMSB(final byte[] inputBytes, final int numBits) {
- int numBitstoShiftBy = 0;
+ int numBitstoShiftBy;
int leadZeroesMSB = 8;
- int numEndRestBits = 0;
+ int numEndRestBits;
int size = inputBytes.length;
byte[] shiftedBytes = new byte[size];
int numBytes = inputBytes.length;
int numBitstoShift = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
byte[] shiftedBytes = new byte[numBytes];
- int inputLsb = 0;
- int inputMsb = 0;
+ int inputLsb;
+ int inputMsb;
if (numBitstoShift == 0) {
return inputBytes;
int extraOffsetBits = startOffset % NetUtils.NUM_BITS_IN_A_BYTE;
int extranumBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
int restBits = numBits % NetUtils.NUM_BITS_IN_A_BYTE;
- int inputMSBbits = 0;
+ int inputMSBbits;
int inputLSBbits = 0;
if (numBits == 0) {
}
CustomTLVKey other = (CustomTLVKey) obj;
- if (oui != other.oui) {
- return false;
- }
-
- if (subtype != other.subtype) {
- return false;
- }
-
- return true;
+ return oui == other.oui && subtype == other.subtype;
}
}
CISCOQINQ("Cisco QINQ", 0x9200); // Cisco non-standard QinQ
private static final String REGEX_NUMBER_STRING = "^[0-9]+$";
- private String description;
- private int number;
+ private final String description;
+ private final int number;
EtherTypes(final String description, final int number) {
this.description = description;
return false;
}
EthernetAddress other = (EthernetAddress) obj;
- if (!Arrays.equals(macAddress, other.macAddress)) {
- return false;
- }
- return true;
+ return Arrays.equals(macAddress, other.macAddress);
}
@Override
}
public static long stringToLong(final String values) {
- long value = new BigInteger(values.replaceAll(":", ""), 16).longValue();
- return value;
+ return new BigInteger(values.replaceAll(":", ""), 16).longValue();
}
/**
/**
* Returns the TLV byte type.
*
- * @param String description of the type of TLV
+ * @param typeDesc description of the type of TLV
* @return byte type of TLV
*/
private byte getType(final String typeDesc) {
- if (typeDesc.equals(CHASSISID)) {
- return LLDPTLV.TLVType.ChassisID.getValue();
- } else if (typeDesc.equals(PORTID)) {
- return LLDPTLV.TLVType.PortID.getValue();
- } else if (typeDesc.equals(TTL)) {
- return LLDPTLV.TLVType.TTL.getValue();
- } else if (typeDesc.equals(SYSTEMNAMEID)) {
- return LLDPTLV.TLVType.SystemName.getValue();
- } else {
- return LLDPTLV.TLVType.Unknown.getValue();
+ switch (typeDesc) {
+ case CHASSISID:
+ return LLDPTLV.TLVType.ChassisID.getValue();
+ case PORTID:
+ return LLDPTLV.TLVType.PortID.getValue();
+ case TTL:
+ return LLDPTLV.TLVType.TTL.getValue();
+ case SYSTEMNAMEID:
+ return LLDPTLV.TLVType.SystemName.getValue();
+ default:
+ return LLDPTLV.TLVType.Unknown.getValue();
}
}
private LLDPTLV getFromTLVs(final Byte type) {
- LLDPTLV tlv = null;
+ LLDPTLV tlv;
tlv = mandatoryTLVs.get(type);
if (tlv == null) {
tlv = optionalTLVs.get(type);
int lldpSize = size; // LLDP size
if (LOG.isTraceEnabled()) {
- LOG.trace("LLDP: {} (offset {} bitsize {})", new Object[] { HexEncode.bytesToHexString(data),
- lldpOffset, lldpSize });
+ LOG.trace("LLDP: {} (offset {} bitsize {})", HexEncode.bytesToHexString(data), lldpOffset, lldpSize);
}
/*
* Deserialize the TLVs until we reach the end of the packet
(byte) 4), SystemName((byte) 5), SystemDesc((byte) 6), Custom(
(byte) 127);
- private byte value;
+ private final byte value;
TLVType(final byte value) {
this.value = value;
*/
public int getLength() {
return (int) BitBufferHelper.toNumber(fieldValues.get(LENGTH),
- FIELD_COORDINATES.get(LENGTH).getRight().intValue());
+ FIELD_COORDINATES.get(LENGTH).getRight());
}
/**
public int getfieldnumBits(final String fieldName) {
if (fieldName.equals(VALUE)) {
return NetUtils.NUM_BITS_IN_A_BYTE * BitBufferHelper.getShort(
- fieldValues.get(LENGTH), FIELD_COORDINATES.get(LENGTH)
- .getRight().intValue());
+ fieldValues.get(LENGTH), FIELD_COORDINATES.get(LENGTH).getRight());
}
return FIELD_COORDINATES.get(fieldName).getRight();
}
}
public static boolean fieldsConflict(final int field1, final int field2) {
- if (field1 == 0 || field2 == 0 || field1 == field2) {
- return false;
- }
- return true;
+ return field1 != 0 && field2 != 0 && field1 != field2;
}
public static InetAddress parseInetAddress(final String addressString) {
startOffset = bitOffset + this.getfieldOffset(hdrField);
numBits = this.getfieldnumBits(hdrField);
- byte[] hdrFieldBytes = null;
+ byte[] hdrFieldBytes;
try {
hdrFieldBytes = BitBufferHelper.getBits(data, startOffset,
numBits);
package org.opendaylight.openflowplugin.common.txchain;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
}
}
- public <T extends DataObject> CheckedFuture<com.google.common.base.Optional<T>, ReadFailedException>
+ public <T extends DataObject> ListenableFuture<com.google.common.base.Optional<T>>
readFromTransaction(final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
synchronized (txLock) {
ensureTransaction();
if (!wasSubmitEnabled || transactionChain == null) {
// stay with actual thread
- future = Futures.immediateCheckedFuture(null);
+ future = Futures.immediateFuture(null);
if (writeTx != null) {
writeTx.cancel();
}
private void stepByStepVersionSubStep(Short remoteVersion) throws Exception {
- if (remoteVersion.equals(lastProposedVersion)) {
+ if (remoteVersion >= lastProposedVersion) {
postHandshake(lastProposedVersion, getNextXid());
LOG.trace("ret - OK - switch answered with lastProposedVersion");
} else {
import com.google.common.base.Function;
import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import java.util.stream.Collectors;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceRegistry;
return;
}
- final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> future;
+ final ListenableFuture<Optional<FlowCapableNode>> future;
try (ReadOnlyTransaction readTx = txFacade.getReadTransaction()) {
future = readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
}
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupModCommand;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
assertEquals((Long) 22L, outAddGroupInput.getBucketsList().get(0).getWatchGroup());
final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
- for (int outItem = 0; outItem < outActionList.size(); outItem++) {
- final Action action = outActionList
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
- assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
- }
- // TODO:setMplsTTL :OF layer doesnt have get();
- }
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
+ .rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
+ .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .build()), outActionList);
assertEquals((Integer) 50, outAddGroupInput.getBucketsList().get(1).getWeight());
assertEquals((long) 60, (long) outAddGroupInput.getBucketsList().get(1).getWatchPort().getValue());
assertEquals((Long) 70L, outAddGroupInput.getBucketsList().get(1).getWatchGroup());
- final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
- for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
- final Action action = outActionList1
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
-
- assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
-
- }
- // TODO:setMplsTTL :OF layer doesnt have get();
- }
+ final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action
+ .rev150203.actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping
+ .action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build()).build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .build()), outActionList1);
}
/**
assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
- for (int outItem = 0; outItem < outActionList.size(); outItem++) {
- final Action action = outActionList
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
- assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
- }
- }
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build()).build())
+ .build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .action.grouping.action.choice.group._case.GroupActionBuilder().setGroupId(6L)
+ .build()).build()).build()), outActionList);
final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
- for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
- final Action action = outActionList1
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
- assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
- }
- }
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .actions.grouping.ActionBuilder().setActionChoice(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.CopyTtlInCaseBuilder().build()).build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new SetMplsTtlCaseBuilder().setSetMplsTtlAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .action.grouping.action.choice.set.mpls.ttl._case.SetMplsTtlActionBuilder()
+ .setMplsTtl((short) 1).build()).build()).build()), outActionList1);
}
/**
assertEquals(10L, outAddGroupInput.getGroupId().getValue().longValue());
final List<Action> outActionList = outAddGroupInput.getBucketsList().get(0).getAction();
- for (int outItem = 0; outItem < outActionList.size(); outItem++) {
- final Action action = outActionList
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
- assertEquals((Long) 5L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
- }
-
- }
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+ .build()).build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .action.grouping.action.choice.group._case.GroupActionBuilder()
+ .setGroupId(6L).build()).build()).build()), outActionList);
final List<Action> outActionList1 = outAddGroupInput.getBucketsList().get(1).getAction();
- for (int outItem = 0; outItem < outActionList1.size(); outItem++) {
- final Action action = outActionList1
- .get(outItem);
- if (action.getActionChoice() instanceof GroupActionCase) {
-
- assertEquals((Long) 6L, ((GroupActionCase) action.getActionChoice()).getGroupAction().getGroupId());
-
- }
-
- }
-
+ assertEquals(ImmutableList.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .actions.grouping.ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action
+ .grouping.action.choice.group._case.GroupActionBuilder().setGroupId(5L).build())
+ .build()).build(),
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder().setActionChoice(new GroupCaseBuilder().setGroupAction(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
+ .action.grouping.action.choice.group._case.GroupActionBuilder()
+ .setGroupId(6L).build()).build()).build()), outActionList1);
}
- private GroupModInputBuilder convert(Group group, VersionDatapathIdConvertorData data) {
+ private GroupModInputBuilder convert(final Group group, final VersionDatapathIdConvertorData data) {
final Optional<GroupModInputBuilder> outAddGroupInputOptional = convertorManager.convert(group, data);
assertTrue("Group convertor not found", outAddGroupInputOptional.isPresent());
return outAddGroupInputOptional.get();
package org.opendaylight.openflowplugin.learningswitch;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
* @param flowBody the flow body
* @return transaction commit
*/
- CheckedFuture<Void, TransactionCommitFailedException> writeFlowToConfig(
- InstanceIdentifier<Flow> flowPath, Flow flowBody);
+ ListenableFuture<Void> writeFlowToConfig(InstanceIdentifier<Flow> flowPath, Flow flowBody);
}
package org.opendaylight.openflowplugin.learningswitch;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
}
@Override
- public CheckedFuture<Void, TransactionCommitFailedException> writeFlowToConfig(InstanceIdentifier<Flow> flowPath,
- Flow flowBody) {
+ public ListenableFuture<Void> writeFlowToConfig(InstanceIdentifier<Flow> flowPath, Flow flowBody) {
ReadWriteTransaction addFlowTransaction = dataBrokerService.newReadWriteTransaction();
addFlowTransaction.put(LogicalDatastoreType.CONFIGURATION, flowPath, flowBody, true);
return addFlowTransaction.submit();
package org.opendaylight.openflowplugin.test;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.math.BigInteger;
import java.util.ArrayList;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
.child(Group.class, new GroupKey(group1.getGroupId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path2, group1, true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
.child(Group.class, new GroupKey(group1.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
package org.opendaylight.openflowplugin.test;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.math.BigInteger;
import java.util.ArrayList;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
modification.delete(LogicalDatastoreType.OPERATIONAL, path4);
modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(tn));
modification.delete(LogicalDatastoreType.CONFIGURATION, path4);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
nodeBuilder.build(), true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build(), true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
package org.opendaylight.openflowplugin.test;
import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.List;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
.child(Group.class, new GroupKey(group.getGroupId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
package org.opendaylight.openflowplugin.test;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.List;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey())
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(testMeter.getMeterId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
break;
}
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
.augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, meter, true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path2, meter1, true);
- CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
package org.opendaylight.openflowplugin.test;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.math.BigInteger;
import java.util.ArrayList;
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.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tf.getTableId()))
.child(Flow.class, tf.getKey());
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
- final CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ final ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void notUsed) {
modification.merge(LogicalDatastoreType.CONFIGURATION,
nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
- final CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+ final ListenableFuture<Void> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void notUsed) {
--- /dev/null
+[tox]
+minversion = 1.6.0
+envlist = docs
+skipsdist = true
+
+[testenv:docs]
+deps = -rdocs/requirements.txt
+commands = sphinx-build -W -n -b html -d {envtmpdir}/doctrees ./docs/ {envtmpdir}/html