Merge "Pass error cause to service status"
authorAnil Vishnoi <vishnoianil@gmail.com>
Mon, 4 Jun 2018 16:16:56 +0000 (16:16 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 4 Jun 2018 16:16:56 +0000 (16:16 +0000)
38 files changed:
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/GroupForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/MeterForwarder.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/AdminReconciliationServiceImpl.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableTopologyExporter.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableTopologyProvider.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TopologyManagerUtil.java
docs/_static/logo.png [new file with mode: 0644]
docs/conf.py
docs/conf.yaml [new file with mode: 0644]
docs/favicon.ico [new file with mode: 0644]
docs/requirements.txt [new file with mode: 0644]
docs/tox.ini [deleted file]
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/BitBufferHelper.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/CustomTLVKey.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/EtherTypes.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/EthernetAddress.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/HexEncode.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/NetUtils.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/Packet.java
openflowplugin-common/src/main/java/org/opendaylight/openflowplugin/common/txchain/TransactionChainManager.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertorTest.java
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowCommitWrapper.java
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowCommitWrapperImpl.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java
tox.ini [new file with mode: 0644]

index c3cc81cde40c5024f674cfb9214ccc46957fd0ef..58fca3539e140c90dd963e3fadc12ce96f54d931 100644 (file)
@@ -8,9 +8,9 @@
 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;
@@ -18,7 +18,6 @@ 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;
@@ -224,11 +223,11 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
         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) {
index c55e4b3bf16c5e581fe6e16262d4a3e102597553..417e56e18487bd4cf72b437c4ff3d4f6519a7e4d 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.openflowplugin.applications.frm.impl;
 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;
@@ -36,7 +35,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 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;
@@ -159,8 +157,6 @@ public class FlowNodeReconciliationImpl implements 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));
@@ -183,7 +179,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             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();
@@ -195,6 +191,10 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                 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();
@@ -207,22 +207,30 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         .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());
@@ -636,7 +644,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleFlowIId);
         }
 
-        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+        ListenableFuture<Void> submitFuture = writeTransaction.submit();
         handleStaleEntityDeletionResultFuture(submitFuture);
     }
 
@@ -647,7 +655,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleGroupIId);
         }
 
-        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+        ListenableFuture<Void> submitFuture = writeTransaction.submit();
         handleStaleEntityDeletionResultFuture(submitFuture);
     }
 
@@ -658,7 +666,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleMeterIId);
         }
 
-        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+        ListenableFuture<Void> submitFuture = writeTransaction.submit();
         handleStaleEntityDeletionResultFuture(submitFuture);
     }
 
@@ -682,8 +690,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
         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) {
index 2ce566f0a8186700a6a5be80b441e1c7c2c9048a..1b393195c687e64fc8666510b0311549e368841c 100644 (file)
@@ -10,15 +10,15 @@ package org.opendaylight.openflowplugin.applications.frm.impl;
 
 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;
@@ -196,16 +196,16 @@ public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
         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();
index 9f59df23109ede94b2381fbf0100fde2eeb401ec..fc6cdc4c1d1638ae33e4ced53b7893eaaac720c0 100644 (file)
@@ -8,16 +8,15 @@
 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;
@@ -174,11 +173,11 @@ public class GroupForwarder extends AbstractListeningCommiter<Group> {
         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) {
index 97b32fea2118cd60f054cd7d21af1d013fc9517c..de170988006cc86e2308c8aba6b9de48979352f5 100644 (file)
@@ -8,16 +8,15 @@
 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;
@@ -167,11 +166,11 @@ public class MeterForwarder extends AbstractListeningCommiter<Meter> {
         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) {
index 932a9d71858217e1961b2629284ba24ee437953b..7d721a54dac397b7b74a6d03021e628af0ed2eb3 100644 (file)
@@ -22,7 +22,6 @@ import java.util.stream.Collectors;
 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;
@@ -163,8 +162,8 @@ public class AdminReconciliationServiceImpl implements AdminReconciliationServic
         }
         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);
         }
     }
