package org.opendaylight.openflowplugin.api.openflow.device;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.openflowplugin.api.openflow.OFPManager;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
-import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceContextReadyHandler;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceLifecycleSupervisor;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
+import org.opendaylight.openflowplugin.api.openflow.translator.TranslatorLibrarian;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
+
+import javax.annotation.CheckForNull;
/**
* This interface is responsible for instantiating DeviceContext and
* registering transaction chain for each DeviceContext. Each device
* has its own device context managed by this manager.
- * <p/>
- * <p/>
- * Created by Martin Bobak <mbobak@cisco.com> on 25.2.2015.
*/
-public interface DeviceManager extends DeviceConnectedHandler {
+public interface DeviceManager extends DeviceConnectedHandler, DeviceDisconnectedHandler, DeviceLifecycleSupervisor,
+ DeviceInitializationPhaseHandler, DeviceTerminationPhaseHandler, TranslatorLibrarian, AutoCloseable, OFPManager {
/**
- * Method allows to send message that will be using RequestContext
- * wrapped by this context.
- *
- * @param dataObject
+ * invoked after all services injected
*/
- void sendMessage(DataObject dataObject, RequestContext requestContext);
+ void initialize();
/**
- * Method allows to send rpc request that will be using RequestContext
- * wrapped by this context.
+ * Returning device context from map maintained in device manager
+ * This prevent to send whole device context to another context
+ * If device context not exists for nodeId it will return null
*
- * @param dataObject
+ * @param deviceInfo@return device context or null
*/
- Xid sendRequest(DataObject dataObject, RequestContext requestContext);
+ DeviceContext getDeviceContextFromNodeId(DeviceInfo deviceInfo);
/**
- * Method registers handler responsible for handling operations related to connected device after
- * request context is created.
+ * Method has to activate (MASTER) or deactivate (SLAVE) TransactionChainManager.
+ * TransactionChainManager represents possibility to write or delete Node subtree data
+ * for actual Controller Cluster Node. We are able to have an active TxManager only if
+ * 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 deviceContextReadyHandler
+ * @param deviceInfo
+ * @param role - NewRole expect to be {@link OfpRole#BECOMESLAVE} or {@link OfpRole#BECOMEMASTER}
+ * @return RoleChangeTxChainManager future for activation/deactivation
*/
- public void addRequestContextReadyHandler(DeviceContextReadyHandler deviceContextReadyHandler);
+ ListenableFuture<Void> onClusterRoleChange(final DeviceInfo deviceInfo, final OfpRole role);
+
}
+