import com.google.common.util.concurrent.ListenableFuture;
import javax.annotation.Nullable;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus;
import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeListener;
return new FutureCallback<RpcResult<BarrierOutput>>() {
@Override
public void onSuccess(@Nullable final RpcResult<BarrierOutput> result) {
- LOG.debug("succeeded by getting sweep barrier after posthandshake for device {}", connectionContext.getNodeId());
+ LOG.debug("succeeded by getting sweep barrier after post-handshake for device {}", connectionContext.getNodeId().getValue());
try {
- if (!deviceConnectedHandler.deviceConnected(connectionContext)) {
- connectionContext.closeConnection(true);
+ ConnectionStatus connectionStatusResult = deviceConnectedHandler.deviceConnected(connectionContext);
+ if (ConnectionStatus.CLOSING.equals(connectionStatusResult)) {
+ connectionContext.closeConnection(false);
}
SessionStatistics.countEvent(connectionContext.getNodeId().toString(),
SessionStatistics.ConnectionStatus.CONNECTION_CREATED);
} catch (final Exception e) {
- LOG.error("ConnectionContext initial processing failed: {}", e.getMessage());
+ LOG.error("ConnectionContext initial processing failed: ", e);
SessionStatistics.countEvent(connectionContext.getNodeId().toString(),
SessionStatistics.ConnectionStatus.CONNECTION_DISCONNECTED_BY_OFP);
connectionContext.closeConnection(true);
@Override
public void onFailure(final Throwable t) {
- LOG.error("failed to get sweep barrier after posthandshake for device {}", connectionContext.getNodeId());
+ LOG.error("failed to get sweep barrier after post-handshake for device {}", connectionContext.getNodeId());
connectionContext.closeConnection(false);
}
};