Update StorageManager.getPartitionInfo() to delegate to PartitionAdminService.partitionInfo()
Change-Id: I20aa9f986874e6ac7c602b8ae58b7c7b0df9a835
diff --git a/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
index 8b3d166..74375dd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
@@ -26,6 +26,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Ordering;
/**
* Command to list the database partitions in the system.
@@ -48,7 +49,7 @@
for (PartitionInfo info : partitionInfo) {
boolean first = true;
- for (String member : info.members()) {
+ for (String member : Ordering.natural().sortedCopy(info.members())) {
if (first) {
print(FMT, info.name(), info.term(), member,
member.equals(info.leader()) ? "*" : "");
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
index 2a3b834..b83a977 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
@@ -37,6 +37,7 @@
import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
import org.onosproject.store.primitives.DistributedPrimitiveCreator;
import org.onosproject.store.primitives.MapUpdate;
+import org.onosproject.store.primitives.PartitionAdminService;
import org.onosproject.store.primitives.PartitionService;
import org.onosproject.store.primitives.TransactionId;
import org.onosproject.store.serializers.KryoNamespaces;
@@ -57,7 +58,6 @@
import org.onosproject.store.service.TransactionContextBuilder;
import org.slf4j.Logger;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Futures;
@@ -82,6 +82,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PartitionService partitionService;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected PartitionAdminService partitionAdminService;
+
private final Supplier<TransactionId> transactionIdGenerator =
() -> TransactionId.from(UUID.randomUUID().toString());
private DistributedPrimitiveCreator basePrimitiveCreator;
@@ -198,7 +201,7 @@
@Override
public List<PartitionInfo> getPartitionInfo() {
- return Lists.newArrayList();
+ return partitionAdminService.partitionInfo();
}
@Override
@@ -217,4 +220,4 @@
return new MapInfo(name, map.size());
}).collect(Collectors.toList());
}
-}
\ No newline at end of file
+}