Interface ConnectionContext
-
- All Known Implementing Classes:
ConnectionContextImpl
public interface ConnectionContext
Each OpenFlow session is tracked by a Connection Context. These attach to a particular Device Context in such a way, that there is at most one primary session associated with a Device Context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ConnectionContext.CONNECTION_STATE
Distinguished connection states.
-
Method Summary
All Methods Instance Methods Abstract 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.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.NodeId
getNodeId()
Method returns identifier of device whic connection represents this context.OutboundQueue
getOutboundQueueProvider()
Returns reference to OFJava outbound queue provider.String
getSafeNodeIdForLOG()
void
handlePortStatusMessage(PortStatusMessage portStatusMessage)
Handle received port status message.void
handshakeSuccessful()
This method creates a basic device information.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 featuresReply)
Setter.void
setHandshakeContext(HandshakeContext handshakeContext)
Setter.void
setNodeId(NodeId nodeId)
Setter for nodeId.void
setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration)
void
setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider)
Method sets reference to OFJava outbound queue provider.
-
-
-
Method Detail
-
setHandshakeContext
void setHandshakeContext(HandshakeContext handshakeContext)
Setter.- Parameters:
handshakeContext
- corresponding handshake context used upon this connection
-
setNodeId
void setNodeId(NodeId nodeId)
Setter for nodeId.- Parameters:
nodeId
- node id
-
getNodeId
NodeId getNodeId()
Method returns identifier of device whic connection represents this context.- Returns:
NodeId
-
getConnectionAdapter
ConnectionAdapter getConnectionAdapter()
Returns connection adapter.- Returns:
- the connectionAdapter
-
getOutboundQueueProvider
OutboundQueue getOutboundQueueProvider()
Returns reference to OFJava outbound queue provider. Outbound queue is used for outbound messages processing.- Returns:
OutboundQueueProvider
-
setOutboundQueueProvider
void setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider)
Method sets reference to OFJava outbound queue provider.- Parameters:
outboundQueueProvider
-OutboundQueueProvider
-
getConnectionState
ConnectionContext.CONNECTION_STATE getConnectionState()
Method returns current connection state.- Returns:
ConnectionContext.CONNECTION_STATE
-
setFeatures
void setFeatures(FeaturesReply featuresReply)
Setter.- Parameters:
featuresReply
- as received from device during handshake
-
getFeatures
FeaturesReply getFeatures()
Getter.- Returns:
- featureReply as received from device during handshake
-
setDeviceDisconnectedHandler
void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler)
Method sets handler for handling closing connections.- Parameters:
deviceDisconnectedHandler
- handler for disconnect
-
getSafeNodeIdForLOG
String getSafeNodeIdForLOG()
-
setOutboundQueueHandleRegistration
void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration)
-
closeConnection
void closeConnection(boolean propagate)
actively drop associated connection.- 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
void onConnectionClosed()
cleanup context upon connection closed event (by device).
-
changeStateToHandshaking
void changeStateToHandshaking()
change internal state toConnectionContext.CONNECTION_STATE.HANDSHAKING
.
-
changeStateToTimeouting
void changeStateToTimeouting()
change internal state toConnectionContext.CONNECTION_STATE.TIMEOUTING
.
-
changeStateToWorking
void changeStateToWorking()
change internal state toConnectionContext.CONNECTION_STATE.WORKING
.
-
getDeviceInfo
DeviceInfo getDeviceInfo()
Create and return basic device info.- Returns:
- created device info
-
handshakeSuccessful
void handshakeSuccessful()
This method creates a basic device information. Should be called after nodeId and features are set in connection context.
-
handlePortStatusMessage
void handlePortStatusMessage(PortStatusMessage portStatusMessage)
Handle received port status message.- Parameters:
portStatusMessage
- port status message
-
retrieveAndClearPortStatusMessages
List<PortStatusMessage> retrieveAndClearPortStatusMessages()
-
-