diff --git a/src/python/loxi/of12/common.py b/src/python/loxi/of12/common.py
index 13cc2f4..f2d2493 100644
--- a/src/python/loxi/of12/common.py
+++ b/src/python/loxi/of12/common.py
@@ -1,6 +1,7 @@
 # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
 # Copyright (c) 2011, 2012 Open Networking Foundation
 # Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+# See the file LICENSE.pyloxi which should have been included in the source distribution
 
 # Automatically generated by LOXI from template common.py
 # Do not modify
@@ -98,8 +99,8 @@
         obj.hw_addr = list(reader.read('!6B'))
         reader.skip(2)
         obj.name = reader.read("!16s")[0].rstrip("\x00")
-        obj.ipv4_addr = reader.read('!L')[0]
-        obj.ipv4_netmask = reader.read('!L')[0]
+        obj.ipv4_addr = reader.read("!L")[0]
+        obj.ipv4_netmask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -136,6 +137,100 @@
             q.breakable()
         q.text('}')
 
+class bsn_vport_q_in_q(object):
+    type = 0
+
+    def __init__(self, port_no=None, ingress_tpid=None, ingress_vlan_id=None, egress_tpid=None, egress_vlan_id=None):
+        if port_no != None:
+            self.port_no = port_no
+        else:
+            self.port_no = 0
+        if ingress_tpid != None:
+            self.ingress_tpid = ingress_tpid
+        else:
+            self.ingress_tpid = 0
+        if ingress_vlan_id != None:
+            self.ingress_vlan_id = ingress_vlan_id
+        else:
+            self.ingress_vlan_id = 0
+        if egress_tpid != None:
+            self.egress_tpid = egress_tpid
+        else:
+            self.egress_tpid = 0
+        if egress_vlan_id != None:
+            self.egress_vlan_id = egress_vlan_id
+        else:
+            self.egress_vlan_id = 0
+        return
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!H", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
+        packed.append(struct.pack("!L", self.port_no))
+        packed.append(struct.pack("!H", self.ingress_tpid))
+        packed.append(struct.pack("!H", self.ingress_vlan_id))
+        packed.append(struct.pack("!H", self.egress_tpid))
+        packed.append(struct.pack("!H", self.egress_vlan_id))
+        length = sum([len(x) for x in packed])
+        packed[1] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = bsn_vport_q_in_q()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
+        obj.port_no = reader.read("!L")[0]
+        obj.ingress_tpid = reader.read("!H")[0]
+        obj.ingress_vlan_id = reader.read("!H")[0]
+        obj.egress_tpid = reader.read("!H")[0]
+        obj.egress_vlan_id = reader.read("!H")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.port_no != other.port_no: return False
+        if self.ingress_tpid != other.ingress_tpid: return False
+        if self.ingress_vlan_id != other.ingress_vlan_id: return False
+        if self.egress_tpid != other.egress_tpid: return False
+        if self.egress_vlan_id != other.egress_vlan_id: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_vport_q_in_q {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("port_no = ");
+                q.text("%#x" % self.port_no)
+                q.text(","); q.breakable()
+                q.text("ingress_tpid = ");
+                q.text("%#x" % self.ingress_tpid)
+                q.text(","); q.breakable()
+                q.text("ingress_vlan_id = ");
+                q.text("%#x" % self.ingress_vlan_id)
+                q.text(","); q.breakable()
+                q.text("egress_tpid = ");
+                q.text("%#x" % self.egress_tpid)
+                q.text(","); q.breakable()
+                q.text("egress_vlan_id = ");
+                q.text("%#x" % self.egress_vlan_id)
+            q.breakable()
+        q.text('}')
+
 class bucket(object):
 
     def __init__(self, weight=None, watch_port=None, watch_group=None, actions=None):
@@ -161,10 +256,10 @@
         packed = []
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 0
         packed.append(struct.pack("!H", self.weight))
-        packed.append(struct.pack("!L", self.watch_port))
+        packed.append(util.pack_port_no(self.watch_port))
         packed.append(struct.pack("!L", self.watch_group))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.actions]))
