java_gen: Fixed bug in Ipv[46]AddressWithMask when mask == /0
Both IP address parsers treated the case mask == /0 incorrectly.
Fixed the behavior and added to the unit tests.
Clean up the IPv6 unit test.
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
index 67bbce4..f30fcbb 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
@@ -46,7 +46,7 @@
public static IPv4AddressWithMask of(final String string) {
int slashPos;
String ip = string;
- int maskBits = 0;
+ int maskBits = 32;
IPv4Address maskAddress = null;
// Read mask suffix
@@ -77,9 +77,12 @@
if (maskAddress != null) {
// Full address mask
return IPv4AddressWithMask.of(ipv4, maskAddress);
- } else if (maskBits == 0) {
+ } else if (maskBits == 32) {
// No mask
return IPv4AddressWithMask.of(ipv4, IPv4Address.NO_MASK);
+ } else if (maskBits == 0) {
+ // No mask
+ return IPv4AddressWithMask.of(ipv4, IPv4Address.FULL_MASK);
} else {
// With mask
int mask = (-1) << (32 - maskBits);