Class DeviceContextImpl
java.lang.Object
org.opendaylight.openflowplugin.impl.device.DeviceContextImpl
- All Implemented Interfaces:
AutoCloseable
,org.opendaylight.mdsal.singleton.api.ClusterSingletonService
,DeviceContext
,DeviceRegistry
,DeviceReplyProcessor
,RequestContextStack
,TxFacade
,ContextChainStateListener
,DeviceInitializationContext
,OFPContext
,ExtensionConverterProviderKeeper
,org.opendaylight.yangtools.concepts.Identifiable<org.opendaylight.mdsal.singleton.api.ServiceGroupIdentifier>
public class DeviceContextImpl
extends Object
implements DeviceContext, ExtensionConverterProviderKeeper
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Checks if device and controller supports single layer serialization.void
close()
com.google.common.util.concurrent.ListenableFuture<?>
<T> RequestContext<T>
Method returns new request context for current request.Method exposes flow registry used for storing flow ids identified by calculated flow hash.Method exposes device group registry used for storing group ids.Get device info.Method exposes device meter registry used for storing meter ids.Method provides state of device represented by this device context.Returns the extension converters registry access point for by inner infrastructure.org.opendaylight.mdsal.singleton.api.ServiceGroupIdentifier
Gets message spy.<T extends OfHeader>
MultiMsgCollector<T>getMultiMsgCollector
(RequestContext<List<T>> requestContext) Gets multi msg collector.Getter.org.opendaylight.mdsal.binding.api.ReadTransaction
Method exposes transaction created for device represented by this context.void
Initializes device information after master role acquistion.boolean
Method for initial submit transaction after successful initial gathering.void
boolean
Checks if the statistics polling property is enabled.boolean
Method returns true if transaction chain manager is enabled.void
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.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
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
Method submits Transaction to DataStore.boolean
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 Details
-
initialSubmitTransaction
public boolean initialSubmitTransaction()Description copied from interface:DeviceContext
Method for initial submit transaction after successful initial gathering.- Specified by:
initialSubmitTransaction
in interfaceDeviceContext
-
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
Description copied from interface:DeviceContext
Getter.- Specified by:
getPrimaryConnectionContext
in interfaceDeviceContext
- Returns:
- current devices connection context
-
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
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
Description copied from interface:DeviceRegistry
Method exposes device meter registry used for storing meter ids.- Specified by:
getDeviceMeterRegistry
in interfaceDeviceRegistry
- Returns:
- DeviceMaterRegistry
-
processReply
Description copied from interface:DeviceReplyProcessor
Method that set future to context in Map.- Specified by:
processReply
in interfaceDeviceReplyProcessor
- Parameters:
ofHeader
- openflow header
-
processReply
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
Description copied from interface:DeviceReplyProcessor
Method process async flow removed from device.- Specified by:
processFlowRemovedMessage
in interfaceDeviceReplyProcessor
- Parameters:
flowRemoved
- flow removed
-
processPortStatusMessage
Description copied from interface:DeviceReplyProcessor
Method process async port status from device.- Specified by:
processPortStatusMessage
in interfaceDeviceReplyProcessor
- Parameters:
portStatus
- port status
-
processPacketInMessage
Description copied from interface:DeviceReplyProcessor
Method process async packet in from device.- Specified by:
processPacketInMessage
in interfaceDeviceReplyProcessor
- Parameters:
packetInMessage
- packet in message
-
processExperimenterMessage
Description copied from interface:DeviceReplyProcessor
Processing of experimenter symmetric message from device.- Specified by:
processExperimenterMessage
in interfaceDeviceReplyProcessor
- Parameters:
notification
- notification
-
processAlienMessage
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
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
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
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
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.api.ClusterSingletonService
-
getDeviceInfo
Description copied from interface:OFPContext
Get device info.- Specified by:
getDeviceInfo
in interfaceOFPContext
- Returns:
- device info
-
registerMastershipWatcher
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.api.ServiceGroupIdentifier getIdentifier()- Specified by:
getIdentifier
in interfaceorg.opendaylight.yangtools.concepts.Identifiable<org.opendaylight.mdsal.singleton.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.api.ClusterSingletonService
-
initializeDevice
public void initializeDevice()Description copied from interface:DeviceInitializationContext
Initializes device information after master role acquistion.- Specified by:
initializeDevice
in interfaceDeviceInitializationContext
-
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
Description copied from interface:ContextChainStateListener
Event triggered on context chain state change.- Specified by:
onStateAcquired
in interfaceContextChainStateListener
- Parameters:
state
- context chain state
-
getFlowGroupInfoHistory
- Specified by:
getFlowGroupInfoHistory
in interfaceDeviceContext
-