Refactor the IpPrefix API and implementation:
* Now IpPrefix uses IpAddress to represent the subnet address
* The IpPrefix subnet address is masked-out by the prefix length.
E.g., IpPrefix("1.2.3.4/24") is now stored as IpPrefix("1.2.3.0/24")
* Removed IpPrefix methods that are not used or don't apply anymore
* Replaced usage of IpPrefix with IpAddress where appropriate
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 3b1d433..0bdff77 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
@@ -27,7 +27,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.IpPrefix;
+import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -115,7 +115,7 @@
* @param addr the ip address to modify to.
* @return a L3 modification
*/
- public static L3ModificationInstruction modL3Src(IpPrefix addr) {
+ public static L3ModificationInstruction modL3Src(IpAddress addr) {
checkNotNull(addr, "Src l3 address cannot be null");
return new ModIPInstruction(L3SubType.IP_SRC, addr);
}
@@ -125,7 +125,7 @@
* @param addr the ip address to modify to.
* @return a L3 modification
*/
- public static L3ModificationInstruction modL3Dst(IpPrefix addr) {
+ public static L3ModificationInstruction modL3Dst(IpAddress addr) {
checkNotNull(addr, "Dst l3 address cannot be null");
return new ModIPInstruction(L3SubType.IP_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 609d245..89a8cda 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
@@ -19,7 +19,7 @@
import java.util.Objects;
-import org.onlab.packet.IpPrefix;
+import org.onlab.packet.IpAddress;
/**
* Abstraction of a single traffic treatment step.
@@ -60,9 +60,9 @@
public static final class ModIPInstruction extends L3ModificationInstruction {
private final L3SubType subtype;
- private final IpPrefix ip;
+ private final IpAddress ip;
- public ModIPInstruction(L3SubType subType, IpPrefix addr) {
+ public ModIPInstruction(L3SubType subType, IpAddress addr) {
this.subtype = subType;
this.ip = addr;
@@ -73,7 +73,7 @@
return this.subtype;
}
- public IpPrefix ip() {
+ public IpAddress ip() {
return this.ip;
}