[onos-5822] Added changes
Addressed check-style issues
Addressed review comments

Change-Id: I1e8015a604e81b3f24a75c68b6a002fa0bb81eb2
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
index 3e3799b..b88364e 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/ClusterViewMessageHandler.java
@@ -23,6 +23,7 @@
 import org.onosproject.cluster.ClusterService;
 import org.onosproject.cluster.ControllerNode;
 import org.onosproject.cluster.NodeId;
+import org.onosproject.mastership.MastershipService;
 import org.onosproject.net.Device;
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.ui.RequestHandler;
@@ -36,7 +37,6 @@
 import java.util.stream.Collectors;
 
 import static com.google.common.collect.ImmutableList.copyOf;
-import static org.onosproject.net.MastershipRole.MASTER;
 
 
 /**
@@ -140,10 +140,11 @@
             super(CLUSTER_DETAILS_REQ);
         }
 
-        private List<Device> populateDevices() {
+        private List<Device> populateDevices(ControllerNode node) {
             DeviceService ds = get(DeviceService.class);
+            MastershipService ms = get(MastershipService.class);
             return copyOf(ds.getDevices()).stream()
-                    .filter(d -> ds.getRole(d.id()) == MASTER)
+                    .filter(d -> ms.getMasterFor(d.id()).equals(node.id()))
                     .collect(Collectors.toList());
         }
 
@@ -176,7 +177,7 @@
 
             ObjectNode data = objectNode();
             ArrayNode devices = arrayNode();
-            List<Device> deviceList = populateDevices();
+            List<Device> deviceList = populateDevices(node);
 
             data.put(ID, node.id().toString());
             data.put(IP, node.ip().toString());