Use unsigned long comparison in IPv6Address.compareTo()
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index 9d6fa4d..3ab6767 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -11,7 +11,7 @@
 
 import com.google.common.base.Preconditions;
 import com.google.common.hash.PrimitiveSink;
-import com.google.common.primitives.Longs;
+import com.google.common.primitives.UnsignedLongs;
 
 import org.projectfloodlight.openflow.protocol.Writeable;
 import org.projectfloodlight.openflow.protocol.OFMessageReader;
@@ -547,11 +547,11 @@
 
     @Override
     public int compareTo(IPv6Address o) {
-        int res = Longs.compare(raw1, o.raw1);
+        int res = UnsignedLongs.compare(raw1, o.raw1);
         if(res != 0)
             return res;
         else
-            return Longs.compare(raw2, o.raw2);
+            return UnsignedLongs.compare(raw2, o.raw2);
     }
 
     @Override
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
index 0716b50..5d95a5a 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
@@ -13,6 +13,7 @@
 import java.net.InetAddress;
 
 import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matchers;
 import org.jboss.netty.buffer.ChannelBuffers;
 import org.junit.Test;
 import org.projectfloodlight.openflow.exceptions.OFParseError;
@@ -389,6 +390,21 @@
     }
 
     @Test
+    public void testCompareTo() {
+        assertThat(
+                IPv4Address.of("1.0.0.1").compareTo(IPv4Address.of("1.0.0.2")),
+                Matchers.lessThan(0));
+        assertThat(
+                IPv4Address.of("1.0.0.3").compareTo(IPv4Address.of("3.0.0.1")),
+                Matchers.lessThan(0));
+
+        // Make sure that unsigned comparison is used
+        assertThat(
+                IPv4Address.of("201.0.0.1").compareTo(IPv4Address.NONE),
+                Matchers.greaterThan(0));
+    }
+
+    @Test
     public void testOfExceptions() {
         // We check if the message of a caught NPE is set to a useful message
         // as a hacky way of verifying that we got an NPE thrown by use rather
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
index fd26856..52f2487 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
@@ -7,6 +7,7 @@
 import java.net.UnknownHostException;
 
 import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matchers;
 import org.jboss.netty.buffer.ChannelBuffers;
 import org.junit.Test;
 import org.projectfloodlight.openflow.exceptions.OFParseError;
@@ -331,6 +332,26 @@
     }
 
     @Test
+    public void testCompareTo() {
+        assertThat(
+                IPv6Address.of("fc00::1").compareTo(IPv6Address.of("fc00::2")),
+                Matchers.lessThan(0));
+        assertThat(
+                IPv6Address.of("::1").compareTo(IPv6Address.of("fc00::")),
+                Matchers.lessThan(0));
+
+        // Make sure that unsigned comparison is used on the first 64 bits
+        assertThat(
+                IPv6Address.of("fc00::1").compareTo(IPv6Address.of("1234::3")),
+                Matchers.greaterThan(0));
+
+        // Make sure that unsigned comparison is used on the next 64 bits
+        assertThat(
+                IPv6Address.of("::8000:0:0:1").compareTo(IPv6Address.of("::1")),
+                Matchers.greaterThan(0));
+    }
+
+    @Test
     public void testOfExceptions() throws Exception {
         try {
             IPv6AddressWithMask.of(null);