import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
+import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleService;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.registry.ItemLifeCycleRegistry;
// TODO: high water mark factor should be parametrized
private static final float HIGH_WATERMARK_FACTOR = 0.95f;
- private final ConnectionContext primaryConnectionContext;
+ private ConnectionContext primaryConnectionContext;
private final DeviceState deviceState;
private final DataBroker dataBroker;
private final Map<SwitchConnectionDistinguisher, ConnectionContext> auxiliaryConnectionContexts;
@Nonnull final MessageSpy messageSpy,
@Nonnull final TranslatorLibrary translatorLibrary,
@Nonnull final DeviceManager manager,
- final ConvertorExecutor convertorExecutor) {
+ final ConvertorExecutor convertorExecutor) {
this.primaryConnectionContext = Preconditions.checkNotNull(primaryConnectionContext);
this.deviceInfo = primaryConnectionContext.getDeviceInfo();
this.deviceState = new DeviceStateImpl();
public void removeAuxiliaryConnectionContext(final ConnectionContext connectionContext) {
final SwitchConnectionDistinguisher connectionDistinguisher = createConnectionDistinguisher(connectionContext);
LOG.debug("auxiliary connection dropped: {}, nodeId:{}", connectionContext.getConnectionAdapter()
- .getRemoteAddress(), getDeviceInfo().getNodeId());
+ .getRemoteAddress(), getDeviceInfo().getLOGValue());
auxiliaryConnectionContexts.remove(connectionDistinguisher);
}
// Trigger off a notification
notificationPublishService.offerNotification(flowRemovedNotification);
} else if(LOG.isDebugEnabled()) {
- LOG.debug("For nodeId={} isNotificationFlowRemovedOff={}", getDeviceInfo().getNodeId(), deviceManager.getIsNotificationFlowRemovedOff());
+ LOG.debug("For nodeId={} isNotificationFlowRemovedOff={}", getDeviceInfo().getLOGValue(), deviceManager.getIsNotificationFlowRemovedOff());
}
final ItemLifecycleListener itemLifecycleListener = flowLifeCycleKeeper.getItemLifecycleListener();
public synchronized void close() {
LOG.debug("closing deviceContext: {}, nodeId:{}",
getPrimaryConnectionContext().getConnectionAdapter().getRemoteAddress(),
- getDeviceInfo().getNodeId());
+ getDeviceInfo().getLOGValue());
// NOOP
throw new UnsupportedOperationException("Autocloseble.close will be removed soon");
}
@Override
public synchronized void shutdownConnection() {
- LOG.debug("Shutdown method for node {}", getDeviceInfo().getNodeId());
+ LOG.debug("Shutdown method for node {}", getDeviceInfo().getLOGValue());
if (CONTEXT_STATE.TERMINATION.equals(getState())) {
- LOG.debug("DeviceCtx for Node {} is in termination process.", getDeviceInfo().getNodeId());
+ LOG.debug("DeviceCtx for Node {} is in termination process.", getDeviceInfo().getLOGValue());
return;
}
setState(CONTEXT_STATE.TERMINATION);
if (ConnectionContext.CONNECTION_STATE.RIP.equals(getPrimaryConnectionContext().getConnectionState())) {
- LOG.debug("ConnectionCtx for Node {} is in RIP state.", getDeviceInfo().getNodeId());
+ LOG.debug("ConnectionCtx for Node {} is in RIP state.", getDeviceInfo().getLOGValue());
return;
}
/* Terminate Auxiliary Connection */
@Override
public void startupClusterServices() throws ExecutionException, InterruptedException {
- LOG.debug("Initializing transaction chain manager for node {}", getDeviceInfo().getNodeId());
+ LOG.debug("Initializing transaction chain manager for node {}", getDeviceInfo().getLOGValue());
this.transactionChainManager.activateTransactionManager();
- LOG.debug("Waiting to get node {} information", getDeviceInfo().getNodeId());
- DeviceInitializationUtils.initializeNodeInformation(this, switchFeaturesMandatory, this.convertorExecutor).get();
+ LOG.debug("Waiting to get node {} information", getDeviceInfo().getLOGValue());
+ DeviceInitializationUtils.initializeNodeInformation(this, switchFeaturesMandatory, this.convertorExecutor);
}
@Override
- public ListenableFuture<Void> stopClusterServices() {
+ public ListenableFuture<Void> stopClusterServices(boolean deviceDisconnected) {
return this.transactionChainManager.deactivateTransactionManager();
}
public DeviceInfo getDeviceInfo() {
return this.deviceInfo;
}
+
+ @Override
+ public void putLifecycleServiceIntoTxChainManager(final LifecycleService lifecycleService){
+ this.transactionChainManager.setLifecycleService(lifecycleService);
+ }
+
+ @Override
+ public void replaceConnectionContext(final ConnectionContext connectionContext){
+ // Act like we are initializing the context
+ setState(CONTEXT_STATE.INITIALIZATION);
+ this.primaryConnectionContext = connectionContext;
+ this.onPublished();
+ }
}