private ListeningExecutorService executorService;
private ContextChainHolderImpl contextChainHolder;
private final OpenflowDiagStatusProvider openflowDiagStatusProvider;
+ private final SystemReadyMonitor systemReadyMonitor;
private final SettableFuture<Void> fullyStarted = SettableFuture.create();
private static final String OPENFLOW_SERVICE_NAME = "OPENFLOW";
config = new OpenFlowProviderConfigImpl(configurationService);
this.mastershipChangeServiceManager = mastershipChangeServiceManager;
this.openflowDiagStatusProvider = openflowDiagStatusProvider;
- systemReadyMonitor.registerListener(this);
- LOG.info("registered onSystemBootReady() listener for deferred startSwitchConnections()");
+ this.systemReadyMonitor = systemReadyMonitor;
}
@Override
deviceManager.setContextChainHolder(contextChainHolder);
deviceManager.initialize();
+ systemReadyMonitor.registerListener(this);
+ LOG.info("registered onSystemBootReady() listener for deferred startSwitchConnections()");
}
@Override
public class ConnectionManagerImpl implements ConnectionManager {
private static final Logger LOG = LoggerFactory.getLogger(ConnectionManagerImpl.class);
+ private static final Logger OF_EVENT_LOG = LoggerFactory.getLogger("OfEventLog");
private static final boolean BITMAP_NEGOTIATION_ENABLED = true;
private final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat("ConnectionHandler-%d")
@Override
public void onSwitchConnected(final ConnectionAdapter connectionAdapter) {
connectionAdapter.setExecutorService(executorsService);
+ OF_EVENT_LOG.debug("OnSwitchConnected event received for device {}", connectionAdapter.getRemoteAddress());
LOG.trace("prepare connection context");
final ConnectionContext connectionContext = new ConnectionContextImpl(connectionAdapter,
deviceConnectionStatusProvider);
@VisibleForTesting
void createContextChain(final ConnectionContext connectionContext) {
final DeviceInfo deviceInfo = connectionContext.getDeviceInfo();
-
final DeviceContext deviceContext = deviceManager.createContext(connectionContext);
deviceContext.registerMastershipWatcher(this);
LOG.debug("Device" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
}
@Override
- public void onNotAbleToStartMastership(final DeviceInfo deviceInfo, final String reason, final boolean mandatory) {
- LOG.warn("Not able to set MASTER role on device {}, reason: {}", deviceInfo, reason);
+ public void onNotAbleToStartMastership(@NonNull final DeviceInfo deviceInfo, @NonNull final String reason,
+ final boolean mandatory) {
+ LOG.error("Not able to set MASTER role on device {}, reason: {}", deviceInfo, reason);
if (!mandatory) {
return;
@Override
public void onSlaveRoleNotAcquired(final DeviceInfo deviceInfo, final String reason) {
- LOG.warn("Not able to set SLAVE role on device {}, reason: {}", deviceInfo, reason);
+ LOG.error("Not able to set SLAVE role on device {}, reason: {}", deviceInfo, reason);
Optional.ofNullable(contextChainMap.get(deviceInfo)).ifPresent(contextChain -> destroyContextChain(deviceInfo));
}
copyOfChains.keySet().forEach(this::destroyContextChain);
copyOfChains.clear();
contextChainMap.clear();
+ OF_EVENT_LOG.debug("EOS registration closed for all devices");
eosListenerRegistration.close();
OF_EVENT_LOG.debug("EOS registration closed for all devices");
nodeCleanerExecutor.shutdownNow();
contextChain.continueInitializationAfterReconciliation();
} else {
OF_EVENT_LOG.debug("Reconciliation framework failure for device {}", deviceInfo);
- LOG.warn("Reconciliation framework failure for device {} with result {}", deviceInfo, result);
+ LOG.warn("Reconciliation framework failure for device {} with resultState {}", deviceInfo, result);
destroyContextChain(deviceInfo);
}
}
public void onFailure(final Throwable throwable) {
OF_EVENT_LOG.debug("Reconciliation framework failure for device {} with error {}", deviceInfo,
throwable.getMessage());
- LOG.warn("Reconciliation framework failure.", throwable);
+ LOG.warn("Reconciliation framework failure for device {}", deviceInfo, throwable);
destroyContextChain(deviceInfo);
}
};