Class ConnectionAdapterImpl
java.lang.Object
org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl
- All Implemented Interfaces:
- ConnectionAdapter,- ConnectionFacade,- MessageConsumer,- OpenflowProtocolService,- org.opendaylight.yangtools.yang.binding.RpcService
Handles messages (notifications + rpcs) and connections.
- Author:
- mirehak, michal.polkorab
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final InetSocketAddressprotected final io.netty.channel.Channelprotected booleanprotected final org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueueprotected static final com.google.common.cache.RemovalListener<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> protected com.google.common.cache.Cache<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> expiring cache for future rpcResponses.
- 
Constructor SummaryConstructorsConstructorDescriptionConnectionAdapterImpl(io.netty.channel.Channel channel, InetSocketAddress address, boolean useBarrier, int channelOutboundQueueSize) Default constructor.
- 
Method SummaryModifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<BarrierOutput>>barrier(BarrierInput input) InvokebarrierRPC.voidThrows exception if any of required listeners is missing.voidconsume(org.opendaylight.yangtools.yang.binding.DataObject message) Invoked to consume a message.voidconsumeDeviceMessage(org.opendaylight.yangtools.yang.binding.DataObject message) Method is equivalent toMessageConsumer.consume(DataObject)to prevent missing method in every children ofAbstractConnectionAdapterStatisticsclass, because we overriding original method forStatisticsCounters.Disconnect corresponding switch.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>>InvokeechoRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoReplyOutput>>echoReply(EchoReplyInput input) Invokeecho-replyRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<ExperimenterOutput>>experimenter(ExperimenterInput input) InvokeexperimenterRPC.protected org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>Return cached RpcListener ornullif not cached.voidNotify listener about connection ready-to-use event.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<FlowModOutput>>flowMod(FlowModInput input) Invokeflow-modRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>>getAsync(GetAsyncInput input) Invokeget-asyncRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>>getConfig(GetConfigInput input) Invokeget-configRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>>getFeatures(GetFeaturesInput input) Invokeget-featuresRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>>Invokeget-queue-configRPC.Returns the address of the connected switch.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GroupModOutput>>groupMod(GroupModInput input) Invokegroup-modRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<HelloOutput>>hello(HelloInput input) InvokehelloRPC.booleanisAlive()Determines if the connection to the switch is alive.booleanDetermines if the channel is configured to auto-read.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MeterModOutput>>meterMod(MeterModInput input) Invokemeter-modRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MultipartRequestOutput>>Invokemultipart-requestRPC.voidonSwitchCertificateIdentified(List<X509Certificate> certificateChain) Notify listener about switch certificate information.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PacketOutOutput>>packetOut(PacketOutInput input) Invokepacket-outRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PortModOutput>>portMod(PortModInput input) Invokeport-modRPC.<T extends OutboundQueueHandler>
 OutboundQueueHandlerRegistration<T>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) Invokerole-requestRPC.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.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.voidsetAlienMessageListener(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) Invokeset-asyncRPC.voidsetAutoRead(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) Invokeset-configRPC.voidsetConnectionReadyListener(ConnectionReadyListener connectionReadyListener) Set listener for connection became ready-to-use event.voidsetDatapathId(BigInteger datapathId) Set datapathId for the dpn.voidsetExecutorService(ExecutorService executorService) Sets executorService.voidsetMessageListener(OpenflowProtocolListener messageListener) Sets the protocol message listener.voidsetPacketInFiltering(boolean enabled) Set filtering of PacketIn messages.voidsetSystemListener(SystemNotificationsListener systemListener) Sets the system message listener.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<TableModOutput>>tableMod(TableModInput input) Invoketable-modRPC.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapterdisconnect, getRemoteAddress, isAlive, isAutoRead, setAutoReadMethods inherited from interface org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumerconsumeMethods inherited from interface org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolServicebarrier, echo, echoReply, experimenter, flowMod, getAsync, getConfig, getFeatures, getQueueConfig, groupMod, hello, meterMod, multipartRequest, packetOut, portMod, roleRequest, setAsync, setConfig, tableMod
