[ONOS-6756] Replicate node version information for ISSU
Change-Id: Ibd31c573990f2732b7abf8615ca914ffb77615ec
diff --git a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
index 1ecb3f2..9c43f6f 100644
--- a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
@@ -24,6 +24,7 @@
import org.onlab.util.Tools;
import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.ControllerNode;
+import org.onosproject.core.Version;
import org.onosproject.utils.Comparators;
import java.util.Collections;
@@ -39,7 +40,7 @@
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, version=%s, updated=%s %s";
@Override
protected void execute() {
@@ -56,9 +57,12 @@
if (lastUpdated != null) {
timeAgo = Tools.timeAgo(lastUpdated.getMillis());
}
+ Version version = service.getVersion(node.id());
print(FMT, node.id(), node.ip(), node.tcpPort(),
- service.getState(node.id()), timeAgo,
- node.equals(self) ? "*" : "");
+ service.getState(node.id()),
+ version == null ? "unknown" : version,
+ timeAgo,
+ node.equals(self) ? "*" : "");
}
}
}
@@ -70,6 +74,7 @@
ControllerNode self = service.getLocalNode();
for (ControllerNode node : nodes) {
ControllerNode.State nodeState = service.getState(node.id());
+ Version nodeVersion = service.getVersion(node.id());
ObjectNode newNode = mapper.createObjectNode()
.put("id", node.id().toString())
.put("ip", node.ip().toString())
@@ -78,6 +83,9 @@
if (nodeState != null) {
newNode.put("state", nodeState.toString());
}
+ if (nodeVersion != null) {
+ newNode.put("version", nodeVersion.toString());
+ }
result.add(newNode);
}
return result;