Topo2: ONOS Build Paris Demo tweaks
Change-Id: I93a01b077bdff4152f1ab3e7ebe8391232b846dc
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
index 36118ab..9e02334 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
@@ -21,6 +21,7 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.osgi.ServiceDirectory;
+import org.onlab.packet.IpAddress;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.NodeId;
import org.onosproject.incubator.net.PortStatisticsService;
@@ -29,6 +30,7 @@
import org.onosproject.net.Annotated;
import org.onosproject.net.Annotations;
import org.onosproject.net.Device;
+import org.onosproject.net.Host;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.FlowRuleService;
import org.onosproject.net.host.HostService;
@@ -327,6 +329,17 @@
}
}
+ private void addIps(ObjectNode node, Host h) {
+ Set<IpAddress> ips = h.ipAddresses();
+
+ ArrayNode a = arrayNode();
+ for (IpAddress ip : ips) {
+ a.add(ip.toString());
+ }
+
+ node.set("ips", a);
+ }
+
// return list of string values from annotated instance, for given keys
// return null if any keys are not present
List<String> getAnnotValues(Annotated a, String... annotKeys) {
@@ -351,11 +364,18 @@
}
private ObjectNode json(UiHost host) {
- return objectNode()
+ ObjectNode node = objectNode()
.put("id", host.idAsString())
.put("nodeType", HOST)
.put("layer", host.layer());
// TODO: complete host details
+ Host h = host.backingHost();
+
+ addIps(node, h);
+ addGeoLocation(node, h);
+ addMetaUi(node, host.idAsString());
+
+ return node;
}
private ObjectNode json(UiSynthLink sLink) {