Add clusterId to summary command
Change-Id: Iff2bf108b88a5bb5b72da1e63b2214735bbaad44
diff --git a/cli/src/main/java/org/onosproject/cli/SummaryCommand.java b/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
index 0d2fe51..51a2fc3 100644
--- a/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
@@ -18,6 +18,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.karaf.shell.commands.Command;
import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterMetadataService;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.core.CoreService;
@@ -64,11 +65,13 @@
int numScc = get(TopologyService.class).currentTopology().clusterCount();
int numFlows = get(FlowRuleService.class).getFlowRuleCount();
long numIntents = get(IntentService.class).getIntentCount();
+ String clusterId = get(ClusterMetadataService.class).getClusterMetadata().getName();
if (outputJson()) {
print("%s", new ObjectMapper().createObjectNode()
.put("node", nodeIp.toString())
.put("version", version.toString())
+ .put("clusterId", clusterId)
.put("nodes", numNodes)
.put("devices", numDevices)
.put("links", numLinks)
@@ -77,7 +80,7 @@
.put("flows", numFlows)
.put("intents", numIntents));
} else {
- print("node=%s, version=%s", nodeIp, version);
+ print("node=%s, version=%s clusterId=%s", nodeIp, version, clusterId);
print("nodes=%d, devices=%d, links=%d, hosts=%d, SCC(s)=%s, flows=%d, intents=%d",
numNodes, numDevices, numLinks, numHosts, numScc, numFlows, numIntents);
}