Extend host structures to store multiple locations
Also update host location format in CLI and REST API
Change-Id: I0fbd655f642627dd3eb8a2925f83a3ee016fe4aa
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/HostCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/HostCodec.java
index b5f9b02..233d61d 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/HostCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/HostCodec.java
@@ -47,7 +47,12 @@
jsonIpAddresses.add(ipAddress.toString());
}
result.set("ipAddresses", jsonIpAddresses);
- result.set("location", locationCodec.encode(host.location(), context));
+
+ final ArrayNode jsonLocations = result.putArray("locations");
+ for (final HostLocation location : host.locations()) {
+ jsonLocations.add(locationCodec.encode(location, context));
+ }
+ result.set("locations", jsonLocations);
return annotate(result, host, context);
}