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,
int channelOutboundQueueSize)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<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.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>> |
echo(EchoInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoReplyOutput>> |
echoReply(EchoReplyInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<ExperimenterOutput>> |
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.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<FlowModOutput>> |
flowMod(FlowModInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>> |
getAsync(GetAsyncInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>> |
getConfig(GetConfigInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>> |
getFeatures(GetFeaturesInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>> |
getQueueConfig(GetQueueConfigInput input) |
InetSocketAddress |
getRemoteAddress()
Returns the address of the connected switch.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GroupModOutput>> |
groupMod(GroupModInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<HelloOutput>> |
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.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MeterModOutput>> |
meterMod(MeterModInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MultipartRequestOutput>> |
multipartRequest(MultipartRequestInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PacketOutOutput>> |
packetOut(PacketOutInput input) |
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PortModOutput>> |
portMod(PortModInput input) |
<T extends OutboundQueueHandler> |
registerOutboundQueueHandler(T handler,
int maxQueueDepth,
long maxBarrierNanos)
Registers a new bypass outbound queue.
|
com.google.common.util.concurrent.ListenableFuture<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 <O extends org.opendaylight.yangtools.yang.binding.DataObject> |
sendToSwitchFuture(Object 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.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetAsyncOutput>> |
setAsync(SetAsyncInput input) |
void |
setAutoRead(boolean autoRead)
Sets option for automatic channel reading - if set to false, incoming messages won't be read.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetConfigOutput>> |
setConfig(SetConfigInput input) |
void |
setConnectionReadyListener(ConnectionReadyListener connectionReadyListener)
Set listener for connection became ready-to-use event.
|
void |
setDatapathId(BigInteger datapathId)
Set datapathId for the dpn.
|
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.
|
com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<TableModOutput>> |
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, int channelOutboundQueueSize)
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 void setDatapathId(BigInteger datapathId)
ConnectionAdapter
setDatapathId
in interface ConnectionAdapter
datapathId
- of the dpnpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<FlowModOutput>> 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 <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)
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 com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<BarrierOutput>> barrier(BarrierInput input)
barrier
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>> echo(EchoInput input)
echo
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoReplyOutput>> echoReply(EchoReplyInput input)
echoReply
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<ExperimenterOutput>> experimenter(ExperimenterInput input)
OpenflowProtocolService
experimenter
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>> getConfig(GetConfigInput input)
getConfig
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>> getFeatures(GetFeaturesInput input)
getFeatures
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>> getQueueConfig(GetQueueConfigInput input)
getQueueConfig
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GroupModOutput>> groupMod(GroupModInput input)
groupMod
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<HelloOutput>> hello(HelloInput input)
hello
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MeterModOutput>> meterMod(MeterModInput input)
meterMod
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PacketOutOutput>> packetOut(PacketOutInput input)
packetOut
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MultipartRequestOutput>> multipartRequest(MultipartRequestInput input)
multipartRequest
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PortModOutput>> portMod(PortModInput input)
portMod
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RoleRequestOutput>> roleRequest(RoleRequestInput input)
roleRequest
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetConfigOutput>> setConfig(SetConfigInput input)
setConfig
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<TableModOutput>> tableMod(TableModInput input)
tableMod
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input)
getAsync
in interface OpenflowProtocolService
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetAsyncOutput>> 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 © 2020 OpenDaylight. All rights reserved.