Class DeviceContextImpl
- java.lang.Object
-
- org.opendaylight.openflowplugin.impl.device.DeviceContextImpl
-
- All Implemented Interfaces:
AutoCloseable
,org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService
,DeviceContext
,DeviceRegistry
,DeviceReplyProcessor
,RequestContextStack
,TxFacade
,ContextChainStateListener
,DeviceInitializationContext
,OFPContext
,ExtensionConverterProviderKeeper
,org.opendaylight.yangtools.concepts.Identifiable<org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier>
public class DeviceContextImpl extends Object implements DeviceContext, ExtensionConverterProviderKeeper
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireWriteTransactionLock()
Method to acquire a write transaction lock to perform atomic transactions to MD-SAL.<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidaddDeleteToTxChain(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
Method creates delete operation for provided path in underlying transaction chain.boolean
canUseSingleLayerSerialization()
Checks if device and controller supports single layer serialization.void
close()
com.google.common.util.concurrent.ListenableFuture<?>
closeServiceInstance()
<T> RequestContext<T>
createRequestContext()
Method returns new request context for current request.DeviceFlowRegistry
getDeviceFlowRegistry()
Method exposes flow registry used for storing flow ids identified by calculated flow hash.DeviceGroupRegistry
getDeviceGroupRegistry()
Method exposes device group registry used for storing group ids.DeviceInfo
getDeviceInfo()
Get device info.DeviceMeterRegistry
getDeviceMeterRegistry()
Method exposes device meter registry used for storing meter ids.DeviceState
getDeviceState()
Method provides state of device represented by this device context.ExtensionConverterProvider
getExtensionConverterProvider()
Returns the extension converters registry access point for by inner infrastructure.FlowGroupInfoHistory
getFlowGroupInfoHistory()
org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier
getIdentifier()
MessageSpy
getMessageSpy()
Gets message spy.<T extends OfHeader>
MultiMsgCollector<T>getMultiMsgCollector(RequestContext<List<T>> requestContext)
Gets multi msg collector.ConnectionContext
getPrimaryConnectionContext()
Getter.org.opendaylight.mdsal.binding.api.ReadTransaction
getReadTransaction()
Method exposes transaction created for device represented by this context.void
initializeDevice()
Initializes device information after master role acquistion.boolean
initialSubmitTransaction()
Method for initial submit transaction after successful initial gathering.void
instantiateServiceInstance()
boolean
isStatisticsPollingOn()
Checks if the statistics polling property is enabled.boolean
isTransactionsEnabled()
Method returns true if transaction chain manager is enabled.void
onPublished()
Indicates that device context is fully published (e.g.: packetIn messages should be passed).void
onStateAcquired(ContextChainState state)
Event triggered on context chain state change.TranslatorLibrary
oook()
Getter.boolean
processAlienMessage(OfHeader message)
Method processes alien message from device.void
processExperimenterMessage(ExperimenterMessage notification)
Processing of experimenter symmetric message from device.void
processFlowRemovedMessage(FlowRemoved flowRemoved)
Method process async flow removed from device.void
processPacketInMessage(PacketInMessage packetInMessage)
Method process async packet in from device.void
processPortStatusMessage(PortStatusMessage portStatus)
Method process async port status from device.void
processReply(Xid xid, List<? extends OfHeader> ofHeaderList)
Method that set future to context in Map.void
processReply(OfHeader ofHeader)
Method that set future to context in Map.void
registerMastershipWatcher(@NonNull ContextChainMastershipWatcher newWatcher)
Registers mastership change listener to context.void
releaseWriteTransactionLock()
Method to release the acquired write transaction lock.void
setExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider)
Sets the ExtensionConverterProvider.void
setNotificationPublishService(org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService)
Sets notification publish service.boolean
submitTransaction()
Method submits Transaction to DataStore.boolean
syncSubmitTransaction()
Method submits Transaction to DataStore and wait till completes by doing get on tx future.void
updatePacketInRateLimit(long upperBound)
change packetIn rate limiter borders.<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidwriteToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data)
Method creates put operation using provided data in underlying transaction chain.<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidwriteToTransactionWithParentsSlow(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data)
Method creates put operation using provided data in underlying transaction chain and flag to create missing parents.
-
-
-
Method Detail
-
initialSubmitTransaction
public boolean initialSubmitTransaction()
Description copied from interface:DeviceContext
Method for initial submit transaction after successful initial gathering.- Specified by:
initialSubmitTransaction
in interfaceDeviceContext
-
getDeviceState
public DeviceState getDeviceState()
Description copied from interface:DeviceContext
Method provides state of device represented by this device context.- Specified by:
getDeviceState
in interfaceDeviceContext
- Returns:
DeviceState
-
getReadTransaction
public org.opendaylight.mdsal.binding.api.ReadTransaction getReadTransaction()
Description copied from interface:TxFacade
Method exposes transaction created for device represented by this context. This read only transaction has a fresh dataStore snapshot. There is a possibility to get different data set from DataStore as write transaction in this context.- Specified by:
getReadTransaction
in interfaceTxFacade
- Returns:
- readOnlyTransaction - Don't forget to close it after finish reading
-
isTransactionsEnabled
public boolean isTransactionsEnabled()
Description copied from interface:TxFacade
Method returns true if transaction chain manager is enabled.- Specified by:
isTransactionsEnabled
in interfaceTxFacade
- Returns:
- is transaction chain manager enabled
-
writeToTransaction
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void writeToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data)
Description copied from interface:TxFacade
Method creates put operation using provided data in underlying transaction chain.- Specified by:
writeToTransaction
in interfaceTxFacade
-
writeToTransactionWithParentsSlow
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void writeToTransactionWithParentsSlow(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data)
Description copied from interface:TxFacade
Method creates put operation using provided data in underlying transaction chain and flag to create missing parents. WARNING: This method is slow because of additional reading cost. Use it only if you really need to create parents.- Specified by:
writeToTransactionWithParentsSlow
in interfaceTxFacade
-
addDeleteToTxChain
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void addDeleteToTxChain(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
Description copied from interface:TxFacade
Method creates delete operation for provided path in underlying transaction chain.- Specified by:
addDeleteToTxChain
in interfaceTxFacade
-
submitTransaction
public boolean submitTransaction()
Description copied from interface:TxFacade
Method submits Transaction to DataStore.- Specified by:
submitTransaction
in interfaceTxFacade
- Returns:
- transaction is submitted successfully
-
syncSubmitTransaction
public boolean syncSubmitTransaction()
Description copied from interface:TxFacade
Method submits Transaction to DataStore and wait till completes by doing get on tx future.- Specified by:
syncSubmitTransaction
in interfaceTxFacade
- Returns:
- transaction is submitted successfully
-
getPrimaryConnectionContext
public ConnectionContext getPrimaryConnectionContext()
Description copied from interface:DeviceContext
Getter.- Specified by:
getPrimaryConnectionContext
in interfaceDeviceContext
- Returns:
- current devices connection context
-
getDeviceFlowRegistry
public DeviceFlowRegistry getDeviceFlowRegistry()
Description copied from interface:DeviceRegistry
Method exposes flow registry used for storing flow ids identified by calculated flow hash.- Specified by:
getDeviceFlowRegistry
in interfaceDeviceRegistry
- Returns:
- DeviceFlowRegistry
-
getDeviceGroupRegistry
public DeviceGroupRegistry getDeviceGroupRegistry()
Description copied from interface:DeviceRegistry
Method exposes device group registry used for storing group ids.- Specified by:
getDeviceGroupRegistry
in interfaceDeviceRegistry
- Returns:
- DeviceGroupRegistry
-
isStatisticsPollingOn
public boolean isStatisticsPollingOn()
Description copied from interface:DeviceContext
Checks if the statistics polling property is enabled.- Specified by:
isStatisticsPollingOn
in interfaceDeviceContext
- Returns:
- true if statistics polling is enabled.
-
getDeviceMeterRegistry
public DeviceMeterRegistry getDeviceMeterRegistry()
Description copied from interface:DeviceRegistry
Method exposes device meter registry used for storing meter ids.- Specified by:
getDeviceMeterRegistry
in interfaceDeviceRegistry
- Returns:
- DeviceMaterRegistry
-
processReply
public void processReply(OfHeader ofHeader)
Description copied from interface:DeviceReplyProcessor
Method that set future to context in Map.- Specified by:
processReply
in interfaceDeviceReplyProcessor
- Parameters:
ofHeader
- openflow header
-
processReply
public void processReply(Xid xid, List<? extends OfHeader> ofHeaderList)
Description copied from interface:DeviceReplyProcessor
Method that set future to context in Map.- Specified by:
processReply
in interfaceDeviceReplyProcessor
- Parameters:
xid
- xidofHeaderList
- openflow header list
-
processFlowRemovedMessage
public void processFlowRemovedMessage(FlowRemoved flowRemoved)
Description copied from interface:DeviceReplyProcessor
Method process async flow removed from device.- Specified by:
processFlowRemovedMessage
in interfaceDeviceReplyProcessor
- Parameters:
flowRemoved
- flow removed
-
processPortStatusMessage
public void processPortStatusMessage(PortStatusMessage portStatus)
Description copied from interface:DeviceReplyProcessor
Method process async port status from device.- Specified by:
processPortStatusMessage
in interfaceDeviceReplyProcessor
- Parameters:
portStatus
- port status
-
processPacketInMessage
public void processPacketInMessage(PacketInMessage packetInMessage)
Description copied from interface:DeviceReplyProcessor
Method process async packet in from device.- Specified by:
processPacketInMessage
in interfaceDeviceReplyProcessor
- Parameters:
packetInMessage
- packet in message
-
processExperimenterMessage
public void processExperimenterMessage(ExperimenterMessage notification)
Description copied from interface:DeviceReplyProcessor
Processing of experimenter symmetric message from device.- Specified by:
processExperimenterMessage
in interfaceDeviceReplyProcessor
- Parameters:
notification
- notification
-
processAlienMessage
public boolean processAlienMessage(OfHeader message)
Description copied from interface:DeviceReplyProcessor
Method processes alien message from device.- Specified by:
processAlienMessage
in interfaceDeviceReplyProcessor
- Parameters:
message
- alien message- Returns:
- true if alien message was successfully processed
-
oook
public TranslatorLibrary oook()
Description copied from interface:DeviceContext
Getter.- Specified by:
oook
in interfaceDeviceContext
- Returns:
- translator library
-
setNotificationPublishService
public void setNotificationPublishService(org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService)
Description copied from interface:DeviceContext
Sets notification publish service.- Specified by:
setNotificationPublishService
in interfaceDeviceContext
- Parameters:
notificationPublishService
- the notification publish service
-
getMessageSpy
public MessageSpy getMessageSpy()
Description copied from interface:DeviceContext
Gets message spy.- Specified by:
getMessageSpy
in interfaceDeviceContext
- Returns:
- the message spy
-
onPublished
public void onPublished()
Description copied from interface:DeviceContext
Indicates that device context is fully published (e.g.: packetIn messages should be passed).- Specified by:
onPublished
in interfaceDeviceContext
-
getMultiMsgCollector
public <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(RequestContext<List<T>> requestContext)
Description copied from interface:DeviceContext
Gets multi msg collector.- Specified by:
getMultiMsgCollector
in interfaceDeviceContext
- Type Parameters:
T
- the type parameter- Parameters:
requestContext
- the request context- Returns:
- the multi msg collector
-
updatePacketInRateLimit
public void updatePacketInRateLimit(long upperBound)
Description copied from interface:DeviceContext
change packetIn rate limiter borders.- Specified by:
updatePacketInRateLimit
in interfaceDeviceContext
- Parameters:
upperBound
- max amount of outstanding packetIns
-
setExtensionConverterProvider
public void setExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider)
Description copied from interface:ExtensionConverterProviderKeeper
Sets the ExtensionConverterProvider. Extension converters will be kept in order to be accessible by inner infrastructure.- Specified by:
setExtensionConverterProvider
in interfaceExtensionConverterProviderKeeper
- Parameters:
extensionConverterProvider
- the ExtensionConverterProvider
-
getExtensionConverterProvider
public ExtensionConverterProvider getExtensionConverterProvider()
Description copied from interface:ExtensionConverterProviderKeeper
Returns the extension converters registry access point for by inner infrastructure.- Specified by:
getExtensionConverterProvider
in interfaceExtensionConverterProviderKeeper
- Returns:
- extensionConverterProvider
-
closeServiceInstance
public com.google.common.util.concurrent.ListenableFuture<?> closeServiceInstance()
- Specified by:
closeServiceInstance
in interfaceorg.opendaylight.mdsal.singleton.common.api.ClusterSingletonService
-
getDeviceInfo
public DeviceInfo getDeviceInfo()
Description copied from interface:OFPContext
Get device info.- Specified by:
getDeviceInfo
in interfaceOFPContext
- Returns:
- device info
-
registerMastershipWatcher
public void registerMastershipWatcher(@NonNull ContextChainMastershipWatcher newWatcher)
Description copied from interface:OFPContext
Registers mastership change listener to context.- Specified by:
registerMastershipWatcher
in interfaceOFPContext
- Parameters:
newWatcher
- mastership change listener
-
getIdentifier
public org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier getIdentifier()
- Specified by:
getIdentifier
in interfaceorg.opendaylight.yangtools.concepts.Identifiable<org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier>
-
acquireWriteTransactionLock
public void acquireWriteTransactionLock()
Description copied from interface:TxFacade
Method to acquire a write transaction lock to perform atomic transactions to MD-SAL.- Specified by:
acquireWriteTransactionLock
in interfaceTxFacade
-
releaseWriteTransactionLock
public void releaseWriteTransactionLock()
Description copied from interface:TxFacade
Method to release the acquired write transaction lock.- Specified by:
releaseWriteTransactionLock
in interfaceTxFacade
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceOFPContext
-
canUseSingleLayerSerialization
public boolean canUseSingleLayerSerialization()
Description copied from interface:DeviceContext
Checks if device and controller supports single layer serialization.- Specified by:
canUseSingleLayerSerialization
in interfaceDeviceContext
- Returns:
- true if single layer serialization is supported
-
instantiateServiceInstance
public void instantiateServiceInstance()
- Specified by:
instantiateServiceInstance
in interfaceorg.opendaylight.mdsal.singleton.common.api.ClusterSingletonService
-
initializeDevice
public void initializeDevice()
Description copied from interface:DeviceInitializationContext
Initializes device information after master role acquistion.- Specified by:
initializeDevice
in interfaceDeviceInitializationContext
-
createRequestContext
public <T> RequestContext<T> createRequestContext()
Description copied from interface:RequestContextStack
Method returns new request context for current request.- Specified by:
createRequestContext
in interfaceRequestContextStack
- Returns:
- A request context, or null if one cannot be created.
-
onStateAcquired
public void onStateAcquired(ContextChainState state)
Description copied from interface:ContextChainStateListener
Event triggered on context chain state change.- Specified by:
onStateAcquired
in interfaceContextChainStateListener
- Parameters:
state
- context chain state
-
getFlowGroupInfoHistory
public FlowGroupInfoHistory getFlowGroupInfoHistory()
- Specified by:
getFlowGroupInfoHistory
in interfaceDeviceContext
-
-