Merge "Fix odlparent 3 Checkstyle issues"
authorAnil Vishnoi <vishnoianil@gmail.com>
Fri, 12 Jan 2018 19:31:26 +0000 (19:31 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 12 Jan 2018 19:31:26 +0000 (19:31 +0000)
41 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/GroupForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/MeterForwarder.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecorator.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImpl.java
applications/topology-lldp-discovery/pom.xml
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPActivator.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAger.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/TopologyLLDPDiscoveryProperty.java [new file with mode: 0644]
applications/topology-lldp-discovery/src/main/resources/org/opendaylight/blueprint/topology-lldp-discovery.xml
applications/topology-lldp-discovery/src/test/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAgerTest.java
openflowplugin-common/src/main/java/org/opendaylight/openflowplugin/common/txchain/TransactionChainManager.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF10DeviceInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/RoleService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerExperimenterMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerFlowService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerTableMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalMeterServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerExperimenterMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerTableMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatService.java
openflowplugin-it/src/test/java/org/opendaylight/openflowplugin/openflow/md/it/OFPluginFlowTest.java
test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/DropTestRpcSender.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/OpenflowpluginTableFeaturesTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java

index cb27c294e583bd6767b2dbc54d4586d7185e9fcb..1dfd755b9433f024b2a10511849dfdcf4bbd2329 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -232,7 +233,7 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
             public void onFailure(Throwable throwable) {
                 LOG.error("Stale Flow creation failed {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
     }
 
index 5b5933efb940059d2f8646ee23cc659a8d90f5c6..7fbbca5943f63db0861e88401f89460cb620e4b6 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -486,7 +487,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                             + ", id=" + groupId;
                     LOG.debug(msg, cause);
                 }
-            });
+            }, MoreExecutors.directExecutor());
 
             map.put(groupId, future);
         }
