Search in sources :

Example 1 with ConnectionStatus

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);
        }
    };
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ConnectionStatus(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus) FutureCallback(com.google.common.util.concurrent.FutureCallback) Nullable(javax.annotation.Nullable) BarrierOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput)

Aggregations

FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Nullable (javax.annotation.Nullable)1 ConnectionStatus (org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus)1 BarrierOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1