Changed PortAddress API to allow multiple IP addresses per port
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java b/core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java
index 29f6c04..645f729 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java
@@ -4,8 +4,6 @@
 
 import org.onlab.onos.net.ConnectPoint;
 import org.onlab.onos.net.HostId;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
 
 /**
  * Service for administering the inventory of end-station hosts.
@@ -20,26 +18,34 @@
     void removeHost(HostId hostId);
 
     /**
-     * Binds an IP address and optional MAC address to the given connection
-     * point.
+     * Binds IP and MAC addresses to the given connection point.
      * <p/>
-     * This method will overwrite any previously held address information for
-     * the connection point.
+     * The addresses are added to the set of addresses already bound to the
+     * connection point. If any of the fields in addresses is null, no change
+     * is made to the corresponding addresses in the store.
+     * {@link #unbindAddressesFromPort(PortAddresses)} must be use to unbind
+     * addresses that have previously been bound.
      *
-     * @param ip the IP address to bind to the connection point. This parameter
-     * is mandatory and cannot be null.
-     * @param mac the optional MAC address to bind to the connection point. Can
-     * be set to null if no MAC address needs to be bound.
-     * @param connectPoint the connection point to bind the addresses to
+     * @param addresses address object containing addresses to add and the port
+     * to add them to
      */
-    void bindAddressesToPort(IpAddress ip, MacAddress mac, ConnectPoint connectPoint);
+    void bindAddressesToPort(PortAddresses addresses);
+
+    /**
+     * Removes the addresses contained in the given PortAddresses object from
+     * the set of addresses bound to the port.
+     *
+     * @param portAddresses set of addresses to remove and port to remove them
+     * from
+     */
+    void unbindAddressesFromPort(PortAddresses portAddresses);
 
     /**
      * Removes all address information for the given connection point.
      *
      * @param connectPoint the connection point to remove address information
      */
-    void unbindAddressesFromPort(ConnectPoint connectPoint);
+    void clearAddresses(ConnectPoint connectPoint);
 
     /**
      * Returns the addresses information for all connection points.
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java b/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
index e3667e3..e70bbf2 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
@@ -99,19 +99,28 @@
     Set<Host> getConnectedHosts(DeviceId deviceId);
 
     /**
-     * Updates the address information for a given port.
+     * Updates the address information for a given port. The given address
+     * information is added to any previously held information for the port.
      *
      * @param addresses the port and address information
      */
     void updateAddressBindings(PortAddresses addresses);
 
     /**
+     * Removes the given addresses from the set of address information held for
+     * a port.
+     *
+     * @param addresses the port and address information
+     */
+    void removeAddressBindings(PortAddresses addresses);
+
+    /**
      * Removes any previously stored address information for a given connection
      * point.
      *
      * @param connectPoint the connection point
      */
-    void removeAddressBindings(ConnectPoint connectPoint);
+    void clearAddressBindings(ConnectPoint connectPoint);
 
     /**
      * Returns the address bindings stored for all connection points.
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;
+    }
+
 }