@@ -690,7 +691,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             public void onFailure(Throwable throwable) {
                 LOG.debug("Stale entity removal failed {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private Flow getDeleteAllFlow() {
index f5ccb19947c6bea17c8f6da4681c104b4c0a6a56..5f9398c1efd5f926560932b160222e166be5bb04 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
@@ -181,7 +182,7 @@ public class GroupForwarder extends AbstractListeningCommiter<Group> {
             public void onFailure(Throwable throwable) {
                 LOG.error("Stale Group creation failed {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
     }
 
index 5cc0c10a33db417b49f56b6a6ee03cc337e98896..2b04d00577bde7281f6fac78f0df1a33d0d13655 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
@@ -174,7 +175,7 @@ public class MeterForwarder extends AbstractListeningCommiter<Meter> {
             public void onFailure(Throwable throwable) {
                 LOG.error("Stale Meter creation failed {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819
index f4ee57fdde6d860404148191ae6b66ccd6f4bc48..015cd8e4554a4ee2e9c809e86f1662476e75ece1 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.applications.frsync.impl;
 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.Objects;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -54,7 +55,8 @@ public class SyncReactorGuardDecorator implements SyncReactor {
             LOG.debug("Syncup guard acquired and running for {} ", nodeId.getValue());
         }
         final ListenableFuture<Boolean> endResult = delegate.syncup(flowcapableNodePath, syncupEntry);
-        Futures.addCallback(endResult, createSyncupCallback(guard, stampBeforeGuard, stampAfterGuard, nodeId));
+        Futures.addCallback(endResult, createSyncupCallback(guard, stampBeforeGuard, stampAfterGuard, nodeId),
+                MoreExecutors.directExecutor());
         return endResult;
     }
 
index e7292a0c3e135e78c040c1bf72ed403bb9e6b198..0320ad87a734cd09710ee80c362e4a0912faa1fc 100644 (file)
@@ -17,6 +17,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -145,7 +146,7 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
 
                 if (LOG.isDebugEnabled()) {
                     Futures.addCallback(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
-                            createCounterCallback(batchBag, batchOrder, counters));
+                            createCounterCallback(batchBag, batchOrder, counters), MoreExecutors.directExecutor());
                 }
 
                 return Futures.transform(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
index 6fc4011a50de1003bb2e4b499a613216e78902a5..2caf0c69f666ce27872f3eb193a898ae57c01649 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.AsyncFunction;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -91,7 +92,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return addMissingGroups(nodeId, nodeIdent, diffInput.getGroupsToAddOrUpdate(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingGroups"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingGroups"),
+                MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
             @Override
             public ListenableFuture<RpcResult<Void>> apply(final RpcResult<Void> input) throws Exception {
@@ -101,7 +103,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return addMissingMeters(nodeId, nodeIdent, diffInput.getMetersToAddOrUpdate(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingMeters"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingMeters"),
+                MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
             @Override
             public ListenableFuture<RpcResult<Void>> apply(final RpcResult<Void> input) throws Exception {
@@ -111,7 +114,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return addMissingFlows(nodeId, nodeIdent, diffInput.getFlowsToAddOrUpdate(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingFlows"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingFlows"),
+                MoreExecutors.directExecutor());
 
 
         resultVehicle = Futures.transformAsync(resultVehicle, new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
@@ -123,7 +127,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return removeRedundantFlows(nodeId, nodeIdent, diffInput.getFlowsToRemove(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantFlows"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantFlows"),
+                MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
             @Override
             public ListenableFuture<RpcResult<Void>> apply(final RpcResult<Void> input) throws Exception {
@@ -133,7 +138,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return removeRedundantMeters(nodeId, nodeIdent, diffInput.getMetersToRemove(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantMeters"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantMeters"),
+                MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
             @Override
             public ListenableFuture<RpcResult<Void>> apply(final RpcResult<Void> input) throws Exception {
@@ -143,7 +149,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 return removeRedundantGroups(nodeId, nodeIdent, diffInput.getGroupsToRemove(), counters);
             }
         });
-        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantGroups"));
+        Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantGroups"),
+                MoreExecutors.directExecutor());
         return resultVehicle;
     }
 
index 07241963f9fcc296a0708683e4e1492dafe9ce72..16131488e9c036eb1845f97b6db82ae282232abc 100644 (file)
       <artifactId>liblldp</artifactId>
       <version>0.14.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.openflowplugin.model</groupId>
       <artifactId>model-flow-base</artifactId>
index 3e5fb3bf10b96a5f69302b7e73ac259d34ac7b88..b93da5fab4d1bd227bf9e4a57286ed3ddab890c3 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.openflowplugin.applications.topology.lldp;
 
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
@@ -21,8 +22,8 @@ public class LLDPActivator implements AutoCloseable {
     private final ListenerRegistration<NotificationListener> lldpNotificationRegistration;
 
     public LLDPActivator(NotificationProviderService notificationService, LLDPDiscoveryListener lldpDiscoveryListener,
-            String secureKey) {
-        lldpSecureKey = secureKey;
+                         TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig) {
+        lldpSecureKey = topologyLldpDiscoveryConfig.getLldpSecureKey();
 
         LOG.info("Starting LLDPActivator with lldpSecureKey: {}", lldpSecureKey);
 
index b238bbbeee73c5e065dad0c37c792e06a013e5d2..1ec666cc7601fb606277af21dd4fb9294b9b47ce 100644 (file)
@@ -11,30 +11,40 @@ import com.google.common.annotations.VisibleForTesting;
 import java.util.Date;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.ConcurrentHashMap;
+import javax.annotation.Nonnull;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationListener;
+import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemovedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-
-public class LLDPLinkAger implements AutoCloseable {
+public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
+    private static final Logger LOG = LoggerFactory.getLogger(LLDPLinkAger.class);
     private final long linkExpirationTime;
     private final Map<LinkDiscovered, Date> linkToDate;
     private final Timer timer;
     private final NotificationProviderService notificationService;
+    private final AutoCloseable configurationServiceRegistration;
 
     /**
      * default ctor - start timer
      */
-    public LLDPLinkAger(final long lldpInterval, final long linkExpirationTime,
-            final NotificationProviderService notificationService) {
-        this.linkExpirationTime = linkExpirationTime;
+    public LLDPLinkAger(final TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig,
+                        final NotificationProviderService notificationService,
+                        final ConfigurationService configurationService) {
+        this.linkExpirationTime = topologyLldpDiscoveryConfig.getTopologyLldpExpirationInterval().getValue();
         this.notificationService = notificationService;
+        this.configurationServiceRegistration = configurationService.registerListener(this);
         linkToDate = new ConcurrentHashMap<>();
         timer = new Timer();
-        timer.schedule(new LLDPAgingTask(), 0, lldpInterval);
+        timer.schedule(new LLDPAgingTask(), 0, topologyLldpDiscoveryConfig.getTopologyLldpInterval().getValue());
     }
 
     public void put(LinkDiscovered link) {
@@ -44,9 +54,10 @@ public class LLDPLinkAger implements AutoCloseable {
     }
 
     @Override
-    public void close() {
+    public void close() throws Exception {
         timer.cancel();
         linkToDate.clear();
+        configurationServiceRegistration.close();
     }
 
     private class LLDPAgingTask extends TimerTask {
@@ -75,5 +86,23 @@ public class LLDPLinkAger implements AutoCloseable {
         return linkToDate.isEmpty();
     }
 
-}
-
+    @Override
+    public void onPropertyChanged(@Nonnull final String propertyName, @Nonnull final String propertyValue) {
+        Optional.ofNullable(TopologyLLDPDiscoveryProperty.forValue(propertyName)).ifPresent(lldpDiscoveryProperty -> {
+            switch (lldpDiscoveryProperty) {
+                case LLDP_SECURE_KEY:
+                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
+                    break;
+                case TOPOLOGY_LLDP_INTERVAL:
+                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
+                    break;
+                case TOPOLOGY_LLDP_EXPIRATION_INTERVAL:
+                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
+                    break;
+                default:
+                    LOG.warn("No topology lldp discovery property found.");
+                    break;
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/TopologyLLDPDiscoveryProperty.java b/applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/TopologyLLDPDiscoveryProperty.java
new file mode 100644 (file)
index 0000000..ec54eab
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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
+ */
+package org.opendaylight.openflowplugin.applications.topology.lldp;
+
+import com.google.common.collect.ImmutableMap;
+
+import java.util.Map;
+
+public enum TopologyLLDPDiscoveryProperty {
+    LLDP_SECURE_KEY,
+    TOPOLOGY_LLDP_INTERVAL,
+    TOPOLOGY_LLDP_EXPIRATION_INTERVAL;
+
+    private static final Map<String, TopologyLLDPDiscoveryProperty> KEY_VALUE_MAP;
+
+    /**
+     * Get property type from property key.
+     *
+     * @param key the property key
+     * @return the property type
+     */
+    public static TopologyLLDPDiscoveryProperty forValue(final String key) {
+        return KEY_VALUE_MAP.get(key);
+    }
+
+    static {
+        final TopologyLLDPDiscoveryProperty[] values = values();
+        final ImmutableMap.Builder<String, TopologyLLDPDiscoveryProperty> builder = ImmutableMap.builder();
+
+        for (final TopologyLLDPDiscoveryProperty value : values) {
+            builder.put(value.toString(), value);
+        }
+
+        KEY_VALUE_MAP = builder.build();
+    }
+
+    /**
+     * Converts enum name to property key.
+     *
+     * @return the property key
+     */
+    @Override
+    public String toString() {
+        return this.name().toLowerCase().replace('_', '-');
+    }
+}
index b549b1d7562edd98aee9cc370ebecc9e5522ba7e..37749b9490165ce8c6fb136d6e586baa36cddd42 100644 (file)
@@ -5,30 +5,22 @@
         odl:use-default-for-reference-types="true">
 
   <reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
+  <reference id="configurationService" interface="org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService"/>
+
   <odl:clustered-app-config id="topologyLLDPConfig"
-                              binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig">
-        <odl:default-config><![CDATA[
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig">
+    <odl:default-config><![CDATA[
       <topology-lldp-discovery-config xmlns="urn:opendaylight:params:xml:ns:yang:topology-lldp-discovery:config">
         <lldp-secure-key>aa9251f8-c7c0-4322-b8d6-c3a84593bda3</lldp-secure-key>
       </topology-lldp-discovery-config>
     ]]></odl:default-config>
   </odl:clustered-app-config>
 
-  <cm:property-placeholder persistent-id="org.opendaylight.openflowplugin"
-                           update-strategy="none">
-    <cm:default-properties>
-      <!-- Interval to check LLDP links   -->
-      <cm:property name="topology-lldp-interval" value="5000"/>
-      <!-- Expiration interval for aging out links -->
-      <cm:property name="topology-lldp-expiration-interval" value="60000"/>
-    </cm:default-properties>
-  </cm:property-placeholder>
-
   <bean id="lldpLinkAger" class="org.opendaylight.openflowplugin.applications.topology.lldp.LLDPLinkAger"
           destroy-method="close">
-    <argument value="${topology-lldp-interval}"/>
-    <argument value="${topology-lldp-expiration-interval}"/>
+    <argument ref="topologyLLDPConfig"/>
     <argument ref="notificationService"/>
+    <argument ref="configurationService"/>
   </bean>
 
   <bean id="lldpDiscoveryListener" class="org.opendaylight.openflowplugin.applications.topology.lldp.LLDPDiscoveryListener">
@@ -40,8 +32,6 @@
          destroy-method="close">
     <argument ref="notificationService"/>
     <argument ref="lldpDiscoveryListener"/>
-    <argument>
-      <bean factory-ref="topologyLLDPConfig" factory-method="getLldpSecureKey"/>
-    </argument>
+    <argument ref="topologyLLDPConfig"/>
   </bean>
 </blueprint>
\ No newline at end of file
index 056fde6e684fb2410e3db12117f439c50d4497cd..8b107b82a08ff4f553e43653aac3f658f5cce55a 100644 (file)
@@ -12,18 +12,20 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.verify;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.Timer;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.NonZeroUint32Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfigBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,26 +41,19 @@ public class LLDPLinkAgerTest {
     private final long LLDP_INTERVAL = 5L;
     private final long LINK_EXPIRATION_TIME = 10L;
     /**
-     * We need to w8 while other tasks are finished before we can check anything
+     * We need to wait while other tasks are finished before we can check anything
      * in LLDPAgingTask
      */
     private final int SLEEP = 100;
 
-
     @Mock
     private LinkDiscovered link;
     @Mock
-    private Map<LinkDiscovered, Date> linkToDate;
-    @Mock
-    private Timer timer;
-    @Mock
     private NotificationProviderService notificationService;
-    @Mock
-    private LinkRemoved linkRemoved;
 
     @Before
     public void setUp() throws Exception {
-        lldpLinkAger = new LLDPLinkAger(LLDP_INTERVAL, LINK_EXPIRATION_TIME, notificationService);
+        lldpLinkAger = new LLDPLinkAger(getConfig(), notificationService, getConfigurationService());
     }
 
     @Test
@@ -69,7 +64,7 @@ public class LLDPLinkAgerTest {
     }
 
     @Test
-    public void testClose() {
+    public void testClose() throws Exception {
         lldpLinkAger.close();
         assertTrue(lldpLinkAger.isLinkToDateEmpty());
     }
@@ -83,4 +78,27 @@ public class LLDPLinkAgerTest {
         Thread.sleep(SLEEP);
         verify(notificationService).publish(Matchers.any(LinkRemoved.class));
     }
+
+    private TopologyLldpDiscoveryConfig getConfig() {
+        TopologyLldpDiscoveryConfigBuilder cfgBuilder = new TopologyLldpDiscoveryConfigBuilder();
+        cfgBuilder.setTopologyLldpInterval(new NonZeroUint32Type(LLDP_INTERVAL));
+        cfgBuilder.setTopologyLldpExpirationInterval(new NonZeroUint32Type(LINK_EXPIRATION_TIME));
+        return cfgBuilder.build();
+    }
+
+    private ConfigurationService getConfigurationService() {
+        final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class);
+        final TopologyLldpDiscoveryConfig config = getConfig();
+
+        Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> {
+        });
+
+        Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-interval"), Mockito.any()))
+                .thenReturn(config.getTopologyLldpInterval());
+
+        Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-expiration-interval"), Mockito.any()))
+                .thenReturn(config.getTopologyLldpExpirationInterval());
+
+        return configurationService;
+    }
 }
\ No newline at end of file
index bec60c4aa51a019e75799f12aeb22518d0825b85..7090ddaa7278a39fe6bcc88967ab7211d8ec6449 100644 (file)
@@ -138,7 +138,7 @@ public class TransactionChainManager implements TransactionChainListener, AutoCl
                     public void onFailure(@Nonnull final Throwable throwable) {
                         closeTransactionChain();
                     }
-                });
+                }, MoreExecutors.directExecutor());
             } else {
                 // ignoring redundant deactivate invocation
                 future = Futures.immediateFuture(null);
index 034245b55e336149c30b7499b886ce355c9bc34c..88d3fedd2b446d885d5e56b9726f83d4526c4141 100644 (file)
@@ -179,7 +179,7 @@ public class OpenFlowPluginProviderImpl implements
                 LOG.warn("Some switchConnectionProviders failed to start.", throwable);
                 openflowPluginStatusMonitor.reportStatus(ServiceState.ERROR, "some switch connections failed to start");
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private ListenableFuture<List<Boolean>> shutdownSwitchConnections() {
@@ -204,7 +204,7 @@ public class OpenFlowPluginProviderImpl implements
             public void onFailure(@Nonnull final Throwable throwable) {
                 LOG.warn("Some switchConnectionProviders failed to shutdown.", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return listListenableFuture;
     }
index f1240939eb9c3f9e18a9f5a23415b4f96e1706c5..4c553f5cfe092b2d87bef093322e7e9dfb1ac77e 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
@@ -154,7 +155,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
                     LOG.info("hello sending seriously failed [{}]", nextHelloXid);
                     LOG.trace("detail of hello send problem", throwable);
                 }
-            });
+            }, MoreExecutors.directExecutor());
         } else {
             stepByStepVersionSubStep(remoteVersion);
         }
@@ -221,7 +222,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
                 public void onFailure(Throwable throwable) {
                     // NOOP
                 }
-            });
+            }, MoreExecutors.directExecutor());
             LOG.trace("next proposal [{}] with versionBitmap hooked ..", nexHelloXid);
         } else {
             LOG.trace("ret - DONE - versionBitmap");
@@ -353,7 +354,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
                 resultFtr.cancel(false);
                 handshakeListener.onHandshakeFailure();
             }
-        });
+        }, MoreExecutors.directExecutor());
         LOG.trace("sending hello message [{}] - result hooked ..", helloXid);
         return resultFtr;
     }
@@ -411,7 +412,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
                                  connectionAdapter.getRemoteAddress(), throwable.getMessage());
                         LOG.trace("DETAIL of sending of hello failure:", throwable);
                     }
-                });
+                }, MoreExecutors.directExecutor());
         LOG.debug("future features [{}] hooked ..", xid);
     }
 