+        packed.append(util.pack_list(self.actions))
         length = sum([len(x) for x in packed])
         packed[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -176,10 +271,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _len = reader.read('!H')[0]
-        obj.weight = reader.read('!H')[0]
-        obj.watch_port = reader.read('!L')[0]
-        obj.watch_group = reader.read('!L')[0]
+        _len = reader.read("!H")[0]
+        obj.weight = reader.read("!H")[0]
+        obj.watch_port = util.unpack_port_no(reader)
+        obj.watch_group = reader.read("!L")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -244,8 +339,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -338,7 +433,7 @@
         packed.append(struct.pack("!Q", self.packet_count))
         packed.append(struct.pack("!Q", self.byte_count))
         packed.append(self.match.pack())
-        packed.append("".join([x.pack() for x in self.instructions]))
+        packed.append(util.pack_list(self.instructions))
         length = sum([len(x) for x in packed])
         packed[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -350,18 +445,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _length = reader.read('!H')[0]
-        obj.table_id = reader.read('!B')[0]
+        _length = reader.read("!H")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(1)
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
         reader.skip(6)
-        obj.cookie = reader.read('!Q')[0]
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
         return obj
@@ -451,7 +546,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append('\x00' * 1)
         packed.append(struct.pack("!L", self.group_id))
-        packed.append("".join([x.pack() for x in self.buckets]))
+        packed.append(util.pack_list(self.buckets))
         length = sum([len(x) for x in packed])
         packed[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -463,10 +558,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _length = reader.read('!H')[0]
-        obj.type = reader.read('!B')[0]
+        _length = reader.read("!H")[0]
+        obj.type = reader.read("!B")[0]
         reader.skip(1)
-        obj.group_id = reader.read('!L')[0]
+        obj.group_id = reader.read("!L")[0]
         obj.buckets = common.unpack_list_bucket(reader)
         return obj
 
@@ -534,7 +629,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.packet_count))
         packed.append(struct.pack("!Q", self.byte_count))
-        packed.append("".join([x.pack() for x in self.bucket_stats]))
+        packed.append(util.pack_list(self.bucket_stats))
         length = sum([len(x) for x in packed])
         packed[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -546,13 +641,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _length = reader.read('!H')[0]
+        _length = reader.read("!H")[0]
         reader.skip(2)
-        obj.group_id = reader.read('!L')[0]
-        obj.ref_count = reader.read('!L')[0]
+        obj.group_id = reader.read("!L")[0]
+        obj.ref_count = reader.read("!L")[0]
         reader.skip(4)
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
         obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
         return obj
 
@@ -608,7 +703,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
-        packed.append("".join([x.pack() for x in self.oxm_list]))
+        packed.append(util.pack_list(self.oxm_list))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         packed.append('\x00' * ((length + 7)/8*8 - length))
@@ -621,9 +716,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
         assert(_type == 1)
-        _length = reader.read('!H')[0]
+        _length = reader.read("!H")[0]
         obj.oxm_list = oxm.unpack_list(reader.slice(_length-4))
         reader.skip((_length + 7)/8*8 - _length)
         return obj
@@ -670,10 +765,10 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.queue_id))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 2
         packed.append('\x00' * 6)
-        packed.append("".join([x.pack() for x in self.properties]))
+        packed.append(util.pack_list(self.properties))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -685,9 +780,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.queue_id = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
-        _len = reader.read('!H')[0]
+        obj.queue_id = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
+        _len = reader.read("!H")[0]
         reader.skip(6)
         obj.properties = common.unpack_list_queue_prop(reader)
         return obj
@@ -773,7 +868,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!6B", *self.hw_addr))
         packed.append('\x00' * 2)
@@ -795,19 +890,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(4)
         obj.hw_addr = list(reader.read('!6B'))
         reader.skip(2)
         obj.name = reader.read("!16s")[0].rstrip("\x00")
-        obj.config = reader.read('!L')[0]
-        obj.state = reader.read('!L')[0]
-        obj.curr = reader.read('!L')[0]
-        obj.advertised = reader.read('!L')[0]
-        obj.supported = reader.read('!L')[0]
-        obj.peer = reader.read('!L')[0]
-        obj.curr_speed = reader.read('!L')[0]
-        obj.max_speed = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
+        obj.state = reader.read("!L")[0]
+        obj.curr = reader.read("!L")[0]
+        obj.advertised = reader.read("!L")[0]
+        obj.supported = reader.read("!L")[0]
+        obj.peer = reader.read("!L")[0]
+        obj.curr_speed = reader.read("!L")[0]
+        obj.max_speed = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -931,7 +1026,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.rx_packets))
         packed.append(struct.pack("!Q", self.tx_packets))
@@ -954,20 +1049,20 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(4)
-        obj.rx_packets = reader.read('!Q')[0]
-        obj.tx_packets = reader.read('!Q')[0]
-        obj.rx_bytes = reader.read('!Q')[0]
-        obj.tx_bytes = reader.read('!Q')[0]
-        obj.rx_dropped = reader.read('!Q')[0]
-        obj.tx_dropped = reader.read('!Q')[0]
-        obj.rx_errors = reader.read('!Q')[0]
-        obj.tx_errors = reader.read('!Q')[0]
-        obj.rx_frame_err = reader.read('!Q')[0]
-        obj.rx_over_err = reader.read('!Q')[0]
-        obj.rx_crc_err = reader.read('!Q')[0]
-        obj.collisions = reader.read('!Q')[0]
+        obj.rx_packets = reader.read("!Q")[0]
+        obj.tx_packets = reader.read("!Q")[0]
+        obj.rx_bytes = reader.read("!Q")[0]
+        obj.tx_bytes = reader.read("!Q")[0]
+        obj.rx_dropped = reader.read("!Q")[0]
+        obj.tx_dropped = reader.read("!Q")[0]
+        obj.rx_errors = reader.read("!Q")[0]
+        obj.tx_errors = reader.read("!Q")[0]
+        obj.rx_frame_err = reader.read("!Q")[0]
+        obj.rx_over_err = reader.read("!Q")[0]
+        obj.rx_crc_err = reader.read("!Q")[0]
+        obj.collisions = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -1041,7 +1136,7 @@
         q.text('}')
 
 class queue_prop_experimenter(object):
