Added ability to track whether or not node has all components running fully.
Change-Id: Ib2b90c7a842976a3b3a9711367fa1eed43103b17
diff --git a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
index 6e91738..1664265 100644
--- a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
@@ -22,7 +22,7 @@
import org.apache.karaf.shell.commands.Command;
import org.joda.time.DateTime;
import org.onlab.util.Tools;
-import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.utils.Comparators;
@@ -36,15 +36,14 @@
* Lists all controller cluster nodes.
*/
@Command(scope = "onos", name = "nodes",
- description = "Lists all controller cluster nodes")
+ description = "Lists all controller cluster nodes")
public class NodesListCommand extends AbstractShellCommand {
- private static final String FMT =
- "id=%s, address=%s:%s, state=%s, updated=%s %s";
+ private static final String FMT = "id=%s, address=%s:%s, state=%s, updated=%s %s";
@Override
protected void execute() {
- ClusterService service = get(ClusterService.class);
+ ClusterAdminService service = get(ClusterAdminService.class);
List<ControllerNode> nodes = newArrayList(service.getNodes());
Collections.sort(nodes, Comparators.NODE_COMPARATOR);
if (outputJson()) {
@@ -58,26 +57,24 @@
timeAgo = Tools.timeAgo(lastUpdated.getMillis());
}
print(FMT, node.id(), node.ip(), node.tcpPort(),
- service.getState(node.id()),
- timeAgo,
+ service.getState(node.id()), timeAgo,
node.equals(self) ? "*" : "");
}
}
}
// Produces JSON structure.
- private JsonNode json(ClusterService service, List<ControllerNode> nodes) {
+ private JsonNode json(ClusterAdminService service, List<ControllerNode> nodes) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode result = mapper.createArrayNode();
ControllerNode self = service.getLocalNode();
for (ControllerNode node : nodes) {
ControllerNode.State nodeState = service.getState(node.id());
ObjectNode newNode = mapper.createObjectNode()
- .put("id", node.id().toString())
- .put("ip", node.ip().toString())
- .put("tcpPort", node.tcpPort())
- .put("self", node.equals(self));
-
+ .put("id", node.id().toString())
+ .put("ip", node.ip().toString())
+ .put("tcpPort", node.tcpPort())
+ .put("self", node.equals(self));
if (nodeState != null) {
newNode.put("state", nodeState.toString());
}