list mastership roles CLI command

Change-Id: I54dc296f90c4b8ceebe4e86816c3796da4d2d714
diff --git a/core/api/src/main/java/org/onlab/onos/mastership/MastershipService.java b/core/api/src/main/java/org/onlab/onos/mastership/MastershipService.java
index 029e357..224bc05 100644
--- a/core/api/src/main/java/org/onlab/onos/mastership/MastershipService.java
+++ b/core/api/src/main/java/org/onlab/onos/mastership/MastershipService.java
@@ -1,5 +1,6 @@
 package org.onlab.onos.mastership;
 
+import java.util.List;
 import java.util.Set;
 
 import org.onlab.onos.cluster.NodeId;
@@ -50,6 +51,15 @@
     NodeId getMasterFor(DeviceId deviceId);
 
     /**
+     * Returns controllers connected to a given device, in order of
+     * preference. The first entry in the list is the current master.
+     *
+     * @param deviceId the identifier of the device
+     * @return a list of controller IDs
+     */
+    List<NodeId> getNodesFor(DeviceId deviceId);
+
+    /**
      * Returns the devices for which a controller is master.
      *
      * @param nodeId the ID of the controller
diff --git a/core/api/src/main/java/org/onlab/onos/mastership/MastershipStore.java b/core/api/src/main/java/org/onlab/onos/mastership/MastershipStore.java
index 0117d0d..5e7b0e4 100644
--- a/core/api/src/main/java/org/onlab/onos/mastership/MastershipStore.java
+++ b/core/api/src/main/java/org/onlab/onos/mastership/MastershipStore.java
@@ -1,5 +1,6 @@
 package org.onlab.onos.mastership;
 
+import java.util.List;
 import java.util.Set;
 
 import org.onlab.onos.cluster.NodeId;
@@ -41,6 +42,15 @@
     NodeId getMaster(DeviceId deviceId);
 
     /**
+     * Returns the controllers connected to a device, in mastership-
+     * preference order.
+     *
+     * @param deviceId the device identifier
+     * @return an ordered list of controller IDs
+     */
+    List<NodeId> getNodes(DeviceId deviceId);
+
+    /**
      * Returns the devices that a controller instance is master of.
      *
      * @param nodeId the instance identifier
@@ -48,6 +58,7 @@
      */
     Set<DeviceId> getDevices(NodeId nodeId);
 
+
     /**
      * Sets a device's role for a specified controller instance.
      *
diff --git a/core/api/src/test/java/org/onlab/onos/mastership/MastershipServiceAdapter.java b/core/api/src/test/java/org/onlab/onos/mastership/MastershipServiceAdapter.java
index 97b57e5..af376e8 100644
--- a/core/api/src/test/java/org/onlab/onos/mastership/MastershipServiceAdapter.java
+++ b/core/api/src/test/java/org/onlab/onos/mastership/MastershipServiceAdapter.java
@@ -4,6 +4,7 @@
 import org.onlab.onos.net.DeviceId;
 import org.onlab.onos.net.MastershipRole;
 
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -46,4 +47,9 @@
     public MastershipTermService requestTermService() {
         return null;
     }
+
+    @Override
+    public List<NodeId> getNodesFor(DeviceId deviceId) {
+        return null;
+    }
 }