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/test/java/org/onosproject/codec/impl/VirtualHostCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/VirtualHostCodecTest.java
index 1774242..661a1f3 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/VirtualHostCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/VirtualHostCodecTest.java
@@ -81,9 +81,9 @@
is(TEST_MAC_ADDRESS));
assertThat(node.get(VirtualHostCodec.VLAN).asInt(),
is((int) TEST_VLAN_ID));
- assertThat(node.get(VirtualHostCodec.HOST_LOCATION).get("elementId").asText(),
+ assertThat(node.get(VirtualHostCodec.HOST_LOCATION).get(0).get("elementId").asText(),
is(location.deviceId().toString()));
- assertThat(node.get(VirtualHostCodec.HOST_LOCATION).get("port").asLong(),
+ assertThat(node.get(VirtualHostCodec.HOST_LOCATION).get(0).get("port").asLong(),
is(location.port().toLong()));
JsonNode jsonIps = node.get(VirtualHostCodec.IP_ADDRESSES);
diff --git a/core/common/src/test/resources/org/onosproject/codec/impl/VirtualHost.json b/core/common/src/test/resources/org/onosproject/codec/impl/VirtualHost.json
index ab5a81b..818ce0b 100644
--- a/core/common/src/test/resources/org/onosproject/codec/impl/VirtualHost.json
+++ b/core/common/src/test/resources/org/onosproject/codec/impl/VirtualHost.json
@@ -6,8 +6,10 @@
"1.1.1.1",
"2.2.2.2"
],
- "location": {
- "elementId": "of:d1",
- "port": "1"
- }
+ "locations": [
+ {
+ "elementId": "of:d1",
+ "port": "1"
+ }
+ ]
}