public class ConnectionAdapterImpl extends Object implements ConnectionFacade
Modifier and Type | Field and Description |
---|---|
protected InetSocketAddress |
address |
protected io.netty.channel.Channel |
channel |
protected boolean |
disconnectOccured |
protected org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue |
output |
protected static com.google.common.cache.RemovalListener<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> |
REMOVAL_LISTENER |
protected com.google.common.cache.Cache<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> |
responseCache
expiring cache for future rpcResponses.
|
Constructor and Description |
---|
ConnectionAdapterImpl(io.netty.channel.Channel channel,
InetSocketAddress address,
boolean useBarrier)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Future<org.opendaylight.yangtools.yang.common.RpcResult<BarrierOutput>> |
barrier(BarrierInput input) |
void |
checkListeners()
Throws exception if any of required listeners is missing.
|
void |
consume(org.opendaylight.yangtools.yang.binding.DataObject message)
Invoked to consume a message.
|
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 . |
Future<Boolean> |
disconnect()
Disconnect corresponding switch.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>> |
echo(EchoInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
echoReply(EchoReplyInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
experimenter(ExperimenterInput input)
Send experimenter message to device, reply is not solicitated.
|
protected org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?> |
findRpcResponse(RpcResponseKey key)
Return cached RpcListener or
null if not cached. |
void |
fireConnectionReadyNotification()
Notify listener about connection ready-to-use event.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
flowMod(FlowModInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>> |
getAsync(GetAsyncInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>> |
getConfig(GetConfigInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>> |
getFeatures(GetFeaturesInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>> |
getQueueConfig(GetQueueConfigInput input) |
InetSocketAddress |
getRemoteAddress()
Returns the address of the connected switch.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
groupMod(GroupModInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
hello(HelloInput input) |
boolean |
isAlive()
Determines if the connection to the switch is alive.
|
boolean |
isAutoRead()
Determines if the channel is configured to auto-read.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
meterMod(MeterModInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
multipartRequest(MultipartRequestInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
packetOut(PacketOutInput input) |
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
portMod(PortModInput input) |
<T extends OutboundQueueHandler> |
registerOutboundQueueHandler(T handler,
int maxQueueDepth,
long maxBarrierNanos)
Registers a new bypass outbound queue.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<RoleRequestOutput>> |
roleRequest(RoleRequestInput input) |
protected <I extends OfHeader,O extends OfHeader> |
sendToSwitchExpectRpcResultFuture(I input,
Class<O> responseClazz,
String failureInfo)
Sends given message to switch, sending result or switch response will be reported via return value.
|
protected com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
sendToSwitchFuture(org.opendaylight.yangtools.yang.binding.DataObject input,
String failureInfo)
Sends given message to switch, sending result will be reported via return value.
|
void |
setAlienMessageListener(AlienMessageListener alienMessageListener)
Set handler for alien messages received from device.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
setAsync(SetAsyncInput input) |
void |
setAutoRead(boolean autoRead)
Sets option for automatic channel reading - if set to false, incoming messages won't be read.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
setConfig(SetConfigInput input) |
void |
setConnectionReadyListener(ConnectionReadyListener connectionReadyListener)
Set listener for connection became ready-to-use event.
|
void |
setMessageListener(OpenflowProtocolListener messageListener)
Sets the protocol message listener.
|
void |
setPacketInFiltering(boolean enabled)
Set filtering of PacketIn messages.
|
void |
setSystemListener(SystemNotificationsListener systemListener)
Sets the system message listener.
|
Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> |
tableMod(TableModInput input) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
consume
disconnect, getRemoteAddress, isAlive, isAutoRead, setAutoRead
barrier, echo, echoReply, experimenter, flowMod, getAsync, getConfig, getFeatures, getQueueConfig, groupMod, hello, meterMod, multipartRequest, packetOut, portMod, roleRequest, setAsync, setConfig, tableMod
protected static final com.google.common.cache.RemovalListener<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> REMOVAL_LISTENER
protected final io.netty.channel.Channel channel
protected final InetSocketAddress address
protected boolean disconnectOccured
protected final org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue output
protected com.google.common.cache.Cache<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> responseCache
public ConnectionAdapterImpl(io.netty.channel.Channel channel, InetSocketAddress address, boolean useBarrier)
channel
- the channel to be set - used for communicationaddress
- 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 configSubsytempublic void setMessageListener(OpenflowProtocolListener messageListener)
ConnectionAdapter
setMessageListener
in interface ConnectionAdapter
messageListener
- here will be pushed all messages from switchpublic void setConnectionReadyListener(ConnectionReadyListener connectionReadyListener)
ConnectionAdapter
setConnectionReadyListener
in interface ConnectionAdapter
connectionReadyListener
- listens to connection ready eventpublic void setSystemListener(SystemNotificationsListener systemListener)
ConnectionAdapter
setSystemListener
in interface ConnectionAdapter
systemListener
- here will be pushed all system messages from librarypublic void setAlienMessageListener(AlienMessageListener alienMessageListener)
ConnectionAdapter
setAlienMessageListener
in interface ConnectionAdapter
alienMessageListener
- here will be pushed all alien messages from switchpublic void consumeDeviceMessage(org.opendaylight.yangtools.yang.binding.DataObject message)
MessageConsumer.consume(DataObject)
to prevent missing method
in every children of AbstractConnectionAdapterStatistics
class, because we overriding
original method for StatisticsCounters
.message
- from device to processingpublic void checkListeners()
ConnectionAdapter
checkListeners
in interface ConnectionAdapter
public void fireConnectionReadyNotification()
ConnectionAdapter
fireConnectionReadyNotification
in interface ConnectionAdapter
public <T extends OutboundQueueHandler> OutboundQueueHandlerRegistration<T> registerOutboundQueueHandler(T handler, int maxQueueDepth, long maxBarrierNanos)
ConnectionAdapter
registerOutboundQueueHandler
in interface ConnectionAdapter
T
- handler typehandler
- queue handlermaxQueueDepth
- max amount of not confirmed messaged in queue (i.e. edge for barrier message)maxBarrierNanos
- regular base for barrier messageOutboundQueueHandlerRegistration
public void setPacketInFiltering(boolean enabled)
ConnectionAdapter
setPacketInFiltering
in interface ConnectionAdapter
enabled
- True if PacketIn messages should be filtered, false if they should be reported.public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> flowMod(FlowModInput input)
flowMod
in interface OpenflowProtocolService
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)
input
- message to sendresponseClazz
- type of responsefailureInfo
- describes, what type of message caused failure by sendingRpcResult
will contain errors and failed statusRpcResult
will be stored in responseCache and wait for particular timeout (
AbstractConnectionAdapter.RPC_RESPONSE_EXPIRATION
),
protected com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<Void>> sendToSwitchFuture(org.opendaylight.yangtools.yang.binding.DataObject input, String failureInfo)
input
- message to sendfailureInfo
- describes, what type of message caused failure by sendingRpcResult
without errors and successful status will be returned,RpcResult
will contain errors and failed statuspublic void consume(org.opendaylight.yangtools.yang.binding.DataObject message)
MessageConsumer
consume
in interface MessageConsumer
message
- to processpublic Future<Boolean> disconnect()
ConnectionAdapter
disconnect
in interface ConnectionAdapter
public Future<org.opendaylight.yangtools.yang.common.RpcResult<BarrierOutput>> barrier(BarrierInput input)
barrier
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>> echo(EchoInput input)
echo
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> echoReply(EchoReplyInput input)
echoReply
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> experimenter(ExperimenterInput input)
OpenflowProtocolService
experimenter
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>> getConfig(GetConfigInput input)
getConfig
in interface OpenflowProtocolService
java.util.concurrent.Future
config
, or null
if not presentpublic Future<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>> getFeatures(GetFeaturesInput input)
getFeatures
in interface OpenflowProtocolService
java.util.concurrent.Future
features
, or null
if not presentpublic Future<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>> getQueueConfig(GetQueueConfigInput input)
getQueueConfig
in interface OpenflowProtocolService
java.util.concurrent.Future
queueConfig
, or null
if not presentpublic Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> groupMod(GroupModInput input)
groupMod
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> hello(HelloInput input)
hello
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> meterMod(MeterModInput input)
meterMod
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> packetOut(PacketOutInput input)
packetOut
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> multipartRequest(MultipartRequestInput input)
multipartRequest
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> portMod(PortModInput input)
portMod
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<RoleRequestOutput>> roleRequest(RoleRequestInput input)
roleRequest
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> setConfig(SetConfigInput input)
setConfig
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> tableMod(TableModInput input)
tableMod
in interface OpenflowProtocolService
public Future<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input)
getAsync
in interface OpenflowProtocolService
java.util.concurrent.Future
async
, or null
if not presentpublic Future<org.opendaylight.yangtools.yang.common.RpcResult<Void>> setAsync(SetAsyncInput input)
setAsync
in interface OpenflowProtocolService
public boolean isAlive()
ConnectionAdapter
isAlive
in interface ConnectionAdapter
public boolean isAutoRead()
ConnectionAdapter
isAutoRead
in interface ConnectionAdapter
public void setAutoRead(boolean autoRead)
ConnectionAdapter
setAutoRead
in interface ConnectionAdapter
autoRead
- target value to be switched topublic InetSocketAddress getRemoteAddress()
ConnectionAdapter
getRemoteAddress
in interface ConnectionAdapter
protected org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?> findRpcResponse(RpcResponseKey key)
null
if not cached.Copyright © 2018 OpenDaylight. All rights reserved.