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;
+    }
+
 }
diff --git a/core/net/src/main/java/org/onlab/onos/net/host/impl/DefaultPortAddresses.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/DefaultPortAddresses.java
deleted file mode 100644
index fb656cf..0000000
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/DefaultPortAddresses.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.onlab.onos.net.host.impl;
-
-import org.onlab.onos.net.ConnectPoint;
-import org.onlab.onos.net.host.PortAddresses;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-public class DefaultPortAddresses implements PortAddresses {
-
-    private final ConnectPoint connectPoint;
-    private final IpAddress ipAddress;
-    private final MacAddress macAddress;
-
-    public DefaultPortAddresses(ConnectPoint connectPoint,
-            IpAddress ip, MacAddress mac) {
-        this.connectPoint = connectPoint;
-        this.ipAddress = ip;
-        this.macAddress = mac;
-    }
-
-    @Override
-    public ConnectPoint connectPoint() {
-        return connectPoint;
-    }
-
-    @Override
-    public IpAddress ip() {
-        return ipAddress;
-    }
-
-    @Override
-    public MacAddress mac() {
-        return macAddress;
-    }
-
-}
diff --git a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
index 3c1a499..9b8ecf7 100644
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
@@ -155,14 +155,18 @@
     }
 
     @Override
-    public void bindAddressesToPort(IpAddress ip, MacAddress mac,
-            ConnectPoint connectPoint) {
-        store.updateAddressBindings(new DefaultPortAddresses(connectPoint, ip, mac));
+    public void bindAddressesToPort(PortAddresses addresses) {
+        store.updateAddressBindings(addresses);
     }
 
     @Override
-    public void unbindAddressesFromPort(ConnectPoint connectPoint) {
-        store.removeAddressBindings(connectPoint);
+    public void unbindAddressesFromPort(PortAddresses portAddresses) {
+        store.removeAddressBindings(portAddresses);
+    }
+
+    @Override
+    public void clearAddresses(ConnectPoint connectPoint) {
+        store.clearAddressBindings(connectPoint);
     }
 
     @Override
diff --git a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
index f27cd78..71d1130 100644
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
@@ -128,9 +128,11 @@
                 ConnectPoint cp = new ConnectPoint(device.id(), port.number());
                 PortAddresses addresses = hostStore.getAddressBindingsForPort(cp);
 
-                if (addresses.ip().contains(targetIp)) {
-                    sendProbe(device.id(), port, addresses, targetIp);
-                }
+                /*for (IpPrefix prefix : addresses.ips()) {
+                    if (prefix.contains(targetIp)) {
+                        sendProbe(device.id(), port, addresses, targetIp);
+                    }
+                }*/
             }
         }
 
@@ -173,7 +175,7 @@
         }
 
         arp.setSenderHardwareAddress(sourceMacAddress)
-           .setSenderProtocolAddress(portAddresses.ip().toOctets())
+           //TODO .setSenderProtocolAddress(portAddresses.ips().toOctets())
            .setTargetHardwareAddress(ZERO_MAC_ADDRESS)
            .setTargetProtocolAddress(targetIp.toOctets());
 
diff --git a/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
index 6568d43..bcd84df 100644
--- a/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
+++ b/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
@@ -198,12 +198,19 @@
 
     @Override
     public void updateAddressBindings(PortAddresses addresses) {
-        portAddresses.put(addresses.connectPoint(), addresses);
+        // TODO portAddresses.put(addresses.connectPoint(), addresses);
     }
 
     @Override
-    public void removeAddressBindings(ConnectPoint connectPoint) {
-        portAddresses.remove(connectPoint);
+    public void removeAddressBindings(PortAddresses addresses) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void clearAddressBindings(ConnectPoint connectPoint) {
+        // TODO Auto-generated method stub
+
     }
 
     @Override