Changed PortAddress API to allow multiple IP addresses per port
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java b/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
index 16cc2b1..31e2e76 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
@@ -1,32 +1,63 @@
package org.onlab.onos.net.host;
+import java.util.HashSet;
+import java.util.Set;
+
import org.onlab.onos.net.ConnectPoint;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
/**
* Represents address information bound to a port.
*/
-public interface PortAddresses {
+public class PortAddresses {
+
+ private final ConnectPoint connectPoint;
+ private final Set<IpPrefix> ipAddresses;
+ private final MacAddress macAddress;
+
+ /**
+ * Constructs a PortAddress object for the given connection point, with a
+ * set of IP addresses and a MAC address.
+ * <p/>
+ * Both address parameters are optional and can be set to null.
+ *
+ * @param connectPoint the connection point these addresses are for
+ * @param ips a set of IP addresses
+ * @param mac a MAC address
+ */
+ public PortAddresses(ConnectPoint connectPoint,
+ Set<IpPrefix> ips, MacAddress mac) {
+ this.connectPoint = connectPoint;
+ this.ipAddresses = (ips == null) ? null : new HashSet<>(ips);
+ this.macAddress = mac;
+ }
/**
* Returns the connection point this address information is bound to.
*
* @return the connection point
*/
- ConnectPoint connectPoint();
+ public ConnectPoint connectPoint() {
+ return connectPoint;
+ }
/**
- * Returns the IP address bound to the port.
+ * Returns the set of IP addresses.
*
- * @return the IP address
+ * @return the IP addresses
*/
- IpAddress ip();
+ public Set<IpPrefix> ips() {
+ return ipAddresses;
+ }
/**
- * Returns the MAC address bound to the port.
+ * Returns the MAC address.
*
- * @return the MAC address if one is bound, otherwise null
+ * @return the MAC address
*/
- MacAddress mac();
+ public MacAddress mac() {
+ return macAddress;
+ }
+
}