Renamed types IPv4, IPv6 to IPv4Address, IPv6Address
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index bd1967b..972f058 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -78,10 +78,10 @@
"OFOxmIpEcnMasked": OxmMapEntry("IpEcn", "IP_ECN", True),
"OFOxmIpProto": OxmMapEntry("IpProtocol", "IP_PROTO", False),
"OFOxmIpProtoMasked": OxmMapEntry("IpProtocol", "IP_PROTO", True),
- "OFOxmIpv4Src": OxmMapEntry("IPv4", "IPV4_SRC", False),
- "OFOxmIpv4SrcMasked": OxmMapEntry("IPv4", "IPV4_SRC", True),
- "OFOxmIpv4Dst": OxmMapEntry("IPv4", "IPV4_DST", False),
- "OFOxmIpv4DstMasked": OxmMapEntry("IPv4", "IPV4_DST", True),
+ "OFOxmIpv4Src": OxmMapEntry("IPv4Address", "IPV4_SRC", False),
+ "OFOxmIpv4SrcMasked": OxmMapEntry("IPv4Address", "IPV4_SRC", True),
+ "OFOxmIpv4Dst": OxmMapEntry("IPv4Address", "IPV4_DST", False),
+ "OFOxmIpv4DstMasked": OxmMapEntry("IPv4Address", "IPV4_DST", True),
"OFOxmTcpSrc": OxmMapEntry("TransportPort", "TCP_SRC", False),
"OFOxmTcpSrcMasked": OxmMapEntry("TransportPort", "TCP_SRC", True),
"OFOxmTcpDst": OxmMapEntry("TransportPort", "TCP_DST", False),
@@ -100,26 +100,26 @@
"OFOxmIcmpv4CodeMasked": OxmMapEntry("ICMPv4Code", "ICMPV4_CODE", True),
"OFOxmArpOp": OxmMapEntry("ArpOpcode", "ARP_OP", False),
"OFOxmArpOpMasked": OxmMapEntry("ArpOpcode", "ARP_OP", True),
- "OFOxmArpSpa": OxmMapEntry("IPv4", "ARP_SPA", False),
- "OFOxmArpSpaMasked": OxmMapEntry("IPv4", "ARP_SPA", True),
- "OFOxmArpTpa": OxmMapEntry("IPv4", "ARP_TPA", False),
- "OFOxmArpTpaMasked": OxmMapEntry("IPv4", "ARP_TPA", True),
+ "OFOxmArpSpa": OxmMapEntry("IPv4Address", "ARP_SPA", False),
+ "OFOxmArpSpaMasked": OxmMapEntry("IPv4Address", "ARP_SPA", True),
+ "OFOxmArpTpa": OxmMapEntry("IPv4Address", "ARP_TPA", False),
+ "OFOxmArpTpaMasked": OxmMapEntry("IPv4Address", "ARP_TPA", True),
"OFOxmArpSha": OxmMapEntry("MacAddress", "ARP_SHA", False),
"OFOxmArpShaMasked": OxmMapEntry("MacAddress", "ARP_SHA", True),
"OFOxmArpTha": OxmMapEntry("MacAddress", "ARP_THA", False),
"OFOxmArpThaMasked": OxmMapEntry("MacAddress", "ARP_THA", True),
- "OFOxmIpv6Src": OxmMapEntry("IPv6", "IPV6_SRC", False),
- "OFOxmIpv6SrcMasked": OxmMapEntry("IPv6", "IPV6_SRC", True),
- "OFOxmIpv6Dst": OxmMapEntry("IPv6", "IPV6_DST", False),
- "OFOxmIpv6DstMasked": OxmMapEntry("IPv6", "IPV6_DST", True),
+ "OFOxmIpv6Src": OxmMapEntry("IPv6Address", "IPV6_SRC", False),
+ "OFOxmIpv6SrcMasked": OxmMapEntry("IPv6Address", "IPV6_SRC", True),
+ "OFOxmIpv6Dst": OxmMapEntry("IPv6Address", "IPV6_DST", False),
+ "OFOxmIpv6DstMasked": OxmMapEntry("IPv6Address", "IPV6_DST", True),
"OFOxmIpv6Flabel": OxmMapEntry("IPv6FlowLabel", "IPV6_FLABEL", False),
"OFOxmIpv6FlabelMasked": OxmMapEntry("IPv6FlowLabel", "IPV6_FLABEL", True),
"OFOxmIcmpv6Type": OxmMapEntry("U8", "ICMPV6_TYPE", False),
"OFOxmIcmpv6TypeMasked": OxmMapEntry("U8", "ICMPV6_TYPE", True),
"OFOxmIcmpv6Code": OxmMapEntry("U8", "ICMPV6_CODE", False),
"OFOxmIcmpv6CodeMasked": OxmMapEntry("U8", "ICMPV6_CODE", True),
- "OFOxmIpv6NdTarget": OxmMapEntry("IPv6", "IPV6_ND_TARGET", False),
- "OFOxmIpv6NdTargetMasked": OxmMapEntry("IPv6", "IPV6_ND_TARGET", True),
+ "OFOxmIpv6NdTarget": OxmMapEntry("IPv6Address", "IPV6_ND_TARGET", False),
+ "OFOxmIpv6NdTargetMasked": OxmMapEntry("IPv6Address", "IPV6_ND_TARGET", True),
"OFOxmIpv6NdSll": OxmMapEntry("MacAddress", "IPV6_ND_SLL", False),
"OFOxmIpv6NdSllMasked": OxmMapEntry("MacAddress", "IPV6_ND_SLL", True),
"OFOxmIpv6NdTll": OxmMapEntry("MacAddress", "IPV6_ND_TLL", False),
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index e7f2201..73f735d 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -261,11 +261,11 @@
table_name = JType('String') \
.op(read='ChannelUtils.readFixedLengthString(bb, 32)', \
write='ChannelUtils.writeFixedLengthString(bb, $name, 32)')
-ipv4 = JType("IPv4") \
- .op(read="IPv4.read4Bytes(bb)", \
+ipv4 = JType("IPv4Address") \
+ .op(read="IPv4Address.read4Bytes(bb)", \
write="$name.write4Bytes(bb)")
-ipv6 = JType("IPv6") \
- .op(read="IPv6.read16Bytes(bb)", \
+ipv6 = JType("IPv6Address") \
+ .op(read="IPv6Address.read16Bytes(bb)", \
write="$name.write16Bytes(bb)")
packetin_reason = JType("OFPacketInReason")\
.op(read="OFPacketInReasonSerializerVer$version.readFrom(bb)", write="OFPacketInReasonSerializerVer$version.writeTo(bb, $name)")
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index 3e217e6..611898f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -4,8 +4,8 @@
import org.projectfloodlight.openflow.types.EthType;
import org.projectfloodlight.openflow.types.ICMPv4Code;
import org.projectfloodlight.openflow.types.ICMPv4Type;
-import org.projectfloodlight.openflow.types.IPv4;
-import org.projectfloodlight.openflow.types.IPv6;
+import org.projectfloodlight.openflow.types.IPv4Address;
+import org.projectfloodlight.openflow.types.IPv6Address;
import org.projectfloodlight.openflow.types.IPv6FlowLabel;
import org.projectfloodlight.openflow.types.IpDscp;
import org.projectfloodlight.openflow.types.IpEcn;
@@ -70,12 +70,12 @@
new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4, EthType.ETH_TYPE_IPv6));
- public final static MatchField<IPv4> IPV4_SRC =
- new MatchField<IPv4>("ipv4_src", MatchFields.IPV4_SRC,
+ public final static MatchField<IPv4Address> IPV4_SRC =
+ new MatchField<IPv4Address>("ipv4_src", MatchFields.IPV4_SRC,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4));
- public final static MatchField<IPv4> IPV4_DST =
- new MatchField<IPv4>("ipv4_dst", MatchFields.IPV4_DST,
+ public final static MatchField<IPv4Address> IPV4_DST =
+ new MatchField<IPv4Address>("ipv4_dst", MatchFields.IPV4_DST,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv4));
public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
@@ -114,12 +114,12 @@
"arp_op", MatchFields.ARP_OP,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
- public final static MatchField<IPv4> ARP_SPA =
- new MatchField<IPv4>("arp_spa", MatchFields.ARP_SPA,
+ public final static MatchField<IPv4Address> ARP_SPA =
+ new MatchField<IPv4Address>("arp_spa", MatchFields.ARP_SPA,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
- public final static MatchField<IPv4> ARP_TPA =
- new MatchField<IPv4>("arp_tpa", MatchFields.ARP_TPA,
+ public final static MatchField<IPv4Address> ARP_TPA =
+ new MatchField<IPv4Address>("arp_tpa", MatchFields.ARP_TPA,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
public final static MatchField<MacAddress> ARP_SHA =
@@ -130,12 +130,12 @@
new MatchField<MacAddress>("arp_tha", MatchFields.ARP_THA,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_ARP));
- public final static MatchField<IPv6> IPV6_SRC =
- new MatchField<IPv6>("ipv6_src", MatchFields.IPV6_SRC,
+ public final static MatchField<IPv6Address> IPV6_SRC =
+ new MatchField<IPv6Address>("ipv6_src", MatchFields.IPV6_SRC,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv6));
- public final static MatchField<IPv6> IPV6_DST =
- new MatchField<IPv6>("ipv6_dst", MatchFields.IPV6_DST,
+ public final static MatchField<IPv6Address> IPV6_DST =
+ new MatchField<IPv6Address>("ipv6_dst", MatchFields.IPV6_DST,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ETH_TYPE_IPv6));
public final static MatchField<IPv6FlowLabel> IPV6_FLABEL =
@@ -150,8 +150,8 @@
new MatchField<U8>("icmpv6_code", MatchFields.ICMPV6_CODE,
new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IP_PROTO_IPv6_ICMP));
- public final static MatchField<IPv6> IPV6_ND_TARGET =
- new MatchField<IPv6>("ipv6_nd_target", MatchFields.IPV6_ND_TARGET,
+ public final static MatchField<IPv6Address> IPV6_ND_TARGET =
+ new MatchField<IPv6Address>("ipv6_nd_target", MatchFields.IPV6_ND_TARGET,
new Prerequisite<U8>(MatchField.ICMPV6_TYPE, U8.of((short)135), U8.of((short)136)));
public final static MatchField<MacAddress> IPV6_ND_SLL =
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
similarity index 75%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
index 401d79b..ad454eb 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -5,38 +5,38 @@
/**
- * Wrapper around an IPv4 address
+ * Wrapper around an IPv4Address address
*
* @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
*/
-public class IPv4 implements OFValueType<IPv4> {
+public class IPv4Address implements OFValueType<IPv4Address> {
static final int LENGTH = 4;
private final int rawValue;
-
- public static final IPv4 NO_MASK = IPv4.of(0xFFFFFFFF);
- public static final IPv4 FULL_MASK = IPv4.of(0x00000000);
- private IPv4(final int rawValue) {
+ public static final IPv4Address NO_MASK = IPv4Address.of(0xFFFFFFFF);
+ public static final IPv4Address FULL_MASK = IPv4Address.of(0x00000000);
+
+ private IPv4Address(final int rawValue) {
this.rawValue = rawValue;
}
- public static IPv4 of(final byte[] address) {
+ public static IPv4Address of(final byte[] address) {
if (address.length != LENGTH) {
throw new IllegalArgumentException(
- "Invalid byte array length for IPv4 address: " + address);
+ "Invalid byte array length for IPv4Address address: " + address);
}
int raw =
(address[0] & 0xFF) << 24 | (address[1] & 0xFF) << 16
| (address[2] & 0xFF) << 8 | (address[3] & 0xFF) << 0;
- return IPv4.of(raw);
+ return IPv4Address.of(raw);
}
- public static IPv4 of(final int raw) {
- return new IPv4(raw);
+ public static IPv4Address of(final int raw) {
+ return new IPv4Address(raw);
}
- public static IPv4 of(final String string) {
+ public static IPv4Address of(final String string) {
int start = 0;
int shift = 24;
@@ -57,7 +57,7 @@
shift -= 8;
start = end + 1;
}
- return IPv4.of(raw);
+ return IPv4Address.of(raw);
}
public int getInt() {
@@ -112,24 +112,24 @@
return false;
if (getClass() != obj.getClass())
return false;
- IPv4 other = (IPv4) obj;
+ IPv4Address other = (IPv4Address) obj;
if (rawValue != other.rawValue)
return false;
return true;
}
-
+
public void write4Bytes(ChannelBuffer c) {
c.writeInt(rawValue);
}
-
- public static IPv4 read4Bytes(ChannelBuffer c) {
- return IPv4.of(c.readInt());
+
+ public static IPv4Address read4Bytes(ChannelBuffer c) {
+ return IPv4Address.of(c.readInt());
}
@Override
- public IPv4 applyMask(IPv4 mask) {
- return IPv4.of(this.rawValue & mask.rawValue);
+ public IPv4Address applyMask(IPv4Address mask) {
+ return IPv4Address.of(this.rawValue & mask.rawValue);
}
-
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
index d2f2cc7..dadbac2 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
@@ -1,12 +1,12 @@
package org.projectfloodlight.openflow.types;
-public class IPv4WithMask extends Masked<IPv4> {
+public class IPv4WithMask extends Masked<IPv4Address> {
private IPv4WithMask(int rawValue, int rawMask) {
- super(IPv4.of(rawValue), IPv4.of(rawMask));
+ super(IPv4Address.of(rawValue), IPv4Address.of(rawMask));
}
- private IPv4WithMask(IPv4 value, IPv4 mask) {
+ private IPv4WithMask(IPv4Address value, IPv4Address mask) {
super(value, mask);
}
@@ -14,23 +14,23 @@
return new IPv4WithMask(rawValue, rawMask);
}
- public static IPv4WithMask of(IPv4 value, IPv4 mask) {
+ public static IPv4WithMask of(IPv4Address value, IPv4Address mask) {
return new IPv4WithMask(value, mask);
}
@Override
public String toString() {
StringBuilder res = new StringBuilder();
- res.append(((IPv4)value).toString());
+ res.append(((IPv4Address)value).toString());
- int maskint = ((IPv4)mask).getInt();
+ int maskint = ((IPv4Address)mask).getInt();
res.append('/');
if (Integer.bitCount((~maskint) + 1) == 1) {
// CIDR notation
res.append(Integer.bitCount(maskint));
} else {
// Full address mask
- res.append(((IPv4)mask).toString());
+ res.append(((IPv4Address)mask).toString());
}
return res.toString();
@@ -40,7 +40,7 @@
int slashPos;
String ip = string;
int maskBits = 0;
- IPv4 maskAddress = null;
+ IPv4Address maskAddress = null;
// Read mask suffix
if ((slashPos = string.indexOf('/')) != -1) {
@@ -51,7 +51,7 @@
throw new IllegalArgumentException("IP Address not well formed: " + string);
if (suffix.indexOf('.') != -1) {
// Full mask
- maskAddress = IPv4.of(suffix);
+ maskAddress = IPv4Address.of(suffix);
} else {
// CIDR Suffix
maskBits = Integer.parseInt(suffix);
@@ -65,18 +65,18 @@
}
// Read IP
- IPv4 ipv4 = IPv4.of(ip);
+ IPv4Address ipv4 = IPv4Address.of(ip);
if (maskAddress != null) {
// Full address mask
return IPv4WithMask.of(ipv4, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv4WithMask.of(ipv4, IPv4.NO_MASK);
+ return IPv4WithMask.of(ipv4, IPv4Address.NO_MASK);
} else {
// With mask
int mask = (-1) << (32 - maskBits);
- return IPv4WithMask.of(ipv4, IPv4.of(mask));
+ return IPv4WithMask.of(ipv4, IPv4Address.of(mask));
}
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
similarity index 90%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index 0907d17..001f185 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -11,20 +11,20 @@
*
* @author Andreas Wundsam <andreas.wundsam@teleteach.de>
*/
-public class IPv6 implements OFValueType<IPv6> {
+public class IPv6Address implements OFValueType<IPv6Address> {
static final int LENGTH = 16;
private final long raw1;
private final long raw2;
- public static final IPv6 NO_MASK = IPv6.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
- public static final IPv6 FULL_MASK = IPv6.of(0x0, 0x0);
+ public static final IPv6Address NO_MASK = IPv6Address.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
+ public static final IPv6Address FULL_MASK = IPv6Address.of(0x0, 0x0);
- private IPv6(final long raw1, final long raw2) {
+ private IPv6Address(final long raw1, final long raw2) {
this.raw1 = raw1;
this.raw2 = raw2;
}
- public static IPv6 of(final byte[] address) {
+ public static IPv6Address of(final byte[] address) {
if (address.length != LENGTH) {
throw new IllegalArgumentException(
"Invalid byte array length for IPv6 address: " + address);
@@ -42,7 +42,7 @@
| (address[12] & 0xFFL) << 24 | (address[13] & 0xFFL) << 16
| (address[14] & 0xFFL) << 8 | (address[15]);
- return IPv6.of(raw1, raw2);
+ return IPv6Address.of(raw1, raw2);
}
private static class IPv6Builder {
@@ -62,14 +62,14 @@
throw new IllegalArgumentException("16 bit word index must be in [0,7]");
}
- public IPv6 getIPv6() {
- return IPv6.of(raw1, raw2);
+ public IPv6Address getIPv6() {
+ return IPv6Address.of(raw1, raw2);
}
}
private final static Pattern colonPattern = Pattern.compile(":");
- public static IPv6 of(final String string) {
+ public static IPv6Address of(final String string) {
IPv6Builder builder = new IPv6Builder();
String[] parts = colonPattern.split(string, -1);
@@ -122,8 +122,8 @@
return builder.getIPv6();
}
- public static IPv6 of(final long raw1, final long raw2) {
- return new IPv6(raw1, raw2);
+ public static IPv6Address of(final long raw1, final long raw2) {
+ return new IPv6Address(raw1, raw2);
}
volatile byte[] bytesCache = null;
@@ -265,7 +265,7 @@
return false;
if (getClass() != obj.getClass())
return false;
- IPv6 other = (IPv6) obj;
+ IPv6Address other = (IPv6Address) obj;
if (raw1 != other.raw1)
return false;
if (raw2 != other.raw2)
@@ -278,12 +278,12 @@
c.writeLong(this.raw2);
}
- public static IPv6 read16Bytes(ChannelBuffer c) throws OFParseError {
- return IPv6.of(c.readLong(), c.readLong());
+ public static IPv6Address read16Bytes(ChannelBuffer c) throws OFParseError {
+ return IPv6Address.of(c.readLong(), c.readLong());
}
@Override
- public IPv6 applyMask(IPv6 mask) {
- return IPv6.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
+ public IPv6Address applyMask(IPv6Address mask) {
+ return IPv6Address.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
}
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
index 894a6dd..1ab4042 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
@@ -3,29 +3,29 @@
import java.math.BigInteger;
import java.util.Arrays;
-public class IPv6WithMask extends Masked<IPv6> {
+public class IPv6WithMask extends Masked<IPv6Address> {
- private IPv6WithMask(IPv6 value, IPv6 mask) {
+ private IPv6WithMask(IPv6Address value, IPv6Address mask) {
super(value, mask);
}
- public static IPv6WithMask of(IPv6 value, IPv6 mask) {
+ public static IPv6WithMask of(IPv6Address value, IPv6Address mask) {
return new IPv6WithMask(value, mask);
}
@Override
public String toString() {
StringBuilder res = new StringBuilder();
- res.append(((IPv6)value).toString());
+ res.append(((IPv6Address)value).toString());
res.append('/');
- BigInteger maskint = new BigInteger(((IPv6)mask).getBytes());
+ BigInteger maskint = new BigInteger(((IPv6Address)mask).getBytes());
if (maskint.not().add(BigInteger.ONE).bitCount() == 1) {
// CIDR notation
res.append(maskint.bitCount());
} else {
// Full address mask
- res.append(((IPv6)mask).toString());
+ res.append(((IPv6Address)mask).toString());
}
return res.toString();
@@ -35,7 +35,7 @@
int slashPos;
String ip = string;
int maskBits = 0;
- IPv6 maskAddress = null;
+ IPv6Address maskAddress = null;
// Read mask suffix
if ((slashPos = string.indexOf('/')) != -1) {
@@ -46,7 +46,7 @@
throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
if (suffix.indexOf(':') != -1) {
// Full mask
- maskAddress = IPv6.of(suffix);
+ maskAddress = IPv6Address.of(suffix);
} else {
// CIDR Suffix
maskBits = Integer.parseInt(suffix);
@@ -60,14 +60,14 @@
}
// Read IP
- IPv6 ipv6 = IPv6.of(ip);
+ IPv6Address ipv6 = IPv6Address.of(ip);
if (maskAddress != null) {
// Full address mask
return IPv6WithMask.of(ipv6, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv6WithMask.of(ipv6, IPv6.NO_MASK);
+ return IPv6WithMask.of(ipv6, IPv6Address.NO_MASK);
} else {
// With mask
BigInteger mask = BigInteger.ONE.negate().shiftLeft(128 - maskBits);
@@ -83,7 +83,7 @@
} else {
maskBytes = maskBytesTemp;
}
- return IPv6WithMask.of(ipv6, IPv6.of(maskBytes));
+ return IPv6WithMask.of(ipv6, IPv6Address.of(maskBytes));
}
}
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4Test.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
similarity index 92%
rename from java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4Test.java
rename to java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
index 464323f..871b3ef 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4Test.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
@@ -8,7 +8,7 @@
import org.junit.Test;
import org.projectfloodlight.openflow.exceptions.OFParseError;
-public class IPv4Test {
+public class IPv4AddressTest {
byte[][] testAddresses = new byte[][] {
{0x01, 0x02, 0x03, 0x04 },
{127, 0, 0, 1},
@@ -67,7 +67,7 @@
@Test
public void testOfString() {
for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.of(testStrings[i]);
+ IPv4Address ip = IPv4Address.of(testStrings[i]);
assertEquals(testInts[i], ip.getInt());
assertArrayEquals(testAddresses[i], ip.getBytes());
assertEquals(testStrings[i], ip.toString());
@@ -77,7 +77,7 @@
@Test
public void testOfByteArray() {
for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.of(testAddresses[i]);
+ IPv4Address ip = IPv4Address.of(testAddresses[i]);
assertEquals(testInts[i], ip.getInt());
assertArrayEquals(testAddresses[i], ip.getBytes());
assertEquals(testStrings[i], ip.toString());
@@ -87,7 +87,7 @@
@Test
public void testReadFrom() throws OFParseError {
for(int i=0; i < testAddresses.length; i++ ) {
- IPv4 ip = IPv4.read4Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
+ IPv4Address ip = IPv4Address.read4Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
assertEquals(testInts[i], ip.getInt());
assertArrayEquals(testAddresses[i], ip.getBytes());
assertEquals(testStrings[i], ip.toString());
@@ -99,7 +99,7 @@
public void testInvalidIPs() throws OFParseError {
for(String invalid : invalidIPs) {
try {
- IPv4.of(invalid);
+ IPv4Address.of(invalid);
fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
} catch(IllegalArgumentException e) {
// ok
@@ -112,7 +112,7 @@
for (int i = 0; i < ipsWithMask.length; i++) {
IPv4WithMask value = IPv4WithMask.of(ipsWithMask[i]);
if (!hasMask[i]) {
- IPv4 ip = value.getValue();
+ IPv4Address ip = value.getValue();
assertArrayEquals(ipsWithMaskValues[i][0], ip.getBytes());
} else if (hasMask[i]) {
byte[] ipBytes = new byte[4];
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6Test.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
similarity index 87%
rename from java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6Test.java
rename to java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
index 092dacb..fba4d9e 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6Test.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
@@ -12,7 +12,7 @@
import org.junit.Test;
import org.projectfloodlight.openflow.exceptions.OFParseError;
-public class IPv6Test {
+public class IPv6AddressTest {
String[] testStrings = {
"::",
@@ -59,7 +59,7 @@
for(int i=0; i < ipsWithMask.length; i++ ) {
IPv6WithMask value = IPv6WithMask.of(ipsWithMask[i]);
if (!hasMask[i]) {
- IPv6 ip = value.getValue();
+ IPv6Address ip = value.getValue();
InetAddress inetAddress = InetAddress.getByName(ipsWithMask[i]);
assertArrayEquals(ip.getBytes(), inetAddress.getAddress());
@@ -84,7 +84,7 @@
@Test
public void testOfString() throws UnknownHostException {
for(int i=0; i < testStrings.length; i++ ) {
- IPv6 ip = IPv6.of(testStrings[i]);
+ IPv6Address ip = IPv6Address.of(testStrings[i]);
InetAddress inetAddress = InetAddress.getByName(testStrings[i]);
assertArrayEquals(ip.getBytes(), inetAddress.getAddress());
@@ -96,7 +96,7 @@
public void testOfByteArray() throws UnknownHostException {
for(int i=0; i < testStrings.length; i++ ) {
byte[] bytes = Inet6Address.getByName(testStrings[i]).getAddress();
- IPv6 ip = IPv6.of(bytes);
+ IPv6Address ip = IPv6Address.of(bytes);
assertEquals(testStrings[i], ip.toString());
assertArrayEquals(bytes, ip.getBytes());
}
@@ -106,7 +106,7 @@
public void testReadFrom() throws OFParseError, UnknownHostException {
for(int i=0; i < testStrings.length; i++ ) {
byte[] bytes = Inet6Address.getByName(testStrings[i]).getAddress();
- IPv6 ip = IPv6.read16Bytes(ChannelBuffers.copiedBuffer(bytes));
+ IPv6Address ip = IPv6Address.read16Bytes(ChannelBuffers.copiedBuffer(bytes));
assertEquals(testStrings[i], ip.toString());
assertArrayEquals(bytes, ip.getBytes());
}
@@ -128,7 +128,7 @@
public void testInvalidIPs() throws OFParseError {
for(String invalid : invalidIPs) {
try {
- IPv6.of(invalid);
+ IPv6Address.of(invalid);
fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
} catch(IllegalArgumentException e) {
// ok
@@ -138,10 +138,10 @@
@Test
public void testZeroCompression() throws OFParseError {
- assertEquals("::", IPv6.of("::").toString(true, false));
- assertEquals("0:0:0:0:0:0:0:0", IPv6.of("::").toString(false, false));
- assertEquals("0000:0000:0000:0000:0000:0000:0000:0000", IPv6.of("::").toString(false, true));
- assertEquals("1::4:5:6:0:8", IPv6.of("1:0:0:4:5:6:0:8").toString(true, false));
- assertEquals("1:0:0:4::8", IPv6.of("1:0:0:4:0:0:0:8").toString(true, false));
+ assertEquals("::", IPv6Address.of("::").toString(true, false));
+ assertEquals("0:0:0:0:0:0:0:0", IPv6Address.of("::").toString(false, false));
+ assertEquals("0000:0000:0000:0000:0000:0000:0000:0000", IPv6Address.of("::").toString(false, true));
+ assertEquals("1::4:5:6:0:8", IPv6Address.of("1:0:0:4:5:6:0:8").toString(true, false));
+ assertEquals("1:0:0:4::8", IPv6Address.of("1:0:0:4:0:0:0:8").toString(true, false));
}
}