*/
package org.opendaylight.openflowplugin.api.openflow;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.RejectedExecutionException;
+import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
+
/**
* General API for all OFP Context
*/
}
/**
- * distinguished device context states
+ * Context state
*/
enum CONTEXT_STATE {
- /**
- * initial phase
- */
+ /* Initialization phase, context not yet fully initialized */
INITIALIZATION,
- /**
- * standard phase
- */
+ /* Standard working phase everything is fine */
WORKING,
- /**
- * termination phase
- */
+ /* Termination phase context is being shutting down */
TERMINATION
}
+ /**
+ * @return actual context state
+ */
CONTEXT_STATE getState();
+ /**
+ * Starting cluster services for context becoming master
+ */
+ default void startupClusterServices() throws ExecutionException, InterruptedException {
+ throw new InterruptedException("Cannot start abstract service, check implementation of cluster services");
+ }
+
+ /**
+ * About to stop services in cluster not master anymore or going down
+ * @return Future most of services need time to be closed
+ */
+ default ListenableFuture<Void> stopClusterServices(){
+ return Futures.immediateFailedFuture(new RejectedExecutionException("Cannot stop abstract services, check implementation of cluster services"));
+ }
+
+ /**
+ * @return cluster singleton service identifier
+ */
+ ServiceGroupIdentifier getServiceIdentifier();
+
+ /**
+ * @return device info
+ */
+ DeviceInfo getDeviceInfo();
+
}