import org.opendaylight.controller.configuration.IConfigurationAware;
import org.opendaylight.controller.sal.authorization.Privilege;
import org.opendaylight.controller.sal.core.Bandwidth;
+import org.opendaylight.controller.sal.core.Description;
import org.opendaylight.controller.sal.core.Edge;
import org.opendaylight.controller.sal.core.Host;
import org.opendaylight.controller.sal.core.Name;
for (Map.Entry<Node, Set<Edge>> e : nodeEdges.entrySet()) {
Node n = e.getKey();
- String description = switchManager.getNodeDescription(n);
+ String description = getNodeDesc(n, switchManager);
+
NodeBean node = createNodeBean(description, n);
// skip production node
private String getNodeConnectorDescription(NodeConnector nodeConnector, ISwitchManager switchManager) {
Node node = nodeConnector.getNode();
- String description = switchManager.getNodeDescription(node);
- String name = this.getDescription(description, node);
+ String name = this.getDescription(getNodeDesc(node, switchManager), node);
return name;
}
continue;
}
- String description = switchManager.getNodeDescription(n);
+ String description = getNodeDesc(n, switchManager);
if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) {
continue;
ITopologyManager topology, String containerName) {
for (Map.Entry<Node, Set<NodeConnector>> e : hostEdges.entrySet()) {
for (NodeConnector connector : e.getValue()) {
- Host host = topology.getHostAttachedToNodeConnector(connector);
- EthernetAddress dmac = (EthernetAddress) host.getDataLayerAddress();
+ List<Host> 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<Map<String, Object>> adjacencies = new LinkedList<Map<String, Object>>();
- EdgeBean edge = new EdgeBean(connector, hid);
- adjacencies.add(edge.out());
- hostBean.setLinks(adjacencies);
+ NodeBean hostBean = new NodeBean(hostId, host.getNetworkAddressAsString(), NodeType.HOST);
+ List<Map<String, Object>> adjacencies = new LinkedList<Map<String, Object>>();
+ 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<String, Object> hostEntry = metaCache.get(containerName).get(hostId);
hostEntry.put("adjacencies", adjacencies);
stagedNodes.put(hostId, hostEntry);
- } else {
+ } else {
newNodes.put(String.valueOf(hid), hostBean.out());
+ }
}
}
}
// Perform the class deserialization locally, from inside the package where the class is defined
return ois.readObject();
}
+
+ private String getNodeDesc(Node node, ISwitchManager switchManager) {
+ Description desc = (Description) switchManager.getNodeProp(node, Description.propertyName);
+ return (desc == null) ? "" : desc.getValue();
+ }
+
}
\ No newline at end of file