Committed by
Gerrit Code Review
GUI - Adding display of attached hosts (in addition to showing egress links) in device details.
Change-Id: I94f1489a0226de81dec7744eb26e64e3769034c1
Showing
1 changed file
with
10 additions
and
1 deletions
... | @@ -24,11 +24,13 @@ import org.onosproject.net.AnnotationKeys; | ... | @@ -24,11 +24,13 @@ import org.onosproject.net.AnnotationKeys; |
24 | import org.onosproject.net.ConnectPoint; | 24 | import org.onosproject.net.ConnectPoint; |
25 | import org.onosproject.net.Device; | 25 | import org.onosproject.net.Device; |
26 | import org.onosproject.net.DeviceId; | 26 | import org.onosproject.net.DeviceId; |
27 | +import org.onosproject.net.Host; | ||
27 | import org.onosproject.net.Link; | 28 | import org.onosproject.net.Link; |
28 | import org.onosproject.net.Port; | 29 | import org.onosproject.net.Port; |
29 | import org.onosproject.net.config.NetworkConfigService; | 30 | import org.onosproject.net.config.NetworkConfigService; |
30 | import org.onosproject.net.config.basics.BasicDeviceConfig; | 31 | import org.onosproject.net.config.basics.BasicDeviceConfig; |
31 | import org.onosproject.net.device.DeviceService; | 32 | import org.onosproject.net.device.DeviceService; |
33 | +import org.onosproject.net.host.HostService; | ||
32 | import org.onosproject.net.link.LinkService; | 34 | import org.onosproject.net.link.LinkService; |
33 | import org.onosproject.ui.RequestHandler; | 35 | import org.onosproject.ui.RequestHandler; |
34 | import org.onosproject.ui.UiMessageHandler; | 36 | import org.onosproject.ui.UiMessageHandler; |
... | @@ -230,7 +232,8 @@ public class DeviceViewMessageHandler extends UiMessageHandler { | ... | @@ -230,7 +232,8 @@ public class DeviceViewMessageHandler extends UiMessageHandler { |
230 | port.put(ENABLED, p.isEnabled()); | 232 | port.put(ENABLED, p.isEnabled()); |
231 | port.put(NAME, name != null ? name : ""); | 233 | port.put(NAME, name != null ? name : ""); |
232 | 234 | ||
233 | - Set<Link> links = ls.getEgressLinks(new ConnectPoint(id, p.number())); | 235 | + ConnectPoint connectPoint = new ConnectPoint(id, p.number()); |
236 | + Set<Link> links = ls.getEgressLinks(connectPoint); | ||
234 | if (!links.isEmpty()) { | 237 | if (!links.isEmpty()) { |
235 | StringBuilder egressLinks = new StringBuilder(); | 238 | StringBuilder egressLinks = new StringBuilder(); |
236 | for (Link l : links) { | 239 | for (Link l : links) { |
... | @@ -239,6 +242,12 @@ public class DeviceViewMessageHandler extends UiMessageHandler { | ... | @@ -239,6 +242,12 @@ public class DeviceViewMessageHandler extends UiMessageHandler { |
239 | .append(dest.port()).append(" "); | 242 | .append(dest.port()).append(" "); |
240 | } | 243 | } |
241 | port.put(LINK_DEST, egressLinks.toString()); | 244 | port.put(LINK_DEST, egressLinks.toString()); |
245 | + } else { | ||
246 | + HostService hs = get(HostService.class); | ||
247 | + Set<Host> hosts = hs.getConnectedHosts(connectPoint); | ||
248 | + if (hosts != null && !hosts.isEmpty()) { | ||
249 | + port.put(LINK_DEST, hosts.iterator().next().id().toString()); | ||
250 | + } | ||
242 | } | 251 | } |
243 | 252 | ||
244 | return port; | 253 | return port; | ... | ... |
-
Please register or login to post a comment