Added support for IPv6 to IpAddressSerializer and IpPrefixSerializer.
diff --git a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java
index ae60793..858d455 100644
--- a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java
+++ b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpAddressSerializer.java
@@ -46,8 +46,13 @@
         final int octLen = input.readInt();
         byte[] octs = new byte[octLen];
         input.readBytes(octs);
-        // TODO: Add support for reading/writing the IP version
-        return IpAddress.valueOf(IpAddress.Version.INET, octs);
+        // Use the address size to decide whether it is IPv4 or IPv6 address
+        if (octLen == IpAddress.INET_BYTE_LENGTH) {
+            return IpAddress.valueOf(IpAddress.Version.INET, octs);
+        }
+        if (octLen == IpAddress.INET6_BYTE_LENGTH) {
+            return IpAddress.valueOf(IpAddress.Version.INET6, octs);
+        }
+        return null;    // Shouldn't be reached
     }
-
 }
diff --git a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java
index 5d895d7..16bd0f4 100644
--- a/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java
+++ b/core/store/serializers/src/main/java/org/onlab/onos/store/serializers/IpPrefixSerializer.java
@@ -52,7 +52,13 @@
         byte[] octs = new byte[octLen];
         input.readBytes(octs);
         int prefLen = input.readInt();
-        // TODO: Add support for reading/writing the IP version
-        return IpPrefix.valueOf(IpAddress.Version.INET, octs, prefLen);
+        // Use the address size to decide whether it is IPv4 or IPv6 address
+        if (octLen == IpAddress.INET_BYTE_LENGTH) {
+            return IpPrefix.valueOf(IpAddress.Version.INET, octs, prefLen);
+        }
+        if (octLen == IpAddress.INET6_BYTE_LENGTH) {
+            return IpPrefix.valueOf(IpAddress.Version.INET6, octs, prefLen);
+        }
+        return null;    // Shouldn't be reached
     }
 }