From: Andrew Kim Date: Mon, 16 Sep 2013 23:13:40 +0000 (-0500) Subject: UI support for multiple host per port X-Git-Tag: releasepom-0.1.0~80^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=efc25496a3fc6771d0f52acdf30807c9b62e582f UI support for multiple host per port Change-Id: I57d6800b77045633afdbfa3e878f070ed82d8557 Signed-off-by: Andrew Kim --- diff --git a/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java b/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java index fed81eb2ae..a6c390d799 100644 --- a/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java +++ b/opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java @@ -340,29 +340,31 @@ public class Topology implements IObjectReader, IConfigurationAware { ITopologyManager topology, String containerName) { for (Map.Entry> e : hostEdges.entrySet()) { for (NodeConnector connector : e.getValue()) { - Host host = topology.getHostAttachedToNodeConnector(connector); - EthernetAddress dmac = (EthernetAddress) host.getDataLayerAddress(); + List hosts = topology.getHostsAttachedToNodeConnector(connector); + for (Host host : hosts) { + EthernetAddress dmac = (EthernetAddress) host.getDataLayerAddress(); - ByteBuffer addressByteBuffer = ByteBuffer.allocate(8); - addressByteBuffer.putShort((short) 0); - addressByteBuffer.put(dmac.getValue()); - addressByteBuffer.rewind(); + ByteBuffer addressByteBuffer = ByteBuffer.allocate(8); + addressByteBuffer.putShort((short) 0); + addressByteBuffer.put(dmac.getValue()); + addressByteBuffer.rewind(); - long hid = addressByteBuffer.getLong(); - String hostId = String.valueOf(hid); + long hid = addressByteBuffer.getLong(); + String hostId = String.valueOf(hid); - NodeBean hostBean = new NodeBean(hostId, host.getNetworkAddressAsString(), NodeType.HOST); - List> adjacencies = new LinkedList>(); - EdgeBean edge = new EdgeBean(connector, hid); - adjacencies.add(edge.out()); - hostBean.setLinks(adjacencies); + NodeBean hostBean = new NodeBean(hostId, host.getNetworkAddressAsString(), NodeType.HOST); + List> adjacencies = new LinkedList>(); + EdgeBean edge = new EdgeBean(connector, hid); + adjacencies.add(edge.out()); + hostBean.setLinks(adjacencies); - if (metaCache.get(containerName).containsKey(hostId)) { + if (metaCache.get(containerName).containsKey(hostId)) { Map hostEntry = metaCache.get(containerName).get(hostId); hostEntry.put("adjacencies", adjacencies); stagedNodes.put(hostId, hostEntry); - } else { + } else { newNodes.put(String.valueOf(hid), hostBean.out()); + } } } }