use of org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus in project openflowplugin by opendaylight.
the class HandshakeListenerImpl method addBarrierCallback.
private FutureCallback<RpcResult<BarrierOutput>> addBarrierCallback() {
return new FutureCallback<RpcResult<BarrierOutput>>() {
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public void onSuccess(@Nullable final RpcResult<BarrierOutput> result) {
if (LOG.isDebugEnabled()) {
LOG.debug("succeeded by getting sweep barrier after post-handshake for device {}", connectionContext.getDeviceInfo());
}
try {
ConnectionStatus connectionStatusResult = deviceConnectedHandler.deviceConnected(connectionContext);
if (connectionStatusResult != ConnectionStatus.MAY_CONTINUE) {
connectionContext.closeConnection(false);
}
SessionStatistics.countEvent(connectionContext.getDeviceInfo().toString(), SessionStatistics.ConnectionStatus.CONNECTION_CREATED);
} catch (final Exception e) {
LOG.warn("initial processing failed for device {}", connectionContext.getDeviceInfo(), e);
SessionStatistics.countEvent(connectionContext.getDeviceInfo().toString(), SessionStatistics.ConnectionStatus.CONNECTION_DISCONNECTED_BY_OFP);
connectionContext.closeConnection(true);
}
}
@Override
public void onFailure(final Throwable throwable) {
LOG.warn("failed to get sweep barrier after post-handshake for device {}", connectionContext.getDeviceInfo(), throwable);
connectionContext.closeConnection(false);
}
};
}
Aggregations