GossipHostStore: add AE support
- modified HostDescription family to hold Set of IpAddresses
Change-Id: Id920fdc83817802885e8528af185a5ad590bf999
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java b/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java
index 2e92dad..71a952e 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java
@@ -1,5 +1,8 @@
package org.onlab.onos.net.host;
+import java.util.Collections;
+import java.util.Set;
+
import org.onlab.onos.net.AbstractDescription;
import org.onlab.onos.net.HostLocation;
import org.onlab.onos.net.SparseAnnotations;
@@ -7,6 +10,8 @@
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
+import com.google.common.collect.ImmutableSet;
+
import static com.google.common.base.MoreObjects.toStringHelper;
/**
@@ -18,7 +23,7 @@
private final MacAddress mac;
private final VlanId vlan;
private final HostLocation location;
- private final IpPrefix ip;
+ private final Set<IpPrefix> ip;
/**
* Creates a host description using the supplied information.
@@ -31,7 +36,7 @@
public DefaultHostDescription(MacAddress mac, VlanId vlan,
HostLocation location,
SparseAnnotations... annotations) {
- this(mac, vlan, location, null, annotations);
+ this(mac, vlan, location, Collections.<IpPrefix>emptySet(), annotations);
}
/**
@@ -46,11 +51,26 @@
public DefaultHostDescription(MacAddress mac, VlanId vlan,
HostLocation location, IpPrefix ip,
SparseAnnotations... annotations) {
+ this(mac, vlan, location, ImmutableSet.of(ip), annotations);
+ }
+
+ /**
+ * Creates a host description using the supplied information.
+ *
+ * @param mac host MAC address
+ * @param vlan host VLAN identifier
+ * @param location host location
+ * @param ip host IP addresses
+ * @param annotations optional key/value annotations map
+ */
+ public DefaultHostDescription(MacAddress mac, VlanId vlan,
+ HostLocation location, Set<IpPrefix> ip,
+ SparseAnnotations... annotations) {
super(annotations);
this.mac = mac;
this.vlan = vlan;
this.location = location;
- this.ip = ip;
+ this.ip = ImmutableSet.copyOf(ip);
}
@Override
@@ -69,7 +89,7 @@
}
@Override
- public IpPrefix ipAddress() {
+ public Set<IpPrefix> ipAddress() {
return ip;
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java b/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
index fc16854..258ce3d 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
@@ -1,5 +1,7 @@
package org.onlab.onos.net.host;
+import java.util.Set;
+
import org.onlab.onos.net.Description;
import org.onlab.onos.net.HostLocation;
import org.onlab.packet.IpPrefix;
@@ -38,6 +40,6 @@
* @return host IP address
*/
// FIXME: Switch to IpAddress
- IpPrefix ipAddress();
+ Set<IpPrefix> ipAddress();
}