- 
Field Details- 
REMOVAL_LISTENERprotected static final com.google.common.cache.RemovalListener<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> REMOVAL_LISTENER
- 
channelprotected final io.netty.channel.Channel channel
- 
address
- 
disconnectOccuredprotected boolean disconnectOccured
- 
outputprotected final org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue output
- 
responseCacheprotected com.google.common.cache.Cache<RpcResponseKey,org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?>> responseCacheexpiring cache for future rpcResponses.
 
- 
- 
Constructor Details- 
ConnectionAdapterImplpublic 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 Details- 
setMessageListenerDescription copied from interface:ConnectionAdapterSets the protocol message listener.- Specified by:
- setMessageListenerin interface- ConnectionAdapter
- Parameters:
- messageListener- here will be pushed all messages from switch
 
- 
setConnectionReadyListenerDescription copied from interface:ConnectionAdapterSet listener for connection became ready-to-use event.- Specified by:
- setConnectionReadyListenerin interface- ConnectionAdapter
- Parameters:
- connectionReadyListener- listens to connection ready event
 
- 
setSystemListenerDescription copied from interface:ConnectionAdapterSets the system message listener.- Specified by:
- setSystemListenerin interface- ConnectionAdapter
- Parameters:
- systemListener- here will be pushed all system messages from library
 
- 
setAlienMessageListenerDescription copied from interface:ConnectionAdapterSet handler for alien messages received from device.- Specified by:
- setAlienMessageListenerin interface- ConnectionAdapter
- Parameters:
- alienMessageListener- here will be pushed all alien messages from switch
 
- 
consumeDeviceMessagepublic void consumeDeviceMessage(org.opendaylight.yangtools.yang.binding.DataObject message) Method is equivalent toMessageConsumer.consume(DataObject)to prevent missing method in every children ofAbstractConnectionAdapterStatisticsclass, because we overriding original method forStatisticsCounters.- Parameters:
- message- from device to processing
 
- 
checkListenerspublic void checkListeners()Description copied from interface:ConnectionAdapterThrows exception if any of required listeners is missing.- Specified by:
- checkListenersin interface- ConnectionAdapter
 
- 
fireConnectionReadyNotificationpublic void fireConnectionReadyNotification()Description copied from interface:ConnectionAdapterNotify listener about connection ready-to-use event.- Specified by:
- fireConnectionReadyNotificationin interface- ConnectionAdapter
 
- 
onSwitchCertificateIdentifiedDescription copied from interface:ConnectionAdapterNotify listener about switch certificate information.- Specified by:
- onSwitchCertificateIdentifiedin interface- ConnectionAdapter
- Parameters:
- certificateChain- X509 certificate chain presented by the switch
 
- 
registerOutboundQueueHandlerpublic <T extends OutboundQueueHandler> OutboundQueueHandlerRegistration<T> registerOutboundQueueHandler(T handler, int maxQueueDepth, long maxBarrierNanos) Description copied from interface:ConnectionAdapterRegisters a new bypass outbound queue.- Specified by:
- registerOutboundQueueHandlerin interface- ConnectionAdapter
- Type Parameters:
- T- handler type
- Parameters:
- handler- queue handler
- maxQueueDepth- max amount of not confirmed messaged in queue (i.e. edge for barrier message)
- maxBarrierNanos- regular base for barrier message
- Returns:
- An OutboundQueueHandlerRegistration
 
- 
setPacketInFilteringpublic void setPacketInFiltering(boolean enabled) Description copied from interface:ConnectionAdapterSet filtering of PacketIn messages. By default these messages are not filtered.- Specified by:
- setPacketInFilteringin interface- ConnectionAdapter
- Parameters:
- enabled- True if PacketIn messages should be filtered, false if they should be reported.
 
- 
setDatapathIdDescription copied from interface:ConnectionAdapterSet datapathId for the dpn.- Specified by:
- setDatapathIdin interface- ConnectionAdapter
- Parameters:
- datapathId- of the dpn
 
