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, DeviceInitializationContext
 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquireWriteTransactionLock()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.booleancanUseSingleLayerSerialization()Checks if device and controller supports single layer serialization.voidclose()com.google.common.util.concurrent.ListenableFuture<?>closeServiceInstance()<T> @Nullable RequestContext<T>createRequestContext()Method returns new request context for current request.DeviceFlowRegistrygetDeviceFlowRegistry()Method exposes flow registry used for storing flow ids identified by calculated flow hash.DeviceGroupRegistrygetDeviceGroupRegistry()Method exposes device group registry used for storing group ids.DeviceInfogetDeviceInfo()Get device info.DeviceMeterRegistrygetDeviceMeterRegistry()Method exposes device meter registry used for storing meter ids.DeviceStategetDeviceState()Method provides state of device represented by this device context.ExtensionConverterProvidergetExtensionConverterProvider()Returns the extension converters registry access point for by inner infrastructure.@NonNull org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifiergetIdentifier()MessageSpygetMessageSpy()Gets message spy.<T extends OfHeader>
MultiMsgCollector<T>getMultiMsgCollector(RequestContext<List<T>> requestContext)Gets multi msg collector.ConnectionContextgetPrimaryConnectionContext()Getter.org.opendaylight.mdsal.binding.api.ReadTransactiongetReadTransaction()Method exposes transaction created for device represented by this context.voidinitializeDevice()Initializes device information after master role acquistion.booleaninitialSubmitTransaction()Method for initial submit transaction after successful initial gathering.voidinstantiateServiceInstance()booleanisStatisticsPollingOn()Checks if the statistics polling property is enabled.booleanisTransactionsEnabled()Method returns true if transaction chain manager is enabled.voidonPublished()Indicates that device context is fully published (e.g.: packetIn messages should be passed).voidonStateAcquired(ContextChainState state)Event triggered on context chain state change.TranslatorLibraryoook()Getter.booleanprocessAlienMessage(OfHeader message)Method processes alien message from device.voidprocessExperimenterMessage(ExperimenterMessage notification)Processing of experimenter symmetric message from device.voidprocessFlowRemovedMessage(FlowRemoved flowRemoved)Method process async flow removed from device.voidprocessPacketInMessage(PacketInMessage packetInMessage)Method process async packet in from device.voidprocessPortStatusMessage(PortStatusMessage portStatus)Method process async port status from device.voidprocessReply(Xid xid, List<? extends OfHeader> ofHeaderList)Method that set future to context in Map.voidprocessReply(OfHeader ofHeader)Method that set future to context in Map.voidregisterMastershipWatcher(@NonNull ContextChainMastershipWatcher newWatcher)Registers mastership change listener to context.voidreleaseWriteTransactionLock()Method to release the acquired write transaction lock.voidsetExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider)Sets the ExtensionConverterProvider.voidsetNotificationPublishService(org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService)Sets notification publish service.booleansubmitTransaction()Method submits Transaction to DataStore.booleansyncSubmitTransaction()Method submits Transaction to DataStore and wait till completes by doing get on tx future.voidupdatePacketInRateLimit(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:DeviceContextMethod for initial submit transaction after successful initial gathering.- Specified by:
 initialSubmitTransactionin interfaceDeviceContext
 
- 
getDeviceState
public DeviceState getDeviceState()
Description copied from interface:DeviceContextMethod provides state of device represented by this device context.- Specified by:
 getDeviceStatein interfaceDeviceContext- Returns:
 DeviceState
 
- 
getReadTransaction
public org.opendaylight.mdsal.binding.api.ReadTransaction getReadTransaction()
Description copied from interface:TxFacadeMethod 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:
 getReadTransactionin interfaceTxFacade- Returns:
 - readOnlyTransaction - Don't forget to close it after finish reading
 
 
- 
isTransactionsEnabled
public boolean isTransactionsEnabled()
Description copied from interface:TxFacadeMethod returns true if transaction chain manager is enabled.- Specified by:
 isTransactionsEnabledin 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:TxFacadeMethod creates put operation using provided data in underlying transaction chain.- Specified by:
 writeToTransactionin 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:TxFacadeMethod 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:
 writeToTransactionWithParentsSlowin 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:TxFacadeMethod creates delete operation for provided path in underlying transaction chain.- Specified by:
 addDeleteToTxChainin interfaceTxFacade
 
- 
submitTransaction
public boolean submitTransaction()
Description copied from interface:TxFacadeMethod submits Transaction to DataStore.- Specified by:
 submitTransactionin interfaceTxFacade- Returns:
 - transaction is submitted successfully
 
 
- 
syncSubmitTransaction
public boolean syncSubmitTransaction()
Description copied from interface:TxFacadeMethod submits Transaction to DataStore and wait till completes by doing get on tx future.- Specified by:
 syncSubmitTransactionin interfaceTxFacade- Returns:
 - transaction is submitted successfully
 
 
- 
getPrimaryConnectionContext
public ConnectionContext getPrimaryConnectionContext()
Description copied from interface:DeviceContextGetter.- Specified by:
 getPrimaryConnectionContextin interfaceDeviceContext- Returns:
 - current devices connection context
 
 
- 
getDeviceFlowRegistry
public DeviceFlowRegistry getDeviceFlowRegistry()
Description copied from interface:DeviceRegistryMethod exposes flow registry used for storing flow ids identified by calculated flow hash.- Specified by:
 getDeviceFlowRegistryin interfaceDeviceRegistry- Returns:
 - DeviceFlowRegistry
 
 
- 
getDeviceGroupRegistry
public DeviceGroupRegistry getDeviceGroupRegistry()
Description copied from interface:DeviceRegistryMethod exposes device group registry used for storing group ids.- Specified by:
 getDeviceGroupRegistryin interfaceDeviceRegistry- Returns:
 - DeviceGroupRegistry
 
 
- 
isStatisticsPollingOn
public boolean isStatisticsPollingOn()
Description copied from interface:DeviceContextChecks if the statistics polling property is enabled.- Specified by:
 isStatisticsPollingOnin interfaceDeviceContext- Returns:
 - true if statistics polling is enabled.
 
 
- 
getDeviceMeterRegistry
public DeviceMeterRegistry getDeviceMeterRegistry()
Description copied from interface:DeviceRegistryMethod exposes device meter registry used for storing meter ids.- Specified by:
 getDeviceMeterRegistryin interfaceDeviceRegistry- Returns:
 - DeviceMaterRegistry
 
 
- 
processReply
public void processReply(OfHeader ofHeader)
Description copied from interface:DeviceReplyProcessorMethod that set future to context in Map.- Specified by:
 processReplyin interfaceDeviceReplyProcessor- Parameters:
 ofHeader- openflow header
 
- 
processReply
public void processReply(Xid xid, List<? extends OfHeader> ofHeaderList)
Description copied from interface:DeviceReplyProcessorMethod that set future to context in Map.- Specified by:
 processReplyin interfaceDeviceReplyProcessor- Parameters:
 xid- xidofHeaderList- openflow header list
 
- 
processFlowRemovedMessage
public void processFlowRemovedMessage(FlowRemoved flowRemoved)
Description copied from interface:DeviceReplyProcessorMethod process async flow removed from device.- Specified by:
 processFlowRemovedMessagein interfaceDeviceReplyProcessor- Parameters:
 flowRemoved- flow removed
 
- 
processPortStatusMessage
public void processPortStatusMessage(PortStatusMessage portStatus)
Description copied from interface:DeviceReplyProcessorMethod process async port status from device.- Specified by:
 processPortStatusMessagein interfaceDeviceReplyProcessor- Parameters:
 portStatus- port status
 
- 
processPacketInMessage
public void processPacketInMessage(PacketInMessage packetInMessage)
Description copied from interface:DeviceReplyProcessorMethod process async packet in from device.- Specified by:
 processPacketInMessagein interfaceDeviceReplyProcessor- Parameters:
 packetInMessage- packet in message
 
- 
processExperimenterMessage
public void processExperimenterMessage(ExperimenterMessage notification)
Description copied from interface:DeviceReplyProcessorProcessing of experimenter symmetric message from device.- Specified by:
 processExperimenterMessagein interfaceDeviceReplyProcessor- Parameters:
 notification- notification
 
- 
processAlienMessage
public boolean processAlienMessage(OfHeader message)
Description copied from interface:DeviceReplyProcessorMethod processes alien message from device.- Specified by:
 processAlienMessagein interfaceDeviceReplyProcessor- Parameters:
 message- alien message- Returns:
 - true if alien message was successfully processed
 
 
- 
oook
public TranslatorLibrary oook()
Description copied from interface:DeviceContextGetter.- Specified by:
 oookin interfaceDeviceContext- Returns:
 - translator library
 
 
- 
setNotificationPublishService
public void setNotificationPublishService(org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService)
Description copied from interface:DeviceContextSets notification publish service.- Specified by:
 setNotificationPublishServicein interfaceDeviceContext- Parameters:
 notificationPublishService- the notification publish service
 
- 
getMessageSpy
public MessageSpy getMessageSpy()
Description copied from interface:DeviceContextGets message spy.- Specified by:
 getMessageSpyin interfaceDeviceContext- Returns:
 - the message spy
 
 
- 
onPublished
public void onPublished()
Description copied from interface:DeviceContextIndicates that device context is fully published (e.g.: packetIn messages should be passed).- Specified by:
 onPublishedin interfaceDeviceContext
 
- 
getMultiMsgCollector
public <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(RequestContext<List<T>> requestContext)
Description copied from interface:DeviceContextGets multi msg collector.- Specified by:
 getMultiMsgCollectorin 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:DeviceContextchange packetIn rate limiter borders.- Specified by:
 updatePacketInRateLimitin interfaceDeviceContext- Parameters:
 upperBound- max amount of outstanding packetIns
 
- 
setExtensionConverterProvider
public void setExtensionConverterProvider(ExtensionConverterProvider extensionConverterProvider)
Description copied from interface:ExtensionConverterProviderKeeperSets the ExtensionConverterProvider. Extension converters will be kept in order to be accessible by inner infrastructure.- Specified by:
 setExtensionConverterProviderin interfaceExtensionConverterProviderKeeper- Parameters:
 extensionConverterProvider- the ExtensionConverterProvider
 
- 
getExtensionConverterProvider
public ExtensionConverterProvider getExtensionConverterProvider()
Description copied from interface:ExtensionConverterProviderKeeperReturns the extension converters registry access point for by inner infrastructure.- Specified by:
 getExtensionConverterProviderin interfaceExtensionConverterProviderKeeper- Returns:
 - extensionConverterProvider
 
 
- 
closeServiceInstance
public com.google.common.util.concurrent.ListenableFuture<?> closeServiceInstance()
- Specified by:
 closeServiceInstancein interfaceorg.opendaylight.mdsal.singleton.common.api.ClusterSingletonService
 
- 
getDeviceInfo
public DeviceInfo getDeviceInfo()
Description copied from interface:OFPContextGet device info.- Specified by:
 getDeviceInfoin interfaceOFPContext- Returns:
 - device info
 
 
- 
registerMastershipWatcher
public void registerMastershipWatcher(@NonNull ContextChainMastershipWatcher newWatcher)
Description copied from interface:OFPContextRegisters mastership change listener to context.- Specified by:
 registerMastershipWatcherin interfaceOFPContext- Parameters:
 newWatcher- mastership change listener
 
- 
getIdentifier
public @NonNull org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier getIdentifier()
- Specified by:
 getIdentifierin interfaceorg.opendaylight.yangtools.concepts.Identifiable<org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier>
 
- 
acquireWriteTransactionLock
public void acquireWriteTransactionLock()
Description copied from interface:TxFacadeMethod to acquire a write transaction lock to perform atomic transactions to MD-SAL.- Specified by:
 acquireWriteTransactionLockin interfaceTxFacade
 
- 
releaseWriteTransactionLock
public void releaseWriteTransactionLock()
Description copied from interface:TxFacadeMethod to release the acquired write transaction lock.- Specified by:
 releaseWriteTransactionLockin interfaceTxFacade
 
- 
close
public void close()
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceOFPContext
 
- 
canUseSingleLayerSerialization
public boolean canUseSingleLayerSerialization()
Description copied from interface:DeviceContextChecks if device and controller supports single layer serialization.- Specified by:
 canUseSingleLayerSerializationin interfaceDeviceContext- Returns:
 - true if single layer serialization is supported
 
 
- 
instantiateServiceInstance
public void instantiateServiceInstance()
- Specified by:
 instantiateServiceInstancein interfaceorg.opendaylight.mdsal.singleton.common.api.ClusterSingletonService
 
- 
initializeDevice
public void initializeDevice()
Description copied from interface:DeviceInitializationContextInitializes device information after master role acquistion.- Specified by:
 initializeDevicein interfaceDeviceInitializationContext
 
- 
createRequestContext
public <T> @Nullable RequestContext<T> createRequestContext()
Description copied from interface:RequestContextStackMethod returns new request context for current request.- Specified by:
 createRequestContextin interfaceRequestContextStack- Returns:
 - A request context, or null if one cannot be created.
 
 
- 
onStateAcquired
public void onStateAcquired(ContextChainState state)
Description copied from interface:ContextChainStateListenerEvent triggered on context chain state change.- Specified by:
 onStateAcquiredin interfaceContextChainStateListener- Parameters:
 state- context chain state
 
 - 
 
 -