-    type = const.OFPQT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, experimenter=None, data=None):
         if experimenter != None:
@@ -1051,7 +1146,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
         return
 
     def pack(self):
@@ -1073,11 +1168,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPQT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.experimenter = reader.read('!L')[0]
+        obj.experimenter = reader.read("!L")[0]
         reader.skip(4)
         obj.data = str(reader.read_all())
         return obj
@@ -1109,7 +1204,7 @@
         q.text('}')
 
 class queue_prop_max_rate(object):
-    type = const.OFPQT_MAX_RATE
+    type = 2
 
     def __init__(self, rate=None):
         if rate != None:
@@ -1136,11 +1231,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPQT_MAX_RATE)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.rate = reader.read('!H')[0]
+        obj.rate = reader.read("!H")[0]
         reader.skip(6)
         return obj
 
@@ -1167,7 +1262,7 @@
         q.text('}')
 
 class queue_prop_min_rate(object):
-    type = const.OFPQT_MIN_RATE
+    type = 1
 
     def __init__(self, rate=None):
         if rate != None:
@@ -1194,11 +1289,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPQT_MIN_RATE)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.rate = reader.read('!H')[0]
+        obj.rate = reader.read("!H")[0]
         reader.skip(6)
         return obj
 
@@ -1251,7 +1346,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append(struct.pack("!L", self.queue_id))
         packed.append(struct.pack("!Q", self.tx_bytes))
         packed.append(struct.pack("!Q", self.tx_packets))
@@ -1265,11 +1360,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!L')[0]
-        obj.queue_id = reader.read('!L')[0]
-        obj.tx_bytes = reader.read('!Q')[0]
-        obj.tx_packets = reader.read('!Q')[0]
-        obj.tx_errors = reader.read('!Q')[0]
+        obj.port_no = util.unpack_port_no(reader)
+        obj.queue_id = reader.read("!L")[0]
+        obj.tx_bytes = reader.read("!Q")[0]
+        obj.tx_packets = reader.read("!Q")[0]
+        obj.tx_errors = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -1324,11 +1419,11 @@
         if match != None:
             self.match = match
         else:
-            self.match = 0
+            self.match = util.init_match_bmap()
         if wildcards != None:
             self.wildcards = wildcards
         else:
-            self.wildcards = 0
+            self.wildcards = util.init_wc_bmap()
         if write_actions != None:
             self.write_actions = write_actions
         else:
@@ -1384,8 +1479,8 @@
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 7)
         packed.append(struct.pack("!32s", self.name))
-        packed.append(struct.pack("!Q", self.match))
-        packed.append(struct.pack("!Q", self.wildcards))
+        packed.append(util.pack_match_bmap(self.match))
+        packed.append(util.pack_wc_bmap(self.wildcards))
         packed.append(struct.pack("!L", self.write_actions))
         packed.append(struct.pack("!L", self.apply_actions))
         packed.append(struct.pack("!Q", self.write_setfields))
@@ -1407,23 +1502,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(7)
         obj.name = reader.read("!32s")[0].rstrip("\x00")
-        obj.match = reader.read('!Q')[0]
-        obj.wildcards = reader.read('!Q')[0]
-        obj.write_actions = reader.read('!L')[0]
-        obj.apply_actions = reader.read('!L')[0]
-        obj.write_setfields = reader.read('!Q')[0]
-        obj.apply_setfields = reader.read('!Q')[0]
-        obj.metadata_match = reader.read('!Q')[0]
-        obj.metadata_write = reader.read('!Q')[0]
-        obj.instructions = reader.read('!L')[0]
-        obj.config = reader.read('!L')[0]
-        obj.max_entries = reader.read('!L')[0]
-        obj.active_count = reader.read('!L')[0]
-        obj.lookup_count = reader.read('!Q')[0]
-        obj.matched_count = reader.read('!Q')[0]
+        obj.match = util.unpack_match_bmap(reader)
+        obj.wildcards = util.unpack_wc_bmap(reader)
+        obj.write_actions = reader.read("!L")[0]
+        obj.apply_actions = reader.read("!L")[0]
+        obj.write_setfields = reader.read("!Q")[0]
+        obj.apply_setfields = reader.read("!Q")[0]
+        obj.metadata_match = reader.read("!Q")[0]
+        obj.metadata_write = reader.read("!Q")[0]
+        obj.instructions = reader.read("!L")[0]
+        obj.config = reader.read("!L")[0]
+        obj.max_entries = reader.read("!L")[0]
+        obj.active_count = reader.read("!L")[0]
+        obj.lookup_count = reader.read("!Q")[0]
+        obj.matched_count = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
