Merge "Conductor RPC registration moved"
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / device / DeviceContext.java
index 62188f8fdf66c988d62f4d5b3530e5fc417e4c01..79b84011b4c720689439c52e73c03cdd65952b36 100644 (file)
@@ -13,12 +13,9 @@ import io.netty.util.Timeout;
 import java.math.BigInteger;
 import java.util.List;
 import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
+
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginTimer;
+import org.opendaylight.openflowplugin.api.openflow.OFPContext;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
@@ -31,8 +28,6 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * <p>
@@ -49,12 +44,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * Context can have at any point in time. Should this quota be exceeded, any further attempt to make
  * a request to the switch will fail immediately, with proper error indication.
  * </p>
- * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 25.2.2015.
  */
 public interface DeviceContext extends AutoCloseable,
         DeviceReplyProcessor,
         PortNumberCache,
-        XidSequencer {
+        TxFacade,
+        XidSequencer,
+        OFPContext{
 
     void setStatisticsRpcEnabled(boolean isStatisticsRpcEnabled);
 
@@ -109,6 +105,8 @@ public interface DeviceContext extends AutoCloseable,
      */
     DeviceState getDeviceState();
 
+    DeviceInfo getDeviceInfo();
+
     /**
      * Method has to activate (MASTER) or deactivate (SLAVE) TransactionChainManager.
      * TransactionChainManager represents possibility to write or delete Node subtree data
@@ -116,13 +114,12 @@ public interface DeviceContext extends AutoCloseable,
      * newRole is {@link OfpRole#BECOMESLAVE}.
      * Parameters are used as marker to be sure it is change to SLAVE from MASTER or from
      * MASTER to SLAVE and the last parameter "cleanDataStore" is used for validation only.
-     * @param oldRole - old role for quick validation for needed processing
      * @param role - NewRole expect to be {@link OfpRole#BECOMESLAVE} or {@link OfpRole#BECOMEMASTER}
      * @return RoleChangeTxChainManager future for activation/deactivation
      * @deprecated replaced by method onDeviceTakeClusterLeadership and onDevicLostClusterLeadership
      */
     @Deprecated
-    ListenableFuture<Void> onClusterRoleChange(@Nullable OfpRole oldRole, @CheckForNull OfpRole role);
+    ListenableFuture<Void> onClusterRoleChange(@CheckForNull OfpRole role);
 
     /**
      * Method has to activate TransactionChainManager and prepare all Contexts from Device Contects suite
@@ -131,45 +128,12 @@ public interface DeviceContext extends AutoCloseable,
      */
     ListenableFuture<Void> onDeviceTakeClusterLeadership();
 
-    /**
-     * Method has to deactivate TransactionChainManager and prepare all Contexts from Device Contects suite
-     * to Lost ClusterLeadership role {@link OfpRole#BECOMESLAVE} (e.g. Stop RPC rounting, stop StatPolling ...)
-     * @return RoleChangeTxChainManager future for deactivation
-     */
-    ListenableFuture<Void> onDeviceLostClusterLeadership();
-
-    /**
-     * Method creates put operation using provided data in underlying transaction chain.
-     */
-    <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store, final InstanceIdentifier<T> path, final T data) throws Exception;
-
-    /**
-     * Method creates delete operation for provided path in underlying transaction chain.
-     */
-    <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store, final InstanceIdentifier<T> path) throws Exception;
-
-    /**
-     * Method submits Transaction to DataStore.
-     * @return transaction is submitted successfully
-     */
-    boolean submitTransaction();
-
     /**
      * Method has to close TxManager ASAP we are notified about Closed Connection
      * @return sync. future for Slave and MD-SAL completition for Master
      */
     ListenableFuture<Void> shuttingDownDataStoreTransactions();
 
-    /**
-     * 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.
-     * @return readOnlyTransaction - Don't forget to close it after finish reading
-     */
-    ReadOnlyTransaction getReadTransaction();
-
-
     /**
      * Method provides current devices connection context.
      *