- 
setExecutorServiceDescription copied from interface:ConnectionAdapterSets executorService.- Specified by:
- setExecutorServicein interface- ConnectionAdapter
- Parameters:
- executorService- for all dpns
 
- 
flowModpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<FlowModOutput>> flowMod(FlowModInput input) Description copied from interface:OpenflowProtocolServiceInvokeflow-modRPC.- Specified by:
- flowModin interface- OpenflowProtocolService
- Parameters:
- input- of- flow-mod
- Returns:
- output of flow-mod
 
- 
sendToSwitchExpectRpcResultFutureprotected <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, RpcResultwill contain errors and failed status
- else RpcResultwill 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
 
 
- if send fails, 
 
- 
sendToSwitchFutureprotected <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, RpcResultwithout errors and successful status will be returned,
- else RpcResultwill contain errors and failed status
 
- if send successful, 
 
- 
consumepublic void consume(org.opendaylight.yangtools.yang.binding.DataObject message) Description copied from interface:MessageConsumerInvoked to consume a message.- Specified by:
- consumein interface- MessageConsumer
- Parameters:
- message- to process
 
- 
disconnectDescription copied from interface:ConnectionAdapterDisconnect corresponding switch.- Specified by:
- disconnectin interface- ConnectionAdapter
- Returns:
- future set to true, when disconnect completed
 
- 
barrierpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<BarrierOutput>> barrier(BarrierInput input) Description copied from interface:OpenflowProtocolServiceInvokebarrierRPC.- Specified by:
- barrierin interface- OpenflowProtocolService
- Parameters:
- input- of- barrier
- Returns:
- output of barrier
 
- 
echopublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoOutput>> echo(EchoInput input) Description copied from interface:OpenflowProtocolServiceInvokeechoRPC.- Specified by:
- echoin interface- OpenflowProtocolService
- Parameters:
- input- of- echo
- Returns:
- output of echo
 
- 
echoReplypublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<EchoReplyOutput>> echoReply(EchoReplyInput input) Description copied from interface:OpenflowProtocolServiceInvokeecho-replyRPC.- Specified by:
- echoReplyin interface- OpenflowProtocolService
- Parameters:
- input- of- echo-reply
- Returns:
- output of echo-reply
 
- 
experimenterpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<ExperimenterOutput>> experimenter(ExperimenterInput input) Description copied from interface:OpenflowProtocolServiceInvokeexperimenterRPC.Send experimenter message to device, reply is not solicitated.- Specified by:
- experimenterin interface- OpenflowProtocolService
- Parameters:
- input- of- experimenter
- Returns:
- output of experimenter
 
- 
getConfigpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetConfigOutput>> getConfig(GetConfigInput input) Description copied from interface:OpenflowProtocolServiceInvokeget-configRPC.- Specified by:
- getConfigin interface- OpenflowProtocolService
- Parameters:
- input- of- get-config
- Returns:
- output of get-config
 
- 
getFeaturespublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetFeaturesOutput>> getFeatures(GetFeaturesInput input) Description copied from interface:OpenflowProtocolServiceInvokeget-featuresRPC.- Specified by:
- getFeaturesin interface- OpenflowProtocolService
- Parameters:
- input- of- get-features
- Returns:
- output of get-features
 
- 
getQueueConfigpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetQueueConfigOutput>> getQueueConfig(GetQueueConfigInput input) Description copied from interface:OpenflowProtocolServiceInvokeget-queue-configRPC.- Specified by:
- getQueueConfigin interface- OpenflowProtocolService
- Parameters:
- input- of- get-queue-config
- Returns:
- output of get-queue-config
 
- 
groupModpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GroupModOutput>> groupMod(GroupModInput input) Description copied from interface:OpenflowProtocolServiceInvokegroup-modRPC.- Specified by:
- groupModin interface- OpenflowProtocolService
- Parameters:
- input- of- group-mod
- Returns:
- output of group-mod
 
- 
hellopublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<HelloOutput>> hello(HelloInput input) Description copied from interface:OpenflowProtocolServiceInvokehelloRPC.- Specified by:
- helloin interface- OpenflowProtocolService
- Parameters:
- input- of- hello
- Returns:
- output of hello
 
