Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
diff --git a/core/api/src/main/java/org/onlab/onos/net/HostId.java b/core/api/src/main/java/org/onlab/onos/net/HostId.java
index 1c1f2d7..c406954 100644
--- a/core/api/src/main/java/org/onlab/onos/net/HostId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/HostId.java
@@ -1,6 +1,7 @@
 package org.onlab.onos.net;
 
 import org.onlab.packet.MACAddress;
+import org.onlab.packet.VLANID;
 
 import java.net.URI;
 
@@ -42,7 +43,7 @@
      * @return host identifier
      */
     // FIXME: replace vlanId long with a rich data-type, e.g. VLanId or something like that
-    public static HostId hostId(MACAddress mac, long vlanId) {
+    public static HostId hostId(MACAddress mac, VLANID vlanId) {
         // FIXME: use more efficient means of encoding
         return hostId("nic" + ":" + mac + "/" + vlanId);
     }
diff --git a/utils/misc/src/main/java/org/onlab/packet/IPAddress.java b/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
index f7b19dc..94c2d54 100644
--- a/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
+++ b/utils/misc/src/main/java/org/onlab/packet/IPAddress.java
@@ -12,7 +12,7 @@
 
     //lengths of address, in bytes
     public static final int INET_LEN = 4;
-    public static final int INET6_LEN = 6;
+    public static final int INET6_LEN = 16;
 
     protected Version version;
     //does it make more sense to have a integral address?
diff --git a/utils/misc/src/main/java/org/onlab/packet/VLANID.java b/utils/misc/src/main/java/org/onlab/packet/VLANID.java
index 68774e3..31cdecb 100644
--- a/utils/misc/src/main/java/org/onlab/packet/VLANID.java
+++ b/utils/misc/src/main/java/org/onlab/packet/VLANID.java
@@ -4,13 +4,28 @@
  * Representation of a VLAN ID.
  */
 public class VLANID {
-    // A VLAN ID is 12 bits, short is close
-    private final short value;
 
-    public VLANID(short value) {
+    private final short value;
+    private static final short NONE = 0;
+    // A VLAN ID is actually 12 bits of a VLAN tag.
+    private static final short MAX_VLAN = 4095;
+
+    protected VLANID(short value) {
         this.value = value;
     }
 
+    public static VLANID vlanId() {
+        return new VLANID(NONE);
+    }
+
+    public static VLANID vlanId(short value) {
+        if (value >= MAX_VLAN) {
+            throw new IllegalArgumentException(
+                    "value exceeds allowed maximum VLAN ID value (4095)");
+        }
+        return new VLANID(value);
+    }
+
     public short toShort() {
         return this.value;
     }
@@ -37,5 +52,10 @@
     public int hashCode() {
         return this.value;
     }
+
+    @Override
+    public String toString() {
+        return String.valueOf(this.value);
+    }
 }