index 0b021b505fc1ecf7f5f402df01cd8e655c340f0a..31810a95f02876e68a6ed7b51512eee8cac859d2 100644 (file)
@@ -9,7 +9,6 @@
 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;
@@ -18,7 +17,6 @@ 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.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;
@@ -46,9 +44,7 @@ public final class ShellUtil {
         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();
             }
@@ -102,11 +98,9 @@ public final class ShellUtil {
         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;
@@ -148,9 +142,8 @@ public final class ShellUtil {
                 .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();
             }
index c1339c32c60e56a336c973901b2d5b160c55dbbf..176df705575e57a979844a074a8fb34dc6e59e59 100644 (file)
@@ -11,8 +11,8 @@ import static org.opendaylight.openflowplugin.applications.topology.manager.Flow
 
 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;
@@ -68,8 +68,8 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener {
                 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);
                 }
index 3766b2710e3780d8041eb359791d5abd149fcb90..8f07c1b06a7f8f6d678981fb8ccba1b638cfe3c4 100644 (file)
@@ -8,9 +8,9 @@
 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;
@@ -78,12 +78,12 @@ public class FlowCapableTopologyProvider implements AutoCloseable {
     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;
index eab8facdb94c32c8e6d8d08dc43d016afc322588..808e2c8110edb690c95f049ccfe140aac56b7c5b 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.openflowplugin.applications.topology.manager;
 
 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;
@@ -80,8 +80,8 @@ public class TerminationPointChangeListenerImpl extends DataTreeChangeListenerIm
                         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);
                 }
index bc2fb8a994f9579c1611903f814ce00ef7a6402c..3a37d3e18e0f033351dca8243fa67cd8d1eba115 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.applications.topology.manager;
 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;
@@ -32,8 +32,8 @@ final class TopologyManagerUtil {
                                     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);
         }
@@ -62,8 +62,8 @@ final class TopologyManagerUtil {
                                     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);
         }
