Class ConnectionContextImpl
- java.lang.Object
-
- org.opendaylight.openflowplugin.impl.connection.ConnectionContextImpl
-
- All Implemented Interfaces:
ConnectionContext
public class ConnectionContextImpl extends Object implements ConnectionContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext
ConnectionContext.CONNECTION_STATE
-
-
Constructor Summary
Constructors Constructor Description ConnectionContextImpl(ConnectionAdapter connectionAdapter, DeviceConnectionStatusProvider deviceConnectionStatusProvider)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeStateToHandshaking()
change internal state toConnectionContext.CONNECTION_STATE.HANDSHAKING
.void
changeStateToTimeouting()
change internal state toConnectionContext.CONNECTION_STATE.TIMEOUTING
.void
changeStateToWorking()
change internal state toConnectionContext.CONNECTION_STATE.WORKING
.void
closeConnection(boolean propagate)
actively drop associated connection.boolean
equals(Object object)
ConnectionAdapter
getConnectionAdapter()
Returns connection adapter.ConnectionContext.CONNECTION_STATE
getConnectionState()
Method returns current connection state.DeviceInfo
getDeviceInfo()
Create and return basic device info.FeaturesReply
getFeatures()
Getter.org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
getNodeId()
Method returns identifier of device whic connection represents this context.OutboundQueue
getOutboundQueueProvider()
Returns reference to OFJava outbound queue provider.String
getSafeNodeIdForLOG()
Get safe nodeId for logging.void
handlePortStatusMessage(PortStatusMessage portStatusMessage)
Handle received port status message.void
handshakeSuccessful()
This method creates a basic device information.int
hashCode()
void
onConnectionClosed()
cleanup context upon connection closed event (by device).List<PortStatusMessage>
retrieveAndClearPortStatusMessages()
void
setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler)
Method sets handler for handling closing connections.void
setFeatures(FeaturesReply newFeaturesReply)
Setter.void
setHandshakeContext(HandshakeContext handshakeContext)
Setter.void
setNodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nodeId)
Setter for nodeId.void
setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> newRegistration)
void
setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider)
Method sets reference to OFJava outbound queue provider.
-
-
-
Constructor Detail
-
ConnectionContextImpl
public ConnectionContextImpl(ConnectionAdapter connectionAdapter, DeviceConnectionStatusProvider deviceConnectionStatusProvider)
Constructor.- Parameters:
connectionAdapter
- - connection adapter
-
-
Method Detail
-
getConnectionAdapter
public ConnectionAdapter getConnectionAdapter()
Description copied from interface:ConnectionContext
Returns connection adapter.- Specified by:
getConnectionAdapter
in interfaceConnectionContext
- Returns:
- the connectionAdapter
-
getOutboundQueueProvider
public OutboundQueue getOutboundQueueProvider()
Description copied from interface:ConnectionContext
Returns reference to OFJava outbound queue provider. Outbound queue is used for outbound messages processing.- Specified by:
getOutboundQueueProvider
in interfaceConnectionContext
- Returns:
OutboundQueueProvider
-
setOutboundQueueProvider
public void setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider)
Description copied from interface:ConnectionContext
Method sets reference to OFJava outbound queue provider.- Specified by:
setOutboundQueueProvider
in interfaceConnectionContext
- Parameters:
outboundQueueProvider
-OutboundQueueProvider
-
getConnectionState
public ConnectionContext.CONNECTION_STATE getConnectionState()
Description copied from interface:ConnectionContext
Method returns current connection state.- Specified by:
getConnectionState
in interfaceConnectionContext
- Returns:
ConnectionContext.CONNECTION_STATE
-
getNodeId
public org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId getNodeId()
Description copied from interface:ConnectionContext
Method returns identifier of device whic connection represents this context.- Specified by:
getNodeId
in interfaceConnectionContext
- Returns:
NodeId
-
setNodeId
public void setNodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nodeId)
Description copied from interface:ConnectionContext
Setter for nodeId.- Specified by:
setNodeId
in interfaceConnectionContext
- Parameters:
nodeId
- node id
-
getFeatures
public FeaturesReply getFeatures()
Description copied from interface:ConnectionContext
Getter.- Specified by:
getFeatures
in interfaceConnectionContext
- Returns:
- featureReply as received from device during handshake
-
setDeviceDisconnectedHandler
public void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler)
Description copied from interface:ConnectionContext
Method sets handler for handling closing connections.- Specified by:
setDeviceDisconnectedHandler
in interfaceConnectionContext
- Parameters:
deviceDisconnectedHandler
- handler for disconnect
-
setFeatures
public void setFeatures(FeaturesReply newFeaturesReply)
Description copied from interface:ConnectionContext
Setter.- Specified by:
setFeatures
in interfaceConnectionContext
- Parameters:
newFeaturesReply
- as received from device during handshake
-
closeConnection
public void closeConnection(boolean propagate)
Description copied from interface:ConnectionContext
actively drop associated connection.- Specified by:
closeConnection
in interfaceConnectionContext
- Parameters:
propagate
- true if event need to be propagated to higher contexts (device, stats, rpc..) or false if invoked from higher context- See Also:
ConnectionAdapter.disconnect()
-
onConnectionClosed
public void onConnectionClosed()
Description copied from interface:ConnectionContext
cleanup context upon connection closed event (by device).- Specified by:
onConnectionClosed
in interfaceConnectionContext
-
getSafeNodeIdForLOG
public String getSafeNodeIdForLOG()
Get safe nodeId for logging.- Specified by:
getSafeNodeIdForLOG
in interfaceConnectionContext
- Returns:
- string value od nodeId or string "null"
-
setOutboundQueueHandleRegistration
public void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> newRegistration)
- Specified by:
setOutboundQueueHandleRegistration
in interfaceConnectionContext
-
changeStateToHandshaking
public void changeStateToHandshaking()
Description copied from interface:ConnectionContext
change internal state toConnectionContext.CONNECTION_STATE.HANDSHAKING
.- Specified by:
changeStateToHandshaking
in interfaceConnectionContext
-
changeStateToTimeouting
public void changeStateToTimeouting()
Description copied from interface:ConnectionContext
change internal state toConnectionContext.CONNECTION_STATE.TIMEOUTING
.- Specified by:
changeStateToTimeouting
in interfaceConnectionContext
-
changeStateToWorking
public void changeStateToWorking()
Description copied from interface:ConnectionContext
change internal state toConnectionContext.CONNECTION_STATE.WORKING
.- Specified by:
changeStateToWorking
in interfaceConnectionContext
-
handlePortStatusMessage
public void handlePortStatusMessage(PortStatusMessage portStatusMessage)
Description copied from interface:ConnectionContext
Handle received port status message.- Specified by:
handlePortStatusMessage
in interfaceConnectionContext
- Parameters:
portStatusMessage
- port status message
-
retrieveAndClearPortStatusMessages
public List<PortStatusMessage> retrieveAndClearPortStatusMessages()
- Specified by:
retrieveAndClearPortStatusMessages
in interfaceConnectionContext
-
getDeviceInfo
public DeviceInfo getDeviceInfo()
Description copied from interface:ConnectionContext
Create and return basic device info.- Specified by:
getDeviceInfo
in interfaceConnectionContext
- Returns:
- created device info
-
handshakeSuccessful
public void handshakeSuccessful()
Description copied from interface:ConnectionContext
This method creates a basic device information. Should be called after nodeId and features are set in connection context.- Specified by:
handshakeSuccessful
in interfaceConnectionContext
-
setHandshakeContext
public void setHandshakeContext(HandshakeContext handshakeContext)
Description copied from interface:ConnectionContext
Setter.- Specified by:
setHandshakeContext
in interfaceConnectionContext
- Parameters:
handshakeContext
- corresponding handshake context used upon this connection
-
-