index 9ec64066e0c3655593c69a4e31f0c047661b6d05..d8b41b16fe7af7f5dc6b031a82e007f7b9f8444b 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus;
@@ -61,7 +62,7 @@ public class HandshakeListenerImpl implements HandshakeListener {
 
         // fire barrier in order to sweep all handshake and posthandshake messages before continue
         final ListenableFuture<RpcResult<BarrierOutput>> barrier = fireBarrier(version, 0L);
-        Futures.addCallback(barrier, addBarrierCallback());
+        Futures.addCallback(barrier, addBarrierCallback(), MoreExecutors.directExecutor());
     }
 
     private FutureCallback<RpcResult<BarrierOutput>> addBarrierCallback() {
index c2582a1d7f08fcd40b1119321a8d163f4b429acc..872a0df1fa5de427253b3f6303068f655ff17639 100644 (file)
@@ -573,7 +573,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                     transactionChainManager.close();
                     transactionChainManager = null;
                 }
-            });
+            }, MoreExecutors.directExecutor());
         }
 
         requestContexts.forEach(requestContext -> RequestContextUtil
@@ -630,7 +630,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         final ListenableFuture<List<com.google.common.base.Optional<FlowCapableNode>>> deviceFlowRegistryFill =
                 getDeviceFlowRegistry().fill();
         Futures.addCallback(deviceFlowRegistryFill,
-                new DeviceFlowRegistryCallback(deviceFlowRegistryFill, contextChainMastershipWatcher));
+                new DeviceFlowRegistryCallback(deviceFlowRegistryFill, contextChainMastershipWatcher),
+                MoreExecutors.directExecutor());
     }
 
     @VisibleForTesting