- 
meterModpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MeterModOutput>> meterMod(MeterModInput input) Description copied from interface:OpenflowProtocolServiceInvokemeter-modRPC.- Specified by:
- meterModin interface- OpenflowProtocolService
- Parameters:
- input- of- meter-mod
- Returns:
- output of meter-mod
 
- 
packetOutpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PacketOutOutput>> packetOut(PacketOutInput input) Description copied from interface:OpenflowProtocolServiceInvokepacket-outRPC.- Specified by:
- packetOutin interface- OpenflowProtocolService
- Parameters:
- input- of- packet-out
- Returns:
- output of packet-out
 
- 
multipartRequestpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<MultipartRequestOutput>> multipartRequest(MultipartRequestInput input) Description copied from interface:OpenflowProtocolServiceInvokemultipart-requestRPC.- Specified by:
- multipartRequestin interface- OpenflowProtocolService
- Parameters:
- input- of- multipart-request
- Returns:
- output of multipart-request
 
- 
portModpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<PortModOutput>> portMod(PortModInput input) Description copied from interface:OpenflowProtocolServiceInvokeport-modRPC.- Specified by:
- portModin interface- OpenflowProtocolService
- Parameters:
- input- of- port-mod
- Returns:
- output of port-mod
 
- 
roleRequestpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RoleRequestOutput>> roleRequest(RoleRequestInput input) Description copied from interface:OpenflowProtocolServiceInvokerole-requestRPC.- Specified by:
- roleRequestin interface- OpenflowProtocolService
- Parameters:
- input- of- role-request
- Returns:
- output of role-request
 
- 
setConfigpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetConfigOutput>> setConfig(SetConfigInput input) Description copied from interface:OpenflowProtocolServiceInvokeset-configRPC.- Specified by:
- setConfigin interface- OpenflowProtocolService
- Parameters:
- input- of- set-config
- Returns:
- output of set-config
 
- 
tableModpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<TableModOutput>> tableMod(TableModInput input) Description copied from interface:OpenflowProtocolServiceInvoketable-modRPC.- Specified by:
- tableModin interface- OpenflowProtocolService
- Parameters:
- input- of- table-mod
- Returns:
- output of table-mod
 
- 
getAsyncpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) Description copied from interface:OpenflowProtocolServiceInvokeget-asyncRPC.- Specified by:
- getAsyncin interface- OpenflowProtocolService
- Parameters:
- input- of- get-async
- Returns:
- output of get-async
 
- 
setAsyncpublic com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<SetAsyncOutput>> setAsync(SetAsyncInput input) Description copied from interface:OpenflowProtocolServiceInvokeset-asyncRPC.- Specified by:
- setAsyncin interface- OpenflowProtocolService
- Parameters:
- input- of- set-async
- Returns:
- output of set-async
 
- 
isAlivepublic boolean isAlive()Description copied from interface:ConnectionAdapterDetermines if the connection to the switch is alive.- Specified by:
- isAlivein interface- ConnectionAdapter
- Returns:
- true, if connection to switch is alive
 
- 
isAutoReadpublic boolean isAutoRead()Description copied from interface:ConnectionAdapterDetermines if the channel is configured to auto-read.- Specified by:
- isAutoReadin interface- ConnectionAdapter
- Returns:
- true, if channel is configured to auto-read
 
- 
setAutoReadpublic void setAutoRead(boolean autoRead) Description copied from interface:ConnectionAdapterSets option for automatic channel reading - if set to false, incoming messages won't be read.- Specified by:
- setAutoReadin interface- ConnectionAdapter
- Parameters:
- autoRead- target value to be switched to
 
- 
getRemoteAddressDescription copied from interface:ConnectionAdapterReturns the address of the connected switch.- Specified by:
- getRemoteAddressin interface- ConnectionAdapter
- Returns:
- address of the remote end - address of a switch if connected
 
- 
findRpcResponseprotected org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener<?> findRpcResponse(RpcResponseKey key) Return cached RpcListener ornullif not cached.
 
-