list mastership roles CLI command

Change-Id: I54dc296f90c4b8ceebe4e86816c3796da4d2d714
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/impl/DistributedClusterStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/impl/DistributedClusterStore.java
index 5e64a39..8f48890 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/impl/DistributedClusterStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/impl/DistributedClusterStore.java
@@ -54,7 +54,7 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     private ClusterCommunicationAdminService clusterCommunicationAdminService;
 
-    private final ClusterNodesDelegate nodesDelegate = new InnerNodesDelegate();
+    private final ClusterNodesDelegate nodesDelegate = new InternalNodesDelegate();
 
     @Activate
     public void activate() throws IOException {
@@ -151,7 +151,7 @@
     }
 
     // Entity to handle back calls from the connection manager.
-    private class InnerNodesDelegate implements ClusterNodesDelegate {
+    private class InternalNodesDelegate implements ClusterNodesDelegate {
         @Override
         public DefaultControllerNode nodeDetected(NodeId nodeId, IpPrefix ip, int tcpPort) {
             DefaultControllerNode node = nodes.get(nodeId);
diff --git a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
index e073b63..1def9f9 100644
--- a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
+++ b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
@@ -2,6 +2,8 @@
 
 import static org.onlab.onos.mastership.MastershipEvent.Type.MASTER_CHANGED;
 
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -143,6 +145,30 @@
         return deserialize(masters.get(serialize(deviceId)));
     }
 
+
+    @Override
+    public List<NodeId> getNodes(DeviceId deviceId) {
+        byte [] did = serialize(deviceId);
+        List<NodeId> nodes = new LinkedList<>();
+
+        //add current master to head - if there is one
+        ILock lock = theInstance.getLock(LOCK);
+        lock.lock();
+        try {
+            byte [] master = masters.get(did);
+            if (master != null) {
+                nodes.add((NodeId) deserialize(master));
+            }
+
+            for (byte [] el : standbys.get(serialize(deviceId))) {
+                nodes.add((NodeId) deserialize(el));
+            }
+            return nodes;
+        } finally {
+            lock.unlock();
+        }
+    }
+
     @Override
     public Set<DeviceId> getDevices(NodeId nodeId) {
         ImmutableSet.Builder<DeviceId> builder = ImmutableSet.builder();
diff --git a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
index aba77d0..a6cfe8b 100644
--- a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
+++ b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleMastershipStore.java
@@ -5,6 +5,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -95,6 +96,11 @@
     }
 
     @Override
+    public List<NodeId> getNodes(DeviceId deviceId) {
+        return null;
+    }
+
+    @Override
     public Set<DeviceId> getDevices(NodeId nodeId) {
         Set<DeviceId> ids = new HashSet<>();
         for (Map.Entry<DeviceId, NodeId> d : masterMap.entrySet()) {