new RejectedExecutionException(MESSAGE));
}
+ /**
+ * About to stop services in cluster not master anymore or going down.
+ * @return Future most of services need time to be closed.
+ */
+ default ListenableFuture<Void> stopClusterServices() {
+ return stopClusterServices(false);
+ }
+
/**
* Get cluster singleton service identifier.
* @return cluster singleton service identifier.
import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
/**
* Connection manager manages connections with devices.
* device is connected.
* @param deviceConnectedHandler device connected handler
*/
- void setDeviceConnectedHandler(DeviceConnectedHandler deviceConnectedHandler);
+ void setDeviceConnectedHandler(final DeviceConnectedHandler deviceConnectedHandler);
+
+ /**
+ * Method registers handler responsible handling device disconnected event
+ * @param deviceDisconnectedHandler device disconnected handler
+ */
+ void setDeviceDisconnectedHandler(final DeviceDisconnectedHandler deviceDisconnectedHandler);
/**
* Setter for echo reply timeout.
*/
void setSalRoleService(@Nonnull final SalRoleService salRoleService);
+ void masterSuccessful();
+
/**
* Make device slave.
* @return listenable future from sal role service
*/
public interface DeviceManager extends
OFPManager,
- DeviceConnectedHandler,
DeviceDisconnectedHandler,
TranslatorLibrarian {
package org.opendaylight.openflowplugin.api.openflow.lifecycle;
import com.google.common.util.concurrent.ListenableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowplugin.api.openflow.OFPContext;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.ContextChainState;
/**
/**
* Stop the working contexts, but not release them
* @return Future
+ * @param connectionDropped
*/
- Future<Void> stopChain();
+ ListenableFuture<Void> stopChain(boolean connectionDropped);
/**
* Start the contexts, if some context is missing or cant be started returns failed future
* @return Future
*/
- Future<Void> startChain();
+ ListenableFuture<Void> startChain();
@Override
void close();
*/
void changePrimaryConnection(final ConnectionContext connectionContext);
- ListenableFuture<Void> connectionDropped() throws ExecutionException, InterruptedException;
+ ListenableFuture<Void> connectionDropped();
ContextChainState getContextChainState();
void registerServices(@NonNull final ClusterSingletonServiceProvider clusterSingletonServiceProvider);
void makeDeviceSlave();
+
+ void closePrimaryConnection();
+
+ DeviceContext provideDeviceContext();
}
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
/**
* Generic interface for context chain holder, hold all created context chains.
*/
-public interface ContextChainHolder extends DeviceConnectedHandler, MastershipChangeListener {
+public interface ContextChainHolder extends
+ DeviceConnectedHandler,
+ MastershipChangeListener,
+ DeviceDisconnectedHandler {
<T extends OFPManager> void addManager(final T manager);
ContextChain createContextChain(final ConnectionContext connectionContext);
statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOn, hashedWheelTimer,
convertorManager,basicTimerDelay,maximumTimerDelay);
- /* Initialization Phase ordering - OFP Device Context suite */
- // CM -> DM -> SM -> RPC -> Role -> DM
// Device connection handler moved from device manager to context holder
connectionManager.setDeviceConnectedHandler(contextChainHolder);
- deviceManager.setDeviceInitializationPhaseHandler(statisticsManager);
- statisticsManager.setDeviceInitializationPhaseHandler(rpcManager);
- rpcManager.setDeviceInitializationPhaseHandler(deviceManager);
/* Termination Phase ordering - OFP Device Context suite */
- deviceManager.setDeviceTerminationPhaseHandler(rpcManager);
- rpcManager.setDeviceTerminationPhaseHandler(statisticsManager);
- statisticsManager.setDeviceTerminationPhaseHandler(deviceManager);
+ connectionManager.setDeviceDisconnectedHandler(contextChainHolder);
rpcManager.setStatisticsRpcEnabled(isStatisticsRpcEnabled);
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionManager;
import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeListener;
import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeManager;
private DeviceConnectedHandler deviceConnectedHandler;
private long echoReplyTimeout;
private final ThreadPoolExecutor threadPool;
+ private DeviceDisconnectedHandler deviceDisconnectedHandler;
public ConnectionManagerImpl(long echoReplyTimeout, final ThreadPoolExecutor threadPool) {
this.echoReplyTimeout = echoReplyTimeout;
public void onSwitchConnected(final ConnectionAdapter connectionAdapter) {
LOG.trace("prepare connection context");
final ConnectionContext connectionContext = new ConnectionContextImpl(connectionAdapter);
+ connectionContext.setDeviceDisconnectedHandler(this.deviceDisconnectedHandler);
HandshakeListener handshakeListener = new HandshakeListenerImpl(connectionContext, deviceConnectedHandler);
final HandshakeManager handshakeManager = createHandshakeManager(connectionAdapter, handshakeListener);
this.deviceConnectedHandler = deviceConnectedHandler;
}
+ @Override
+ public void setDeviceDisconnectedHandler(final DeviceDisconnectedHandler deviceDisconnectedHandler) {
+ this.deviceDisconnectedHandler = deviceDisconnectedHandler;
+ }
+
public void setEchoReplyTimeout(long echoReplyTimeout){
this.echoReplyTimeout = echoReplyTimeout;
}
@Override
public synchronized void onConnectionQueueChanged(final OutboundQueue queue) {
- LOG.debug("Replacing queue {} with {}", outboundQueue, queue);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Replacing queue {} with {}", outboundQueue, queue);
+ }
outboundQueue = queue;
notifyAll();
}
@Override
public Long reserveEntry() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Reserve entry with queue: {} in this {} implementation", outboundQueue, this);
+ }
for (;;) {
OutboundQueue queue = outboundQueue;
if (queue == null) {
// Timeout in seconds after what we will give up on propagating role
private static final int SET_ROLE_TIMEOUT = 10;
+ private static final int LOW_WATERMARK = 1000;
+ private static final int HIGH_WATERMARK = 2000;
+
private boolean initialized;
private SalRoleService salRoleService = null;
private final HashedWheelTimer hashedWheelTimer;
- private ConnectionContext primaryConnectionContext;
+ private volatile ConnectionContext primaryConnectionContext;
private final DeviceState deviceState;
private final DataBroker dataBroker;
private final Map<SwitchConnectionDistinguisher, ConnectionContext> auxiliaryConnectionContexts;
private DeviceFlowRegistry deviceFlowRegistry;
private DeviceGroupRegistry deviceGroupRegistry;
private DeviceMeterRegistry deviceMeterRegistry;
- private final PacketInRateLimiter packetInLimiter;
+ private PacketInRateLimiter packetInLimiter;
private final MessageSpy messageSpy;
private final ItemLifeCycleKeeper flowLifeCycleKeeper;
private NotificationPublishService notificationPublishService;
private ExtensionConverterProvider extensionConverterProvider;
private boolean skipTableFeatures;
private boolean switchFeaturesMandatory;
- private final DeviceInfo deviceInfo;
+ private DeviceInfo deviceInfo;
private final ConvertorExecutor convertorExecutor;
private volatile CONTEXT_STATE state;
private ClusterInitializationPhaseHandler clusterInitializationPhaseHandler;
private final DeviceInitializerProvider deviceInitializerProvider;
private final boolean useSingleLayerSerialization;
private Boolean isAddNotificationSent = false;
+ private OutboundQueueProvider outboundQueueProvider;
+ private boolean wasOnceMaster;
DeviceContextImpl(
@Nonnull final ConnectionContext primaryConnectionContext,
final DeviceInitializerProvider deviceInitializerProvider) {
this.primaryConnectionContext = primaryConnectionContext;
+ this.outboundQueueProvider = (OutboundQueueProvider) primaryConnectionContext.getOutboundQueueProvider();
this.deviceInfo = primaryConnectionContext.getDeviceInfo();
this.hashedWheelTimer = hashedWheelTimer;
this.deviceInitializerProvider = deviceInitializerProvider;
this.messageSpy = Preconditions.checkNotNull(messageSpy);
this.packetInLimiter = new PacketInRateLimiter(primaryConnectionContext.getConnectionAdapter(),
- /*initial*/ 1000, /*initial*/2000, this.messageSpy, REJECTED_DRAIN_FACTOR);
+ /*initial*/ LOW_WATERMARK, /*initial*/HIGH_WATERMARK, this.messageSpy, REJECTED_DRAIN_FACTOR);
this.translatorLibrary = translatorLibrary;
this.portStatusTranslator = translatorLibrary.lookupTranslator(
this.skipTableFeatures = skipTableFeatures;
this.useSingleLayerSerialization = useSingleLayerSerialization;
this.initialized = false;
+ this.wasOnceMaster = false;
}
@Override
public void onPublished() {
Verify.verify(CONTEXT_STATE.INITIALIZATION.equals(getState()));
this.state = CONTEXT_STATE.WORKING;
- primaryConnectionContext.getConnectionAdapter().setPacketInFiltering(false);
+ synchronized (primaryConnectionContext) {
+ primaryConnectionContext.getConnectionAdapter().setPacketInFiltering(false);
+ }
for (final ConnectionContext switchAuxConnectionContext : auxiliaryConnectionContexts.values()) {
switchAuxConnectionContext.getConnectionAdapter().setPacketInFiltering(false);
}
}
@Override
- public void replaceConnection(final ConnectionContext connectionContext) {
+ public synchronized void replaceConnection(final ConnectionContext connectionContext) {
+
+ primaryConnectionContext = null;
+ deviceInfo = null;
+ packetInLimiter = null;
+
+ primaryConnectionContext = connectionContext;
+ deviceInfo = primaryConnectionContext.getDeviceInfo();
- connectionContext.getConnectionAdapter().setPacketInFiltering(true);
+ packetInLimiter = new PacketInRateLimiter(primaryConnectionContext.getConnectionAdapter(),
+ /*initial*/ LOW_WATERMARK, /*initial*/HIGH_WATERMARK, messageSpy, REJECTED_DRAIN_FACTOR);
- final OutboundQueueProvider outboundQueueProvider
- = new OutboundQueueProviderImpl(connectionContext.getDeviceInfo().getVersion());
+ primaryConnectionContext.setOutboundQueueProvider(outboundQueueProvider);
- connectionContext.setOutboundQueueProvider(outboundQueueProvider);
final OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration =
- connectionContext.getConnectionAdapter().registerOutboundQueueHandler(
+ primaryConnectionContext.getConnectionAdapter().registerOutboundQueueHandler(
outboundQueueProvider,
- this.myManager.getBarrierCountLimit(),
- this.myManager.getBarrierIntervalNanos());
- connectionContext.setOutboundQueueHandleRegistration(outboundQueueHandlerRegistration);
+ myManager.getBarrierCountLimit(),
+ myManager.getBarrierIntervalNanos());
- this.salRoleService = new SalRoleServiceImpl(this, this);
+ primaryConnectionContext.setOutboundQueueHandleRegistration(outboundQueueHandlerRegistration);
final OpenflowProtocolListenerFullImpl messageListener = new OpenflowProtocolListenerFullImpl(
- connectionContext.getConnectionAdapter(), this);
+ primaryConnectionContext.getConnectionAdapter(), this);
- connectionContext.getConnectionAdapter().setMessageListener(messageListener);
+ primaryConnectionContext.getConnectionAdapter().setMessageListener(messageListener);
LOG.info("ConnectionEvent: Connection on device:{}, NodeId:{} switched.",
- connectionContext.getConnectionAdapter().getRemoteAddress(),
- connectionContext.getDeviceInfo().getNodeId());
+ primaryConnectionContext.getConnectionAdapter().getRemoteAddress(),
+ primaryConnectionContext.getDeviceInfo().getNodeId());
}
}
});
- return Futures.transform(deactivateTxManagerFuture, (AsyncFunction<Void, Void>) aVoid -> {
- // Add fallback to remove device from operational DS if setting slave fails
- return Futures.withFallback(makeSlaveFuture, t ->
- myManager.removeDeviceFromOperationalDS(deviceInfo));
- });
- } else {
- return Futures.transform(deactivateTxManagerFuture, (AsyncFunction<Void, Void>) aVoid ->
- myManager.removeDeviceFromOperationalDS(deviceInfo));
}
+
+ return deactivateTxManagerFuture;
}
@Override
}
@Override
- public boolean onContextInstantiateService(final MastershipChangeListener mastershipChangeListener) {
+ public void masterSuccessful(){
+ this.wasOnceMaster = true;
+ }
- if (getPrimaryConnectionContext().getConnectionState().equals(ConnectionContext.CONNECTION_STATE.RIP)) {
- LOG.warn("Connection on device {} was interrupted, will stop starting master services.",
- deviceInfo.getLOGValue());
- return false;
- }
+ @Override
+ public boolean onContextInstantiateService(final MastershipChangeListener mastershipChangeListener) {
LOG.info("Starting device context cluster services for node {}", deviceInfo.getLOGValue());
private final DeviceInitializerProvider deviceInitializerProvider;
private final ConvertorExecutor convertorExecutor;
private TranslatorLibrary translatorLibrary;
- private DeviceInitializationPhaseHandler deviceInitPhaseHandler;
private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
private final ConcurrentMap<DeviceInfo, DeviceContext> deviceContexts = new ConcurrentHashMap<>();
@Override
public void setDeviceInitializationPhaseHandler(final DeviceInitializationPhaseHandler handler) {
- this.deviceInitPhaseHandler = handler;
}
@Override
lifecycleService.registerDeviceRemovedHandler(this);
}
- @Override
- public ConnectionStatus deviceConnected(@CheckForNull final ConnectionContext connectionContext) throws Exception {
- return ConnectionStatus.MAY_CONTINUE;
- }
-
@Override
public TranslatorLibrary oook() {
return translatorLibrary;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowplugin.api.openflow.OFPManager;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.ContextChainState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.openflow.provider.config.ContextChainConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleOutput;
-import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
ContextChain chain = contextChainMap.get(deviceInfo);
if (Objects.nonNull(chain)) {
chain.close();
+ try {
+ deviceManager.removeDeviceFromOperationalDS(deviceInfo).checkedGet(5L, TimeUnit.SECONDS);
+ } catch (TimeoutException | TransactionCommitFailedException e) {
+ LOG.warn("Not able to remove device {} from DS", deviceInfo.getLOGValue());
+ }
}
}
@Override
public void pairConnection(final ConnectionContext connectionContext) {
DeviceInfo deviceInfo = connectionContext.getDeviceInfo();
- latestConnections.put(deviceInfo, connectionContext);
- if (checkChainContext(deviceInfo)) {
- contextChainMap.get(deviceInfo).changePrimaryConnection(connectionContext);
+ ContextChain contextChain = contextChainMap.get(deviceInfo);
+ if (Objects.nonNull(contextChain)) {
+ contextChain.changePrimaryConnection(connectionContext);
+ contextChain.makeDeviceSlave();
}
}
if (Objects.nonNull(contextChain)) {
LOG.warn("Not able to set MASTER role on device {}", deviceInfo.getLOGValue());
if (contextChain.getContextChainState().equals(ContextChainState.INITIALIZED)) {
- contextChain.getPrimaryConnectionContext().closeConnection(false);
+ contextChain.closePrimaryConnection();
} else {
contextChain.sleepTheChainAndDropConnection();
}
LOG.info("Device {} has not finish initial gathering yet.",
deviceInfo.getLOGValue());
}
- contextChain.startChain();
+ Futures.addCallback(contextChain.startChain(),
+ new StartStopChainCallback(contextChain.provideDeviceContext(), false));
}
}
}
public void onSlaveRoleAcquired(final DeviceInfo deviceInfo) {
ContextChain contextChain = contextChainMap.get(deviceInfo);
if (Objects.nonNull(contextChain)) {
- if (contextChain.getContextChainState().equals(ContextChainState.INITIALIZED)) {
- contextChain.registerServices(this.singletonServicesProvider);
- } else {
- contextChain.stopChain();
- }
+// if (contextChain.getContextChainState().equals(ContextChainState.INITIALIZED)) {
+// contextChain.registerServices(this.singletonServicesProvider);
+// } else {
+// Futures.addCallback(contextChain.stopChain(false),
+// new StartStopChainCallback(contextChain.provideDeviceContext(), true));
+// }
+ contextChain.registerServices(this.singletonServicesProvider);
}
}
}
}
+ @Override
+ public void onDeviceDisconnected(final ConnectionContext connectionContext) {
+
+ if (Objects.isNull(connectionContext.getDeviceInfo())) {
+ LOG.info("Non existing device info. Cannot close context chain.");
+ } else {
+ LOG.info("Device {} disconnected.", connectionContext.getDeviceInfo().getLOGValue());
+ ContextChain chain = contextChainMap.get(connectionContext.getDeviceInfo());
+ if (Objects.isNull(chain)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("There was no context chain created yet for the disconnected device {}",
+ connectionContext.getDeviceInfo().getLOGValue());
+ }
+ } else {
+ Futures.addCallback(chain.connectionDropped(),
+ new StartStopChainCallback(null, true));
+ }
+ }
+ }
+
private boolean checkAllManagers() {
return Objects.nonNull(deviceManager) && Objects.nonNull(rpcManager) && Objects.nonNull(statisticsManager);
}
return contextChainMap.containsKey(deviceInfo);
}
+ private class StartStopChainCallback implements FutureCallback<Void> {
+
+ private final String deviceInfo;
+ private final String stop;
+ private final String stopped;
+ private final boolean start;
+ private final DeviceContext deviceContext;
+
+ StartStopChainCallback(final DeviceContext deviceContext, final boolean stop) {
+
+ this.deviceInfo = Objects.nonNull(deviceContext) ? deviceContext.getDeviceInfo().getLOGValue() : "null";
+ this.stop = stop ? "stop" : "start";
+ this.stopped = stop ? "stopped" : "started";
+ this.start = !stop;
+ this.deviceContext = deviceContext;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Void aVoid) {
+ LOG.info("Context chain for device {} successfully {}", deviceInfo, stopped);
+// if (start && Objects.nonNull(deviceContext)) {
+// deviceContext.masterSuccessful();
+// }
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ LOG.warn("Not able to {} the context chain for device {}", stop, deviceInfo);
+ }
+ }
+
}
}
@Override
- public ListenableFuture<Void> stopChain() {
+ public ListenableFuture<Void> stopChain(boolean connectionDropped) {
//TODO: stopClusterServices change parameter
final List<ListenableFuture<Void>> futureList = new ArrayList<>();
- futureList.add(statisticsContext.stopClusterServices(true));
- futureList.add(rpcContext.stopClusterServices(false));
- futureList.add(deviceContext.stopClusterServices(false));
+ futureList.add(statisticsContext.stopClusterServices());
+ futureList.add(rpcContext.stopClusterServices());
+ futureList.add(deviceContext.stopClusterServices(connectionDropped));
return Futures.transform(Futures.successfulAsList(futureList), new Function<List<Void>, Void>() {
@Nullable
@Override
public void changePrimaryConnection(final ConnectionContext connectionContext) {
+ this.primaryConnectionContext = connectionContext;
+ this.contextChainState = ContextChainState.INITIALIZED;
for (OFPContext context : contexts) {
context.replaceConnection(connectionContext);
}
- this.primaryConnectionContext = connectionContext;
}
@Override
ContextChainState oldState = this.contextChainState;
this.contextChainState = ContextChainState.SLEEPING;
if (oldState.equals(ContextChainState.WORKINGMASTER)) {
- return this.stopChain();
+ return this.stopChain(true);
}
return Futures.immediateFuture(null);
}
@Override
public void sleepTheChainAndDropConnection() {
this.contextChainState = ContextChainState.SLEEPING;
- this.primaryConnectionContext.closeConnection(false);
+ this.primaryConnectionContext.closeConnection(true);
}
@Override
this.lifecycleService.makeDeviceSlave(this.deviceContext);
}
+ @Override
+ public void closePrimaryConnection() {
+ this.primaryConnectionContext.closeConnection(true);
+ }
+
+ @Override
+ public DeviceContext provideDeviceContext() {
+ return this.deviceContext;
+ }
}
@Override
public <S extends RpcService> void registerRpcServiceImplementation(final Class<S> serviceClass,
final S serviceInstance) {
- LOG.trace("Try to register service {} for device {}.", serviceClass, nodeInstanceIdentifier);
if (! rpcRegistrations.containsKey(serviceClass)) {
final RoutedRpcRegistration<S> routedRpcReg = rpcProviderRegistry.addRoutedRpcImplementation(serviceClass, serviceInstance);
routedRpcReg.registerPath(NodeContext.class, nodeInstanceIdentifier);
rpcRegistrations.put(serviceClass, routedRpcReg);
- LOG.debug("Registration of service {} for device {}.", serviceClass.getSimpleName(), nodeInstanceIdentifier.getKey().getId().getValue());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Registration of service {} for device {}.",
+ serviceClass.getSimpleName(),
+ nodeInstanceIdentifier.getKey().getId().getValue());
+ }
}
}
}
} else {
try {
- stopClusterServices(true).get();
+ stopClusterServices().get();
} catch (Exception e) {
LOG.debug("Failed to close RpcContext for node {} with exception: ", getDeviceInfo().getLOGValue(), e);
}
}
@Override
- public ListenableFuture<Void> stopClusterServices(boolean connectionInterrupted) {
- if (CONTEXT_STATE.TERMINATION.equals(getState())) {
+ public ListenableFuture<Void> stopClusterServices() {
+ if (CONTEXT_STATE.TERMINATION.equals(this.state)) {
return Futures.immediateCancelledFuture();
}
}
@Override
- public ListenableFuture<Void> stopClusterServices(boolean connectionInterrupted) {
- if (CONTEXT_STATE.TERMINATION.equals(getState())) {
+ public ListenableFuture<Void> stopClusterServices() {
+ if (CONTEXT_STATE.TERMINATION.equals(this.state)) {
return Futures.immediateCancelledFuture();
}
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.util.concurrent.atomic.AtomicLong;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import io.netty.util.HashedWheelTimer;
import java.lang.reflect.Field;
import java.math.BigInteger;
-import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InOrder;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.OFPContext;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
-import org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
-import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleService;
-import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProviderFactory;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
@RunWith(MockitoJUnitRunner.class)