Class ConnectionAdapterImpl

    • Field Detail

      • REMOVAL_LISTENER

        protected static final com.google.common.cache.RemovalListener<RpcResponseKey,​org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> REMOVAL_LISTENER
      • channel

        protected final io.netty.channel.Channel channel
      • disconnectOccured

        protected boolean disconnectOccured
      • output

        protected final org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue output
      • responseCache

        protected com.google.common.cache.Cache<RpcResponseKey,​org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> responseCache
        expiring cache for future rpcResponses.
    • Constructor Detail

      • ConnectionAdapterImpl

        public ConnectionAdapterImpl​(io.netty.channel.Channel channel,
                                     InetSocketAddress address,
                                     boolean useBarrier,
                                     int channelOutboundQueueSize)
        Default constructor.
        Parameters:
        channel - the channel to be set - used for communication
        address - client address (used only in case of UDP communication, as there is no need to store address over tcp (stable channel))
        useBarrier - value is configurable by configSubsytem
    • Method Detail

      • consumeDeviceMessage

        public void consumeDeviceMessage​(org.opendaylight.yangtools.yang.binding.DataObject message)
        Method is equivalent to MessageConsumer.consume(DataObject) to prevent missing method in every children of AbstractConnectionAdapterStatistics class, because we overriding original method for StatisticsCounters.
        Parameters:
        message - from device to processing
      • setPacketInFiltering

        public void setPacketInFiltering​(boolean enabled)
        Description copied from interface: ConnectionAdapter
        Set filtering of PacketIn messages. By default these messages are not filtered.
        Specified by:
        setPacketInFiltering in interface ConnectionAdapter
        Parameters:
        enabled - True if PacketIn messages should be filtered, false if they should be reported.
      • sendToSwitchExpectRpcResultFuture

        protected <I extends OfHeader,​O extends OfHeader> com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<O>> sendToSwitchExpectRpcResultFuture​(I input,
                                                                                                                                                                                                          Class<O> responseClazz,
                                                                                                                                                                                                          String failureInfo)
        Sends given message to switch, sending result or switch response will be reported via return value.
        Parameters:
        input - message to send
        responseClazz - type of response
        failureInfo - describes, what type of message caused failure by sending
        Returns:
        future object,
        • if send fails, RpcResult will contain errors and failed status
        • else RpcResult will be stored in responseCache and wait for particular timeout ( AbstractConnectionAdapter.RPC_RESPONSE_EXPIRATION),
          • either switch will manage to answer and then corresponding response message will be set into returned future
          • or response in cache will expire and returned future will be cancelled
      • sendToSwitchFuture

        protected <O extends org.opendaylight.yangtools.yang.binding.DataObject> com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<O>> sendToSwitchFuture​(Object input,
                                                                                                                                                                                                            String failureInfo)
        Sends given message to switch, sending result will be reported via return value.
        Parameters:
        input - message to send
        failureInfo - describes, what type of message caused failure by sending
        Returns:
        future object,
        • if send successful, RpcResult without errors and successful status will be returned,
        • else RpcResult will contain errors and failed status
      • consume

        public void consume​(org.opendaylight.yangtools.yang.binding.DataObject message)
        Description copied from interface: MessageConsumer
        Invoked to consume a message.
        Specified by:
        consume in interface MessageConsumer
        Parameters:
        message - to process
      • experimenter

        public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<ExperimenterOutput>> experimenter​(ExperimenterInput input)
        Description copied from interface: OpenflowProtocolService
        Invoke experimenter RPC.
             
                 Send experimenter message to device, reply is not solicitated.
             
         
        Specified by:
        experimenter in interface OpenflowProtocolService
        Parameters:
        input - of experimenter
        Returns:
        output of experimenter
      • isAlive

        public boolean isAlive()
        Description copied from interface: ConnectionAdapter
        Determines if the connection to the switch is alive.
        Specified by:
        isAlive in interface ConnectionAdapter
        Returns:
        true, if connection to switch is alive
      • isAutoRead

        public boolean isAutoRead()
        Description copied from interface: ConnectionAdapter
        Determines if the channel is configured to auto-read.
        Specified by:
        isAutoRead in interface ConnectionAdapter
        Returns:
        true, if channel is configured to auto-read
      • setAutoRead

        public void setAutoRead​(boolean autoRead)
        Description copied from interface: ConnectionAdapter
        Sets option for automatic channel reading - if set to false, incoming messages won't be read.
        Specified by:
        setAutoRead in interface ConnectionAdapter
        Parameters:
        autoRead - target value to be switched to
      • findRpcResponse

        protected org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?> findRpcResponse​(RpcResponseKey key)
        Return cached RpcListener or null if not cached.