renamed IpAddress to IpPrefix

Change-Id: I35990622e5b1c29ab6f6a0a0227088cd5d6c7294
diff --git a/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java b/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
index 66d753e..9255175 100644
--- a/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
+++ b/core/api/src/main/java/org/onlab/onos/cluster/ControllerInstance.java
@@ -1,6 +1,6 @@
 package org.onlab.onos.cluster;
 
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 
 /**
  * Represents a controller instance as a member in a cluster.
@@ -33,6 +33,6 @@
      *
      * @return IP address
      */
-    IpAddress ip();
+    IpPrefix ip();
 
 }
diff --git a/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java b/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java
index ed26e14..fad9147 100644
--- a/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java
+++ b/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java
@@ -8,7 +8,7 @@
 import java.util.Set;
 
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -20,15 +20,15 @@
     private final MacAddress mac;
     private final VlanId vlan;
     private final HostLocation location;
-    private final Set<IpAddress> ips;
+    private final Set<IpPrefix> ips;
 
     public DefaultHost(ProviderId providerId, HostId id, MacAddress mac,
-            VlanId vlan, HostLocation loc, Set<IpAddress> ips) {
+            VlanId vlan, HostLocation loc, Set<IpPrefix> ips) {
         super(providerId, id);
         this.mac = mac;
         this.vlan = vlan;
         this.location = loc;
-        this.ips = new HashSet<IpAddress>(ips);
+        this.ips = new HashSet<IpPrefix>(ips);
     }
 
     @Override
@@ -42,7 +42,7 @@
     }
 
     @Override