diff --git a/docs/_static/logo.png b/docs/_static/logo.png
new file mode 100644 (file)
index 0000000..861e1af
Binary files /dev/null and b/docs/_static/logo.png differ
index 6dfe6100a95d492805a680d5adfe190ebe70254c..f8d31cf893de749962616fa22c9d2132e9ae2a5a 100644 (file)
-# -- 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
diff --git a/docs/conf.yaml b/docs/conf.yaml
new file mode 100644 (file)
index 0000000..6e824f4
--- /dev/null
@@ -0,0 +1,6 @@
+---
+project_cfg: opendaylight
+project: ODL OpenFlowPlugin
+version: Fluorine
+copyright: 2017, Abhijit Kumbhare, Anil Vishnoi
+author: Abhijit Kumbhare, Anil Vishnoi
diff --git a/docs/favicon.ico b/docs/favicon.ico
new file mode 100644 (file)
index 0000000..c9b3888
Binary files /dev/null and b/docs/favicon.ico differ
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644 (file)
index 0000000..74a3b7a
--- /dev/null
@@ -0,0 +1 @@
+lfdocs-conf
diff --git a/docs/tox.ini b/docs/tox.ini
deleted file mode 100644 (file)
index 0e63f49..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-[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
index 07d1e618dbaf43cebd711aee8942cf51832491ce..6d9ff899c7534cb44b939fc20ad91c0690514b3a 100644 (file)
@@ -169,7 +169,7 @@ public abstract class BitBufferHelper {
      */
     @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
@@ -305,7 +305,7 @@ public abstract class BitBufferHelper {
     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) {
@@ -326,7 +326,7 @@ public abstract class BitBufferHelper {
         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];
@@ -350,7 +350,7 @@ public abstract class BitBufferHelper {
      */
     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) {
@@ -387,7 +387,7 @@ public abstract class BitBufferHelper {
      */
     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) {
@@ -411,7 +411,7 @@ public abstract class BitBufferHelper {
         }
 
         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];
@@ -446,9 +446,9 @@ public abstract class BitBufferHelper {
      * @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];
 
@@ -517,8 +517,8 @@ public abstract class BitBufferHelper {
         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;
@@ -555,7 +555,7 @@ public abstract class BitBufferHelper {
         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) {
index 279446ae80e6c0d062daf988a9c2f23a81fbad3b..8f884fc9d6b8c881caca9ca9657a11d62f73f197 100644 (file)
@@ -56,15 +56,7 @@ public class CustomTLVKey {
         }
 
         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;
     }
 
 }
index 21ca56a2408f8e2498269746d115105182e83b8e..a6e98d153a4b910623f0cf96044ef11e92695a7f 100644 (file)
@@ -26,8 +26,8 @@ public enum EtherTypes {
     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;
index 72433a6d89118d0a85cf16fe20ed168f0b856a6d..9cce96e0caf6be656142f80c6bc158dd029f5d7d 100644 (file)
@@ -94,10 +94,7 @@ public class EthernetAddress extends DataLinkAddress {
             return false;
         }
         EthernetAddress other = (EthernetAddress) obj;
-        if (!Arrays.equals(macAddress, other.macAddress)) {
-            return false;
-        }
-        return true;
+        return Arrays.equals(macAddress, other.macAddress);
     }
 
     @Override
index 02bc634653152d61c7feb1f98600bbddd1f17c30..f003b7a4987f1de3b1b02d6576291c0cd1f9b7b5 100644 (file)
@@ -79,8 +79,7 @@ public final class HexEncode {
     }
 
     public static long stringToLong(final String values) {
-        long value = new BigInteger(values.replaceAll(":", ""), 16).longValue();
-        return value;
+        return new BigInteger(values.replaceAll(":", ""), 16).longValue();
     }
 
     /**
index 56a02443dc632180b78e4784ce4b9ba880d0d6cf..0e10b316f112a9113c2fefec7568d816144ad335 100644 (file)
@@ -55,25 +55,26 @@ public class LLDP extends Packet {
     /**
      * 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);
@@ -197,8 +198,7 @@ public class LLDP extends Packet {
         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
index 9af1e74130a68ea84ee578aecbcf86bbeff56ca3..6f3bfd339d78d721cde4a054d1580e80ec06d8c1 100644 (file)
@@ -50,7 +50,7 @@ public class LLDPTLV extends 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;
@@ -95,7 +95,7 @@ public class LLDPTLV extends Packet {
      */
     public int getLength() {
         return (int) BitBufferHelper.toNumber(fieldValues.get(LENGTH),
-                FIELD_COORDINATES.get(LENGTH).getRight().intValue());
+                FIELD_COORDINATES.get(LENGTH).getRight());
     }
 
     /**
@@ -186,8 +186,7 @@ public class LLDPTLV extends Packet {
     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();
     }
index 59d135a5ae6a3702ae659fffbbbf0b2839e17abe..1425f0b7b385b8240dc96c54bfe71b1ed549c7d0 100644 (file)
@@ -360,10 +360,7 @@ public abstract class NetUtils {
     }
 
     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) {
index 4183cc7c5d4455b293354eb899e80e405aea47bc..7b1ffa6070c0336ea131caaba9ab454b7b511f1a 100644 (file)
@@ -93,7 +93,7 @@ public abstract class Packet {
             startOffset = bitOffset + this.getfieldOffset(hdrField);
             numBits = this.getfieldnumBits(hdrField);
 
-            byte[] hdrFieldBytes = null;
+            byte[] hdrFieldBytes;
             try {
                 hdrFieldBytes = BitBufferHelper.getBits(data, startOffset,
                         numBits);
index 1c7627e4eaba69807d01cdfdc0d874c616fb2855..32be30f054d768b77da5dce4fd779aff796fd9ae 100755 (executable)
@@ -9,7 +9,6 @@
 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;
@@ -28,7 +27,6 @@ import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 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;
@@ -262,7 +260,7 @@ public class TransactionChainManager implements TransactionChainListener, AutoCl
         }
     }
 
-    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();
@@ -327,7 +325,7 @@ public class TransactionChainManager implements TransactionChainListener, AutoCl
 
         if (!wasSubmitEnabled || transactionChain == null) {
             // stay with actual thread
-            future = Futures.immediateCheckedFuture(null);
+            future = Futures.immediateFuture(null);
 
             if (writeTx != null) {
                 writeTx.cancel();
index e2f9d91f973129315acd441c4d77579eab1e5a6a..e2107dfb73265d0df8be274324330ca1f64e991e 100644 (file)
@@ -169,7 +169,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
     }
 
     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 {
index 82af62277702519e209fd9f9fc881b72643f838a..470e73bba4baeeefbaef9f60874fcdcb5bc252b4 100755 (executable)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.statistics;
 
 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;
@@ -25,7 +24,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 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;
@@ -170,7 +168,7 @@ public final class StatisticsGatheringUtils {
             return;
         }
 
-        final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> future;
+        final ListenableFuture<Optional<FlowCapableNode>> future;
         try (ReadOnlyTransaction readTx = txFacade.getReadTransaction()) {
             future = readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);
         }
index 1209c264c95ee371ce781ce7380af39ebe232d2f..0a5ac4408cfa894f2996a788b09e66453e6f9bea 100644 (file)
@@ -20,7 +20,6 @@ import org.junit.Test;
 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;
@@ -42,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group
 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;
@@ -155,32 +156,30 @@ public class GroupConvertorTest {
         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);
     }
 
     /**
@@ -266,22 +265,27 @@ public class GroupConvertorTest {
         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);
     }
 
     /**
@@ -488,31 +492,31 @@ public class GroupConvertorTest {
         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();
index 265ee7be91be0521677fa3664fd19fff2e546e4e..060dbdb9f6392b3e082dc83466de7123083fe31d 100644 (file)
@@ -8,8 +8,7 @@
 
 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;
 
@@ -22,7 +21,6 @@ public interface FlowCommitWrapper {
      * @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);
 
 }
index e1da864a8a8b3548a75868bb89ca7513cf4ca16c..b6458aac28e4b18e772eb800ce601ccaf46a4456 100644 (file)
@@ -8,11 +8,10 @@
 
 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;
 
@@ -25,8 +24,7 @@ public class FlowCommitWrapperImpl implements FlowCommitWrapper {
     }
 
     @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();
index bf700df0e327e5adf26615ecb06507b8f1e07b97..44fc12dae87cb0fdebe023ad7f6eff2d8fa90a70 100644 (file)
@@ -8,9 +8,9 @@
 
 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;
@@ -20,7 +20,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 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;
@@ -717,7 +716,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid
                 .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) {
@@ -743,7 +742,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid
                 .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) {
index 034fd3e42b62141ccf4a41f774cfaf1d01a03924..7db89be8b0792e391a06a82da2ff1277bd872098 100644 (file)
@@ -8,9 +8,9 @@
 
 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;
@@ -20,7 +20,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 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;
@@ -651,7 +650,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
         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) {
@@ -708,7 +707,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
         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) {
index f5d394545c748a15948d26db1e70d55c1dbbb57a..b4f0c0fe7883550846af24d6246f15c7e8e0199f 100644 (file)
@@ -9,9 +9,9 @@
 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;
@@ -20,7 +20,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 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;
@@ -586,7 +585,7 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
         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) {
@@ -621,7 +620,7 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
                 .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) {
index 6762c9acaaeb2ee336128152cb8ae0c1a8ab823d..97afbd8600b082582555352bcf6fe6d6213ba501 100644 (file)
@@ -8,9 +8,9 @@
 
 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;
@@ -19,7 +19,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 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;
@@ -233,7 +232,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
         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) {
@@ -315,7 +314,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
                 break;
         }
 
-        CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
+        ListenableFuture<Void> commitFuture = modification.submit();
         Futures.addCallback(commitFuture, new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
@@ -388,7 +387,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
                 .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) {
@@ -413,7 +412,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
         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) {
index c2cf1313f30ae3d866c057e3784733eee8be9165..5b4a1695aab1e9c6b8694bd88c4683de50be357d 100644 (file)
@@ -8,9 +8,9 @@
 
 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;
@@ -23,7 +23,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 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;
@@ -3152,7 +3151,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
                 .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) {
@@ -3192,7 +3191,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         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) {
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..6bd0f1e
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,8 @@
+[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