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;
public void onFailure(Throwable throwable) {
LOG.error("Stale Flow creation failed {}", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
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;
+ ", id=" + groupId;
LOG.debug(msg, cause);
}
- });
+ }, MoreExecutors.directExecutor());
map.put(groupId, future);
}
public void onFailure(Throwable throwable) {
LOG.debug("Stale entity removal failed {}", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
private Flow getDeleteAllFlow() {
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;
public void onFailure(Throwable throwable) {
LOG.error("Stale Group creation failed {}", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
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;
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
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;
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;
}
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;
if (LOG.isDebugEnabled()) {
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
- createCounterCallback(batchBag, batchOrder, counters));
+ createCounterCallback(batchBag, batchOrder, counters), MoreExecutors.directExecutor());
}
return Futures.transform(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
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;
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 {
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 {
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>>() {
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 {
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 {
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;
}
<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>
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;
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);
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) {
}
@Override
- public void close() {
+ public void close() throws Exception {
timer.cancel();
linkToDate.clear();
+ configurationServiceRegistration.close();
}
private class LLDPAgingTask extends TimerTask {
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
--- /dev/null
+/**
+ * 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('_', '-');
+ }
+}
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">
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
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;
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
}
@Test
- public void testClose() {
+ public void testClose() throws Exception {
lldpLinkAger.close();
assertTrue(lldpLinkAger.isLinkToDateEmpty());
}
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
public void onFailure(@Nonnull final Throwable throwable) {
closeTransactionChain();
}
- });
+ }, MoreExecutors.directExecutor());
} else {
// ignoring redundant deactivate invocation
future = Futures.immediateFuture(null);
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() {
public void onFailure(@Nonnull final Throwable throwable) {
LOG.warn("Some switchConnectionProviders failed to shutdown.", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return listListenableFuture;
}
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;
LOG.info("hello sending seriously failed [{}]", nextHelloXid);
LOG.trace("detail of hello send problem", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
} else {
stepByStepVersionSubStep(remoteVersion);
}
public void onFailure(Throwable throwable) {
// NOOP
}
- });
+ }, MoreExecutors.directExecutor());
LOG.trace("next proposal [{}] with versionBitmap hooked ..", nexHelloXid);
} else {
LOG.trace("ret - DONE - versionBitmap");
resultFtr.cancel(false);
handshakeListener.onHandshakeFailure();
}
- });
+ }, MoreExecutors.directExecutor());
LOG.trace("sending hello message [{}] - result hooked ..", helloXid);
return resultFtr;
}
connectionAdapter.getRemoteAddress(), throwable.getMessage());
LOG.trace("DETAIL of sending of hello failure:", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
LOG.debug("future features [{}] hooked ..", xid);
}
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;
// 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() {
transactionChainManager.close();
transactionChainManager = null;
}
- });
+ }, MoreExecutors.directExecutor());
}
requestContexts.forEach(requestContext -> RequestContextUtil
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
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;
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
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;
LOG.warn("Request of type {} for static info of node {} failed.",
type, deviceContext.getDeviceInfo());
}
- });
+ }, MoreExecutors.directExecutor());
}
/**
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;
// Even when read operation failed, close the transaction
transaction.close();
}
- });
+ }, MoreExecutors.directExecutor());
return future;
}
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;
LOG.info("onFailure - getGenerationIdFromDevice RPC error {}", throwable);
finalFuture.setException(new ExecutionException(throwable));
}
- });
+ }, MoreExecutors.directExecutor());
return finalFuture;
}
getDeviceInfo().getNodeId(), ofpRole, throwable);
finalFuture.setException(throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return finalFuture;
}
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;
}
}
- Futures.addCallback(multipartFuture, new CallBackImpl());
+ Futures.addCallback(multipartFuture, new CallBackImpl(), MoreExecutors.directExecutor());
return finalFuture;
}
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;
RpcResultBuilder<O> rpcResultBuilder = RpcResultBuilder.failed();
finalFuture.set(rpcResultBuilder.build());
}
- });
+ }, MoreExecutors.directExecutor());
return finalFuture;
}
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;
}
}
- Futures.addCallback(multipartFuture, new CallBackImpl());
+ Futures.addCallback(multipartFuture, new CallBackImpl(), MoreExecutors.directExecutor());
return finalFuture;
}
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;
RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.failed();
result.set(rpcResultBuilder.build());
}
- });
+ }, MoreExecutors.directExecutor());
return result;
}
}
\ No newline at end of file
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;
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;
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;
RpcResultBuilder<UpdateFlowOutput> rpcResultBuilder = RpcResultBuilder.failed();
objectSettableFuture.set(rpcResultBuilder.build());
}
- });
+ }, MoreExecutors.directExecutor());
future = objectSettableFuture;
} else {
future = flowUpdate.processFlowModInputBuilders(allFlowMods);
}
- Futures.addCallback(future, new UpdateFlowCallback(input));
+ Futures.addCallback(future, new UpdateFlowCallback(input), MoreExecutors.directExecutor());
return future;
}
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;
input.getGroupId().getValue(),
throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
LOG.warn("Service call for updating group={} failed, reason: {}",
input.getOriginalGroup().getGroupId(), throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
LOG.warn("Service call for removing group={} failed, reason: {}",
input.getGroupId().getValue(), throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
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;
public void onFailure(Throwable throwable) {
LOG.warn("Service call for adding meter={} failed, reason: {}", input.getMeterId(), throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
LOG.warn("Service call for updating meter={} failed, reason: {}",
input.getOriginalMeter().getMeterId(),throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
public void onFailure(Throwable throwable) {
LOG.warn("Service call for removing meter={} failed, reason: {}",input.getMeterId(),throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return resultFuture;
}
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;
future.set(RpcResultBuilder.<SendExperimenterMpRequestOutput>failed()
.withError(ErrorType.RPC, "Future error", throwable).build());
}
- });
+ }, MoreExecutors.directExecutor());
return future;
}
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;
finalFuture.set(RpcResultBuilder.<UpdateTableOutput>failed()
.withError(ErrorType.RPC, "Future error", throwable).build());
}
- });
+ }, MoreExecutors.directExecutor());
return finalFuture;
}
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;
}
collectingStatType = ImmutableList.copyOf(statListForCollecting);
- Futures.addCallback(gatherDynamicData(), new InitialSubmitCallback());
+ Futures.addCallback(gatherDynamicData(), new InitialSubmitCallback(), MoreExecutors.directExecutor());
}
@Override
requestContexts.forEach(requestContext -> RequestContextUtil
.closeRequestContextWithRpcError(requestContext, CONNECTION_CLOSED));
}
- });
+ }, MoreExecutors.directExecutor());
}
private ListenableFuture<Boolean> gatherDynamicData() {
StatisticsGatheringUtils.markDeviceStateSnapshotEnd(deviceInfo, deviceContext, false);
}
}
- });
+ }, MoreExecutors.directExecutor());
return newDataGathering;
});
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;
LOG.debug("compatibility callback crashed - NOT emitting notification: {}",
input.getClass().getSimpleName(), throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return RpcResultBuilder.<O>success(buildTxCapableResult(emulatedTxId)).buildFuture();
}
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;
public void onFailure(Throwable throwable) {
LOG.error("Write of flow on device failed.", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
//TODO move to separate test util class
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;
public void onFailure(final Throwable throwable) {
countFutureError();
}
- });
+ }, MoreExecutors.directExecutor());
}
/**
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;
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;
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) {
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) {
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;
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);
LOG.error(throwable.getMessage(), throwable);
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
- });
+ }, MoreExecutors.directExecutor());
}
LOG.error(throwable.getMessage(), throwable);
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
- });
+ }, MoreExecutors.directExecutor());
}
/**
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;
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) {
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) {
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;
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) {
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) {
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) {
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) {
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;
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) {
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;
LOG.error(throwable.getMessage(), throwable);
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
- });
+ }, MoreExecutors.directExecutor());
}
/**
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) {