-    public Set<IpAddress> ipAddresses() {
+    public Set<IpPrefix> ipAddresses() {
         return Collections.unmodifiableSet(ips);
     }
 
diff --git a/core/api/src/main/java/org/onlab/onos/net/Host.java b/core/api/src/main/java/org/onlab/onos/net/Host.java
index 9d08591..087db36 100644
--- a/core/api/src/main/java/org/onlab/onos/net/Host.java
+++ b/core/api/src/main/java/org/onlab/onos/net/Host.java
@@ -1,6 +1,6 @@
 package org.onlab.onos.net;
 
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -38,7 +38,7 @@
      *
      * @return set of IP addresses; empty if no IP address is bound
      */
-    Set<IpAddress> ipAddresses();
+    Set<IpPrefix> ipAddresses();
 
     /**
      * Returns the most recent host location where the host attaches to the
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java b/core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java
index 2cfb4de..e27cc4d 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/criteria/Criteria.java
@@ -2,7 +2,7 @@
 
 import org.onlab.onos.net.PortNumber;
 import org.onlab.onos.net.flow.criteria.Criterion.Type;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -95,7 +95,7 @@
      * @param ip ip src value
      * @return match criterion
      */
-    public static Criterion matchIPSrc(IpAddress ip) {
+    public static Criterion matchIPSrc(IpPrefix ip) {
         return new IPCriterion(ip, Type.IPV4_SRC);
     }
 
@@ -105,7 +105,7 @@
      * @param ip ip src value
      * @return match criterion
      */
-    public static Criterion matchIPDst(IpAddress ip) {
+    public static Criterion matchIPDst(IpPrefix ip) {
         return new IPCriterion(ip, Type.IPV4_DST);
     }
 
@@ -173,10 +173,10 @@
 
     public static final class IPCriterion implements Criterion {
 
-        private final IpAddress ip;
+        private final IpPrefix ip;
         private final Type type;
 
-        public IPCriterion(IpAddress ip, Type type) {
+        public IPCriterion(IpPrefix ip, Type type) {
             this.ip = ip;
             this.type = type;
         }
@@ -186,7 +186,7 @@
             return this.type;
         }
 
-        public IpAddress ip() {
+        public IpPrefix ip() {
             return this.ip;
         }
 
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
index 439db77..ada96a5 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
@@ -7,7 +7,7 @@
 import org.onlab.onos.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
 import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.L3SubType;
 import org.onlab.onos.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -85,7 +85,7 @@
      * @param addr the ip address to modify to.
      * @return a L3 modification
      */
-    public static L3ModificationInstruction modL3Src(IpAddress addr) {
+    public static L3ModificationInstruction modL3Src(IpPrefix addr) {
         checkNotNull(addr, "Src l3 address cannot be null");
         return new ModIPInstruction(L3SubType.L3_SRC, addr);
     }
@@ -95,7 +95,7 @@
      * @param addr the ip address to modify to.
      * @return a L3 modification
      */
-    public static L3ModificationInstruction modL3Dst(IpAddress addr) {
+    public static L3ModificationInstruction modL3Dst(IpPrefix addr) {
         checkNotNull(addr, "Dst l3 address cannot be null");
         return new ModIPInstruction(L3SubType.L3_DST, addr);
     }
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L3ModificationInstruction.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L3ModificationInstruction.java
index 797df9b..aa47634 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L3ModificationInstruction.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L3ModificationInstruction.java
@@ -1,6 +1,6 @@
 package org.onlab.onos.net.flow.instructions;
 
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 
 /**
  * Abstraction of a single traffic treatment step.
@@ -41,9 +41,9 @@
     public static final class ModIPInstruction extends L3ModificationInstruction {
 
         private final L3SubType subtype;
-        private final IpAddress ip;
+        private final IpPrefix ip;
 
-        public ModIPInstruction(L3SubType subType, IpAddress addr) {
+        public ModIPInstruction(L3SubType subType, IpPrefix addr) {
 
             this.subtype = subType;
             this.ip = addr;
@@ -54,7 +54,7 @@
             return this.subtype;
         }
 
-        public IpAddress ip() {
+        public IpPrefix ip() {
             return this.ip;
         }
 
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 68795bd..0a419fd 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
@@ -6,7 +6,7 @@
 import java.util.Set;
 
 import org.onlab.onos.net.HostLocation;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -17,22 +17,22 @@
     private final MacAddress mac;
     private final VlanId vlan;
     private final HostLocation location;
-    private final Set<IpAddress> ips;
+    private final Set<IpPrefix> ips;
 
     public DefaultHostDescription(MacAddress mac, VlanId vlan,
             HostLocation loc) {
         this.mac = mac;
         this.vlan = vlan;
         this.location = loc;
-        this.ips = new HashSet<IpAddress>();
+        this.ips = new HashSet<IpPrefix>();
     }
 
     public DefaultHostDescription(MacAddress mac, VlanId vlan,
-            HostLocation loc, Set<IpAddress> ips) {
+            HostLocation loc, Set<IpPrefix> ips) {
         this.mac = mac;
         this.vlan = vlan;
         this.location = loc;
-        this.ips = new HashSet<IpAddress>(ips);
+        this.ips = new HashSet<IpPrefix>(ips);
     }
 
     @Override
@@ -51,7 +51,7 @@
     }
 
     @Override
-    public Set<IpAddress> ipAddresses() {
+    public Set<IpPrefix> ipAddresses() {
         return ImmutableSet.copyOf(ips);
     }
 
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 5917bef..27014b6 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
@@ -4,7 +4,7 @@
 
 import org.onlab.onos.net.Description;
 import org.onlab.onos.net.HostLocation;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -39,6 +39,6 @@
      *
      * @return a set of IP addresses.
      */
-    Set<IpAddress> ipAddresses();
+    Set<IpPrefix> ipAddresses();
 
 }
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostService.java b/core/api/src/main/java/org/onlab/onos/net/host/HostService.java
index a42e231..39f63c0 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostService.java
@@ -4,7 +4,7 @@
 import org.onlab.onos.net.DeviceId;
 import org.onlab.onos.net.Host;
 import org.onlab.onos.net.HostId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -59,7 +59,7 @@
      * @param ip ip address
      * @return set of hosts with the given IP
      */
-    Set<Host> getHostsByIp(IpAddress ip);
+    Set<Host> getHostsByIp(IpPrefix ip);
 
     // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan);
 
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 cb5ed64..94c4585 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
@@ -5,7 +5,7 @@
 import org.onlab.onos.net.Host;
 import org.onlab.onos.net.HostId;
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -81,7 +81,7 @@
      * @param ip ip address
      * @return set of hosts with the given IP
      */
-    Set<Host> getHosts(IpAddress ip);
+    Set<Host> getHosts(IpPrefix ip);
 
     /**
      * Returns the set of hosts whose location falls on the given connection point.
diff --git a/core/api/src/test/java/org/onlab/onos/net/TestDeviceParams.java b/core/api/src/test/java/org/onlab/onos/net/TestDeviceParams.java
index 7471a2d..d24e1c8 100644
--- a/core/api/src/test/java/org/onlab/onos/net/TestDeviceParams.java
+++ b/core/api/src/test/java/org/onlab/onos/net/TestDeviceParams.java
@@ -5,7 +5,7 @@
 import java.util.Set;
 
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -24,9 +24,9 @@
     protected static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02");
     protected static final VlanId VLAN1 = VlanId.vlanId((short) 11);
     protected static final VlanId VLAN2 = VlanId.vlanId((short) 22);
-    protected static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1");
-    protected static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2");
-    protected static final IpAddress IP3 = IpAddress.valueOf("10.0.0.3");
+    protected static final IpPrefix IP1 = IpPrefix.valueOf("10.0.0.1");
+    protected static final IpPrefix IP2 = IpPrefix.valueOf("10.0.0.2");
+    protected static final IpPrefix IP3 = IpPrefix.valueOf("10.0.0.3");
 
     protected static final PortNumber P1 = PortNumber.portNumber(100);
     protected static final PortNumber P2 = PortNumber.portNumber(200);
@@ -34,7 +34,7 @@
     protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2);
     protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L);
     protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L);
-    protected static final Set<IpAddress> IPSET1 = Sets.newHashSet(IP1, IP2);
-    protected static final Set<IpAddress> IPSET2 = Sets.newHashSet(IP1, IP3);
+    protected static final Set<IpPrefix> IPSET1 = Sets.newHashSet(IP1, IP2);
+    protected static final Set<IpPrefix> IPSET2 = Sets.newHashSet(IP1, IP3);
 
 }
diff --git a/core/api/src/test/java/org/onlab/onos/net/host/DefualtHostDecriptionTest.java b/core/api/src/test/java/org/onlab/onos/net/host/DefualtHostDecriptionTest.java
index 6ce39f5..1b00be7 100644
--- a/core/api/src/test/java/org/onlab/onos/net/host/DefualtHostDecriptionTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/host/DefualtHostDecriptionTest.java
@@ -9,7 +9,7 @@
 import org.onlab.onos.net.DeviceId;
 import org.onlab.onos.net.HostLocation;
 import org.onlab.onos.net.PortNumber;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -27,9 +27,9 @@
                 PortNumber.portNumber(100),
                 123L
             );
-    private static final Set<IpAddress> IPS = Sets.newHashSet(
-                IpAddress.valueOf("10.0.0.1"),
-                IpAddress.valueOf("10.0.0.2")
+    private static final Set<IpPrefix> IPS = Sets.newHashSet(
+                IpPrefix.valueOf("10.0.0.1"),
+                IpPrefix.valueOf("10.0.0.2")
             );
 
     @Test
diff --git a/core/api/src/test/java/org/onlab/onos/net/host/HostEventTest.java b/core/api/src/test/java/org/onlab/onos/net/host/HostEventTest.java
index 561b041..92a5718 100644
--- a/core/api/src/test/java/org/onlab/onos/net/host/HostEventTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/host/HostEventTest.java
@@ -11,7 +11,7 @@
 import org.onlab.onos.net.HostLocation;
 import org.onlab.onos.net.PortNumber;
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -27,9 +27,9 @@
                     PortNumber.portNumber(100),
                     123L
                 );
-        Set<IpAddress> ipset = Sets.newHashSet(
-                    IpAddress.valueOf("10.0.0.1"),
-                    IpAddress.valueOf("10.0.0.2")
+        Set<IpPrefix> ipset = Sets.newHashSet(
+                    IpPrefix.valueOf("10.0.0.1"),
+                    IpPrefix.valueOf("10.0.0.2")
                 );
         HostId hid = HostId.hostId(mac, vlan);
 
diff --git a/core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java b/core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
index a8ec8bd..682e349 100644
--- a/core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
+++ b/core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
@@ -4,7 +4,7 @@
 import org.onlab.onos.net.DeviceId;
 import org.onlab.onos.net.Host;
 import org.onlab.onos.net.HostId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -40,7 +40,7 @@
     }
 
     @Override
-    public Set<Host> getHostsByIp(IpAddress ip) {
+    public Set<Host> getHostsByIp(IpPrefix ip) {
         return null;
     }
 
diff --git a/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManager.java b/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManager.java
index 9cf235b..109d238 100644
--- a/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManager.java
+++ b/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManager.java
@@ -23,7 +23,7 @@
 import org.onlab.onos.net.host.HostStore;
 import org.onlab.onos.net.provider.AbstractProviderRegistry;
 import org.onlab.onos.net.provider.AbstractProviderService;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 import org.slf4j.Logger;
@@ -100,7 +100,7 @@
     }
 
     @Override
-    public Set<Host> getHostsByIp(IpAddress ip) {
+    public Set<Host> getHostsByIp(IpPrefix ip) {
         checkNotNull(ip, "IP address cannot be null");
         return store.getHosts(ip);
     }
diff --git a/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java b/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java
index 1febb67..d540afb 100644
--- a/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java
+++ b/core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java
@@ -25,7 +25,7 @@
 import org.onlab.onos.net.host.HostEvent;
 import org.onlab.onos.net.host.HostStore;
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -166,7 +166,7 @@
     }
 
     @Override
-    public Set<Host> getHosts(IpAddress ip) {
+    public Set<Host> getHosts(IpPrefix ip) {
         Set<Host> ipset = new HashSet<>();
         for (Host h : hosts.values()) {
             if (h.ipAddresses().contains(ip)) {
diff --git a/core/trivial/src/test/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManagerTest.java b/core/trivial/src/test/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManagerTest.java
index 1ee61df..0ce38dc 100644
--- a/core/trivial/src/test/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManagerTest.java
+++ b/core/trivial/src/test/java/org/onlab/onos/net/trivial/host/impl/SimpleHostManagerTest.java
@@ -28,7 +28,7 @@
 import org.onlab.onos.net.host.HostProviderService;
 import org.onlab.onos.net.provider.AbstractProvider;
 import org.onlab.onos.net.provider.ProviderId;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
@@ -51,10 +51,10 @@
     private static final HostId HID1 = HostId.hostId(MAC1, VLAN1);
     private static final HostId HID2 = HostId.hostId(MAC2, VLAN1);
 
-    private static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1");
-    private static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2");
-    private static final Set<IpAddress> IPSET1 = Sets.newHashSet(IP1);
-    private static final Set<IpAddress> IPSET2 = Sets.newHashSet(IP2);
+    private static final IpPrefix IP1 = IpPrefix.valueOf("10.0.0.1");
+    private static final IpPrefix IP2 = IpPrefix.valueOf("10.0.0.2");
+    private static final Set<IpPrefix> IPSET1 = Sets.newHashSet(IP1);
+    private static final Set<IpPrefix> IPSET2 = Sets.newHashSet(IP2);
 
     private static final DeviceId DID1 = DeviceId.deviceId("of:001");
     private static final DeviceId DID2 = DeviceId.deviceId("of:002");
@@ -98,7 +98,7 @@
     }
 
     private void detect(HostId hid, MacAddress mac, VlanId vlan,
-            HostLocation loc, Set<IpAddress> ips) {
+            HostLocation loc, Set<IpPrefix> ips) {
         HostDescription descr = new DefaultHostDescription(mac, vlan, loc, ips);
         providerService.hostDetected(hid, descr);
         assertNotNull("host should be found", mgr.getHost(hid));