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 Details

    • initialSubmitTransaction

      public boolean initialSubmitTransaction()
      Description copied from interface: DeviceContext
      Method for initial submit transaction after successful initial gathering.
      Specified by:
      initialSubmitTransaction in interface DeviceContext
    • getDeviceState

      public DeviceState getDeviceState()
      Description copied from interface: DeviceContext
      Method provides state of device represented by this device context.
      Specified by:
      getDeviceState in interface DeviceContext
      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 interface TxFacade
      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 interface TxFacade
      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 interface TxFacade
    • 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 interface TxFacade
    • 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 interface TxFacade
    • submitTransaction

      public boolean submitTransaction()
      Description copied from interface: TxFacade
      Method submits Transaction to DataStore.
      Specified by:
      submitTransaction in interface TxFacade
      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 interface TxFacade
      Returns:
      transaction is submitted successfully
    • getPrimaryConnectionContext

      public ConnectionContext getPrimaryConnectionContext()
      Description copied from interface: DeviceContext
      Getter.
      Specified by:
      getPrimaryConnectionContext in interface DeviceContext
      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 interface DeviceRegistry
      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 interface DeviceRegistry
      Returns:
      DeviceGroupRegistry
    • isStatisticsPollingOn

      public boolean isStatisticsPollingOn()
      Description copied from interface: DeviceContext
      Checks if the statistics polling property is enabled.
      Specified by:
      isStatisticsPollingOn in interface DeviceContext
      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 interface DeviceRegistry
      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 interface DeviceReplyProcessor
      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 interface DeviceReplyProcessor
      Parameters:
      xid - xid
      ofHeaderList - 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 interface DeviceReplyProcessor
      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 interface DeviceReplyProcessor
      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 interface DeviceReplyProcessor
      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 interface DeviceReplyProcessor
      Parameters:
      notification - notification
    • processAlienMessage

      public boolean processAlienMessage(OfHeader message)
      Description copied from interface: DeviceReplyProcessor
      Method processes alien message from device.
      Specified by:
      processAlienMessage in interface DeviceReplyProcessor
      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 interface DeviceContext
      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 interface DeviceContext
      Parameters:
      notificationPublishService - the notification publish service
    • getMessageSpy

      public MessageSpy getMessageSpy()
      Description copied from interface: DeviceContext
      Gets message spy.
      Specified by:
      getMessageSpy in interface DeviceContext
      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 interface DeviceContext
    • 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 interface DeviceContext
      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 interface DeviceContext
      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 interface ExtensionConverterProviderKeeper
      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 interface ExtensionConverterProviderKeeper
      Returns:
      extensionConverterProvider
    • closeServiceInstance

      public com.google.common.util.concurrent.ListenableFuture<?> closeServiceInstance()
      Specified by:
      closeServiceInstance in interface org.opendaylight.mdsal.singleton.api.ClusterSingletonService
    • getDeviceInfo

      public DeviceInfo getDeviceInfo()
      Description copied from interface: OFPContext
      Get device info.
      Specified by:
      getDeviceInfo in interface OFPContext
      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 interface OFPContext
      Parameters:
      newWatcher - mastership change listener
    • getIdentifier

      public org.opendaylight.mdsal.singleton.api.ServiceGroupIdentifier getIdentifier()
      Specified by:
      getIdentifier in interface org.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 interface TxFacade
    • releaseWriteTransactionLock

      public void releaseWriteTransactionLock()
      Description copied from interface: TxFacade
      Method to release the acquired write transaction lock.
      Specified by:
      releaseWriteTransactionLock in interface TxFacade
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface OFPContext
    • canUseSingleLayerSerialization

      public boolean canUseSingleLayerSerialization()
      Description copied from interface: DeviceContext
      Checks if device and controller supports single layer serialization.
      Specified by:
      canUseSingleLayerSerialization in interface DeviceContext
      Returns:
      true if single layer serialization is supported
    • instantiateServiceInstance

      public void instantiateServiceInstance()
      Specified by:
      instantiateServiceInstance in interface org.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 interface DeviceInitializationContext
    • createRequestContext

      public <T> RequestContext<T> createRequestContext()
      Description copied from interface: RequestContextStack
      Method returns new request context for current request.
      Specified by:
      createRequestContext in interface RequestContextStack
      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 interface ContextChainStateListener
      Parameters:
      state - context chain state
    • getFlowGroupInfoHistory

      public FlowGroupInfoHistory getFlowGroupInfoHistory()
      Specified by:
      getFlowGroupInfoHistory in interface DeviceContext