Search in sources :

Example 6 with BarrierOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput 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

BarrierOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput)5 BarrierOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder)5 Test (org.junit.Test)4 ByteBuf (io.netty.buffer.ByteBuf)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Nullable (javax.annotation.Nullable)1 ConnectionStatus (org.opendaylight.openflowplugin.api.openflow.connection.ConnectionStatus)1 BarrierInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput)1 BarrierInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder)1 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1