index 95c78e43a4e02056081387e64a2d0496da6a44a8..f53a7de315a272058b965bdc117b44514b0fd088 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.List;
 import java.util.concurrent.Future;
 import javax.annotation.Nonnull;
@@ -91,7 +92,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                 LOG.warn("Error occurred in preparation node {} for protocol 1.0", deviceInfo);
                 LOG.trace("Error for node {} : ", deviceInfo, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return Futures.transform(future, new Function<Boolean, Void>() {
             @Nullable
index 040baf299caa6fbd4761806fa86a513a856dfd3f..79efea886c66b99f3172e4c7834bbb82c0d8cc07 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.util.concurrent.AsyncFunction;
 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 java.util.Objects;
@@ -171,7 +172,7 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer {
                 LOG.warn("Request of type {} for static info of node {} failed.",
                         type, deviceContext.getDeviceInfo());
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     /**
index 139499838f3a1777e7bff151a1fec47ad1f24eb9..0c3b65e92012d49058f1ef04af73649b3a273246 100644 (file)
@@ -16,6 +16,7 @@ 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.Arrays;
 import java.util.Iterator;
@@ -147,7 +148,7 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
                 // Even when read operation failed, close the transaction
                 transaction.close();
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return future;
     }
index 2f9510aaafa73819767906db8f7dfb271afe2361..164e6ce153cdd15dcaf813144c310387b1a75097 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services;
 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.math.BigInteger;
 import java.util.Collection;
@@ -92,7 +93,7 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
                 LOG.info("onFailure - getGenerationIdFromDevice RPC error {}", throwable);
                 finalFuture.setException(new ExecutionException(throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
         return finalFuture;
     }
 
@@ -142,7 +143,7 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
                         getDeviceInfo().getNodeId(), ofpRole, throwable);
                 finalFuture.setException(throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return finalFuture;
     }
 
index 233bc00e2cc303aae6ecd081b2fbcd2340a7d2b7..2daac9636ba6d3d9032aa134af996698c6a9d0ff 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.annotations.VisibleForTesting;
 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.ArrayList;
 import java.util.List;
@@ -165,7 +166,7 @@ public class MultiLayerExperimenterMultipartService extends AbstractExperimenter
             }
         }
 
-        Futures.addCallback(multipartFuture, new CallBackImpl());
+        Futures.addCallback(multipartFuture, new CallBackImpl(), MoreExecutors.directExecutor());
 
         return finalFuture;
     }
index cc2c1995000a78a61010b2787c16b9a1427b27ef..9797e4ed0aa3e1700b543d4814f2c5cda58a9d36 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.multilayer;
 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.ArrayList;
 import java.util.Collections;
@@ -95,7 +96,7 @@ public final class MultiLayerFlowService<O extends DataObject> extends AbstractS
                 RpcResultBuilder<O> rpcResultBuilder = RpcResultBuilder.failed();
                 finalFuture.set(rpcResultBuilder.build());
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return finalFuture;
     }
index 727c417f803f49b0055ddb70746c083ba3506a0d..de51bc3e1823cedf677eec88b7a0f825e1fdf322 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.impl.services.multilayer;
 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.math.BigInteger;
 import java.util.ArrayList;
@@ -126,7 +127,7 @@ public class MultiLayerTableMultipartService extends AbstractTableMultipartServi
             }
         }
 
-        Futures.addCallback(multipartFuture, new CallBackImpl());
+        Futures.addCallback(multipartFuture, new CallBackImpl(), MoreExecutors.directExecutor());
 
         return finalFuture;
     }
index cc84e457af4db2c2087ad8b47446ae54bf63e5a0..8eee2f0ba92893ad61ccfc4acd756a90eb2a6536 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.ArrayList;
 import java.util.List;
@@ -103,7 +104,7 @@ public class SalBundleServiceImpl implements SalBundleService {
                 RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.failed();
                 result.set(rpcResultBuilder.build());
             }
-        });
+        }, MoreExecutors.directExecutor());
         return result;
     }
 }
\ No newline at end of file
index 6020c6d65d51ffe59da1382e4dd11f53ae327981..fa644af383204818d66758af8d50228f356544d6 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 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.ArrayList;
 import java.util.List;
@@ -88,10 +89,10 @@ public class SalFlowServiceImpl implements SalFlowService {
 
         if (flowAddMessage.canUseSingleLayerSerialization()) {
             future = flowAddMessage.handleServiceCall(input);
-            Futures.addCallback(future, new AddFlowCallback(input, flowRegistryKey));
+            Futures.addCallback(future, new AddFlowCallback(input, flowRegistryKey), MoreExecutors.directExecutor());
         } else {
             future = flowAdd.processFlowModInputBuilders(flowAdd.toFlowModInputs(input));
-            Futures.addCallback(future, new AddFlowCallback(input, flowRegistryKey));
+            Futures.addCallback(future, new AddFlowCallback(input, flowRegistryKey), MoreExecutors.directExecutor());
 
         }
         return future;
@@ -103,11 +104,11 @@ public class SalFlowServiceImpl implements SalFlowService {
 
         if (flowRemoveMessage.canUseSingleLayerSerialization()) {
             future = flowRemoveMessage.handleServiceCall(input);
-            Futures.addCallback(future, new RemoveFlowCallback(input));
+            Futures.addCallback(future, new RemoveFlowCallback(input), MoreExecutors.directExecutor());
 
         } else {
             future = flowRemove.processFlowModInputBuilders(flowRemove.toFlowModInputs(input));
-            Futures.addCallback(future, new RemoveFlowCallback(input));
+            Futures.addCallback(future, new RemoveFlowCallback(input), MoreExecutors.directExecutor());
         }
 
         return future;
@@ -160,7 +161,7 @@ public class SalFlowServiceImpl implements SalFlowService {
                         RpcResultBuilder<UpdateFlowOutput> rpcResultBuilder = RpcResultBuilder.failed();
                         objectSettableFuture.set(rpcResultBuilder.build());
                     }
-                });
+                }, MoreExecutors.directExecutor());
 
                 future = objectSettableFuture;
             } else {
@@ -186,7 +187,7 @@ public class SalFlowServiceImpl implements SalFlowService {
             future = flowUpdate.processFlowModInputBuilders(allFlowMods);
         }
 
-        Futures.addCallback(future, new UpdateFlowCallback(input));
+        Futures.addCallback(future, new UpdateFlowCallback(input), MoreExecutors.directExecutor());
         return future;
     }
 
index 07d70fcce89cb31e75281a9aba131041babc5250..042e5a8cd22854733f1b26f2f47803fdcff9df62 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 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.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
@@ -93,7 +94,7 @@ public class SalGroupServiceImpl implements SalGroupService {
                           input.getGroupId().getValue(),
                           throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
@@ -125,7 +126,7 @@ public class SalGroupServiceImpl implements SalGroupService {
                 LOG.warn("Service call for updating group={} failed, reason: {}",
                         input.getOriginalGroup().getGroupId(), throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
@@ -156,7 +157,7 @@ public class SalGroupServiceImpl implements SalGroupService {
                 LOG.warn("Service call for removing group={} failed, reason: {}",
                         input.getGroupId().getValue(), throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
index c17cb78f74c487c06eaf835426036f425756643d..e1b5a0f7aab224929a09628d7a10675be047fc8a 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 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.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
@@ -91,7 +92,7 @@ public class SalMeterServiceImpl implements SalMeterService {
             public void onFailure(Throwable throwable) {
                 LOG.warn("Service call for adding meter={} failed, reason: {}", input.getMeterId(), throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
@@ -123,7 +124,7 @@ public class SalMeterServiceImpl implements SalMeterService {
                 LOG.warn("Service call for updating meter={} failed, reason: {}",
                         input.getOriginalMeter().getMeterId(),throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
@@ -153,7 +154,7 @@ public class SalMeterServiceImpl implements SalMeterService {
             public void onFailure(Throwable throwable) {
                 LOG.warn("Service call for removing meter={} failed, reason: {}",input.getMeterId(),throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return resultFuture;
     }
 
index f3a55fc508b96a991eacc2ab3565533239f9927a..7bb135e96acc7b3a684e947ebf5bb2c354ce3dab 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.singlelayer;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import java.util.concurrent.Future;
@@ -90,7 +91,7 @@ public class SingleLayerExperimenterMultipartService extends AbstractExperimente
                 future.set(RpcResultBuilder.<SendExperimenterMpRequestOutput>failed()
                         .withError(ErrorType.RPC, "Future error", throwable).build());
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return future;
     }
index 3d08bfd541365ae66f79aec949649bf266aeb80c..567213447fe393aba980d194ac6f4c2666964a1f 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.impl.services.singlelayer;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.math.BigInteger;
 import java.util.List;
@@ -108,7 +109,7 @@ public class SingleLayerTableMultipartService extends AbstractTableMultipartServ
                 finalFuture.set(RpcResultBuilder.<UpdateTableOutput>failed()
                     .withError(ErrorType.RPC, "Future error", throwable).build());
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return finalFuture;
     }
index 1893770a06b89d7e6a7b007c88b84608d5747dca..89beb9527baca1703fae7b4e19143008c9a82b00 100644 (file)
@@ -15,6 +15,7 @@ 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.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -177,7 +178,7 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
         }
 
         collectingStatType = ImmutableList.copyOf(statListForCollecting);
-        Futures.addCallback(gatherDynamicData(), new InitialSubmitCallback());
+        Futures.addCallback(gatherDynamicData(), new InitialSubmitCallback(), MoreExecutors.directExecutor());
     }
 
     @Override
@@ -199,7 +200,7 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
                 requestContexts.forEach(requestContext -> RequestContextUtil
                         .closeRequestContextWithRpcError(requestContext, CONNECTION_CLOSED));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private ListenableFuture<Boolean> gatherDynamicData() {
@@ -235,7 +236,7 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
                         StatisticsGatheringUtils.markDeviceStateSnapshotEnd(deviceInfo, deviceContext, false);
                     }
                 }
-            });
+            }, MoreExecutors.directExecutor());
 
             return newDataGathering;
         });
index 2695ecb1ed6171e29ef50b18ec49590b674dd3fa..606ad25bb570ed4ad8658fe4a72274b9463580df 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 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.List;
 import java.util.concurrent.atomic.AtomicLong;
@@ -82,7 +83,7 @@ public abstract class AbstractCompatibleStatService<I extends DataContainer, O,
                 LOG.debug("compatibility callback crashed - NOT emitting notification: {}",
                         input.getClass().getSimpleName(), throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return RpcResultBuilder.<O>success(buildTxCapableResult(emulatedTxId)).buildFuture();
     }
index 866080481dd275fbc4c2f57c83b37738e88f88d0..e4ff8c1b4110e877720c0f7a22d8a314b1052dcc 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.base.Optional;
 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.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -336,7 +337,7 @@ public class OFPluginFlowTest {
             public void onFailure(Throwable throwable) {
                 LOG.error("Write of flow on device failed.", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     //TODO move to separate test util class
index f88532521c21d3ce7344e887961d908954909faa..3e91cd419148a104a0c7666e2c0606eb6e406a41 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.math.BigInteger;
 import java.util.concurrent.Callable;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
@@ -119,7 +120,7 @@ public class DropTestRpcSender extends AbstractDropTest {
             public void onFailure(final Throwable throwable) {
                 countFutureError();
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     /**
index f352a7d7b65f758b44f63c27e4abf8a5f4b71ae1..c313f52778e598ee43f9c0e42da2f5b718bb239c 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
@@ -106,8 +107,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-//import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.M
-
 public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvider {
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkGroupTransactionProvider.class);
     private NodeBuilder testNode;
@@ -762,7 +761,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) {
@@ -788,7 +787,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private GroupBuilder createTestGroup(String actiontype, String type, String mod, String iD) {
index 01d9413155aca36b1a1e2ecc453c458b4ad64bad..2123b8d4556e88598673c9b0370abab9df1c5b9f 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
@@ -117,8 +118,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-//import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.M
-
 public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkTransactionProvider.class);
@@ -687,7 +686,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
                 LOG.error(throwable.getMessage(), throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
 
     }
 
@@ -736,7 +735,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
                 LOG.error(throwable.getMessage(), throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     /**
index d1cb507ee822f424f7c39ad12a2f3f6f50abbf7e..868f27bd6b10dbc461c03ba426af4a97fe6b7d69 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
@@ -638,7 +639,7 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _addGroup(CommandInterpreter ci) {
@@ -673,7 +674,7 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _modifyGroup(CommandInterpreter ci) {
index db17b24e1c8de2d395d71548baec25748f732ff8..35a34a6ba7b27b6c2dd06a65064a51bba1883ffa 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
@@ -240,7 +241,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _removeMeters(final CommandInterpreter ci) {
@@ -321,7 +322,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _addMeter(CommandInterpreter ci) {
@@ -393,7 +394,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void writeMeter(final CommandInterpreter ci, Meter meter, Meter meter1) {
@@ -418,7 +419,7 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _modifyMeter(CommandInterpreter ci) {
index e485d1307965683055da8843f40a347e047c77b5..847c95f3d328943551c9fd3c180d4c1a2eabb963 100644 (file)
@@ -10,6 +10,7 @@ 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.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -598,7 +599,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
             public void onFailure(Throwable throwable) {
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _modifyTable(CommandInterpreter ci) {
index 29fd07aa95837d5b00a30cadfe3256ec89ec1d9c..5a13a7b6270185b602772f2682f0c709779b7321 100644 (file)
@@ -11,6 +11,7 @@ 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.MoreExecutors;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -3251,7 +3252,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
                 LOG.error(throwable.getMessage(), throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     /**
@@ -3292,7 +3293,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
                 LOG.error(throwable.getMessage(), throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void _modifyMDFlow(final CommandInterpreter ci) {