/* Open a new bundle on the switch */
ListenableFuture<RpcResult<ControlBundleOutput>> openBundle =
- Futures.transformAsync(closeBundle,
- rpcResult -> salBundleService.controlBundle(openBundleInput),
- service);
+ Futures.transformAsync(closeBundle,
+ rpcResult -> salBundleService.controlBundle(openBundleInput),
+ service);
/* Push groups and flows via bundle add messages */
- ListenableFuture<RpcResult<AddBundleMessagesOutput>> deleteAllFlowGroupsFuture
- = Futures.transformAsync(openBundle, rpcResult -> {
+ ListenableFuture<RpcResult<AddBundleMessagesOutput>> deleteAllFlowGroupsFuture =
+ Futures.transformAsync(openBundle, rpcResult -> {
if (rpcResult.isSuccessful()) {
return salBundleService.addBundleMessages(deleteAllFlowGroupsInput);
}
/* Push flows and groups via bundle add messages */
Optional<FlowCapableNode> finalFlowNode = flowNode;
- ListenableFuture<List<RpcResult<AddBundleMessagesOutput>>> addbundlesFuture
- = Futures.transformAsync(deleteAllFlowGroupsFuture, rpcResult -> {
+ ListenableFuture<List<RpcResult<AddBundleMessagesOutput>>> addbundlesFuture =
+ Futures.transformAsync(deleteAllFlowGroupsFuture, rpcResult -> {
if (rpcResult.isSuccessful()) {
LOG.debug("Adding delete all flow/group message is successful for device {}",dpnId);
return Futures.allAsList(addBundleMessages(finalFlowNode.get(), bundleIdValue,
return false;
}
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Error while doing bundle based reconciliation for device ID:{}", dpnId);
+ LOG.error("Error while doing bundle based reconciliation for device ID:{}", dpnId, e);
return false;
}
}
LOG.error("FlowNode not present for Datapath ID {}", dpnId);
return false;
- } finally {
+ } finally {
service.shutdown();
}
}
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);
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProvider;
import org.opendaylight.openflowplugin.impl.device.listener.OpenflowProtocolListenerFullImpl;
import org.opendaylight.openflowplugin.impl.util.DeviceInitializationUtil;
+import org.opendaylight.openflowplugin.impl.util.DeviceStateUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
public class DeviceManagerImpl implements DeviceManager, ExtensionConverterProviderKeeper {
private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerImpl.class);
+ private static final Logger OF_EVENT_LOG = LoggerFactory.getLogger("OfEventLog");
private static final int SPY_RATE = 10;
+ private static final long REMOVE_DEVICE_FROM_DS_TIMEOUT = 5000L;
private final OpenflowProviderConfig config;
private final DataBroker dataBroker;
if (LOG.isDebugEnabled()) {
LOG.debug("Device context removed for node {}", deviceInfo);
}
-
+ final KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier =
+ DeviceStateUtil.createNodeInstanceIdentifier(deviceInfo.getNodeId());
+ try {
+ this.removeDeviceFromOperationalDS(nodeInstanceIdentifier)
+ .get(REMOVE_DEVICE_FROM_DS_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException | ExecutionException | NullPointerException | InterruptedException e) {
+ LOG.error("Not able to remove device {} from operational DS. ", deviceInfo.getDatapathId(), e);
+ }
+ OF_EVENT_LOG.debug("Node removed from Oper DS, Node: {}",
+ nodeInstanceIdentifier.firstKeyOf(Node.class).getId().getValue());
this.updatePacketInRateLimiters();
}
public class ContextChainHolderImpl implements ContextChainHolder, MasterChecker {
private static final Logger LOG = LoggerFactory.getLogger(ContextChainHolderImpl.class);
private static final Logger OF_EVENT_LOG = LoggerFactory.getLogger("OfEventLog");
-
- private static final String CONTEXT_CREATED_FOR_CONNECTION = " context created for connection: {}";
private static final long REMOVE_DEVICE_FROM_DS_TIMEOUT = 5000L;
+ private static final String CONTEXT_CREATED_FOR_CONNECTION = " context created for connection: {}";
private static final String ASYNC_SERVICE_ENTITY_TYPE = "org.opendaylight.mdsal.AsyncServiceCloseEntityType";
private static final String SEPARATOR = ":";
private final Map<DeviceInfo, ContextChain> contextChainMap = new ConcurrentHashMap<>();
@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(@NonNull final DeviceInfo deviceInfo, @NonNull final String reason,
final boolean mandatory) {
- LOG.warn("Not able to set MASTER role on device {}, reason: {}", deviceInfo, reason);
+ 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");
}
contextChain.continueInitializationAfterReconciliation();
} else {
OF_EVENT_LOG.debug("Reconciliation framework failure for device {}", deviceInfo);
- LOG.warn("Reconciliation framework failure for device {}", deviceInfo);
+ 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.");
+ LOG.warn("Reconciliation framework failure for device {}", deviceInfo, throwable);
destroyContextChain(deviceInfo);
}
};
contexts.forEach(OFPContext::instantiateServiceInstance);
LOG.info("Started clustering services for node {}", deviceInfo);
} catch (final Exception ex) {
- LOG.warn("Not able to start clustering services for node {}", deviceInfo);
+ LOG.error("Not able to start clustering services for node {}", deviceInfo);
executorService.execute(() -> contextChainMastershipWatcher
.onNotAbleToStartMastershipMandatory(deviceInfo, ex.toString()));
}
EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NO_OWNER
);
contextChainHolder.ownershipChanged(ownershipChange);
- Mockito.verify(deviceManager).removeDeviceFromOperationalDS(Mockito.any());
}
@Test