Added ability to track whether or not node has all components running fully.
Change-Id: Ib2b90c7a842976a3b3a9711367fa1eed43103b17
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java b/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
index 4794487..84d4f92 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
@@ -22,7 +22,7 @@
/**
* Service for administering the cluster node membership.
*/
-public interface ClusterAdminService {
+public interface ClusterAdminService extends ClusterService {
/**
* Forms cluster configuration based on the specified set of node
@@ -50,4 +50,11 @@
*/
void removeNode(NodeId nodeId);
+ /**
+ * Marks the current node as fully started or not.
+ *
+ * @param started true indicates all components have been started
+ */
+ void markFullyStarted(boolean started);
+
}
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
index 015a648..323b9c7 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterService.java
@@ -50,7 +50,9 @@
ControllerNode getNode(NodeId nodeId);
/**
- * Returns the availability state of the specified controller node.
+ * Returns the availability state of the specified controller node. Note
+ * that this does not imply that all the core and application components
+ * have been fully activated; only that the node has joined the cluster.
*
* @param nodeId controller node identifier
* @return availability state
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
index 0481d51..64348a3 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
@@ -57,6 +57,13 @@
ControllerNode.State getState(NodeId nodeId);
/**
+ * Marks the current node as fully started.
+ *
+ * @param started true indicates all components have been started
+ */
+ void markFullyStarted(boolean started);
+
+ /**
* Returns the system when the availability state was last updated.
*
* @param nodeId controller node identifier
diff --git a/core/api/src/main/java/org/onosproject/cluster/ControllerNode.java b/core/api/src/main/java/org/onosproject/cluster/ControllerNode.java
index 2f74ae6..2c33c99 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ControllerNode.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ControllerNode.java
@@ -25,6 +25,12 @@
/** Represents the operational state of the instance. */
enum State {
/**
+ * Signifies that the instance is active and that all components are
+ * operating normally.
+ */
+ READY,
+
+ /**
* Signifies that the instance is active and operating normally.
*/
ACTIVE,
@@ -33,7 +39,25 @@
* Signifies that the instance is inactive, which means either down or
* up, but not operational.
*/
- INACTIVE
+ INACTIVE;
+
+ /**
+ * Indicates whether the state represents node which is active or ready.
+ *
+ * @return true if active or ready
+ */
+ public boolean isActive() {
+ return this == ACTIVE || this == READY;
+ }
+
+ /**
+ * Indicates whether the state represents a node which is ready.
+ *
+ * @return true if active and ready
+ */
+ public boolean isReady() {
+ return this == READY;
+ }
}
/**