diff --git a/src/python/loxi/__init__.py b/src/python/loxi/__init__.py
index 58fa3d7..dfab263 100644
--- a/src/python/loxi/__init__.py
+++ b/src/python/loxi/__init__.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 toplevel_init.py
 # Do not modify
diff --git a/src/python/loxi/generic_util.py b/src/python/loxi/generic_util.py
index 6df9565..ce31049 100644
--- a/src/python/loxi/generic_util.py
+++ b/src/python/loxi/generic_util.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
 """
 Utility functions independent of the protocol version
 """
diff --git a/src/python/loxi/of10/__init__.py b/src/python/loxi/of10/__init__.py
index 6f2680d..e1c5e3a 100644
--- a/src/python/loxi/of10/__init__.py
+++ b/src/python/loxi/of10/__init__.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 init.py
 # Do not modify
diff --git a/src/python/loxi/of10/action.py b/src/python/loxi/of10/action.py
index 8fe2997..2de9ac9 100644
--- a/src/python/loxi/of10/action.py
+++ b/src/python/loxi/of10/action.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 action.py
 # Do not modify
@@ -23,8 +24,8 @@
     pass
 
 class bsn_mirror(Action):
-    type = const.OFPAT_VENDOR
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 1
 
     def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
@@ -63,16 +64,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_VENDOR)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 1)
-        obj.dest_port = reader.read('!L')[0]
-        obj.vlan_tag = reader.read('!L')[0]
-        obj.copy_stage = reader.read('!B')[0]
+        obj.dest_port = reader.read("!L")[0]
+        obj.vlan_tag = reader.read("!L")[0]
+        obj.copy_stage = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -107,8 +108,8 @@
         q.text('}')
 
 class bsn_set_tunnel_dst(Action):
-    type = const.OFPAT_VENDOR
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 2
 
     def __init__(self, dst=None):
@@ -136,14 +137,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_VENDOR)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 2)
-        obj.dst = reader.read('!L')[0]
+        obj.dst = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -169,7 +170,7 @@
         q.text('}')
 
 class enqueue(Action):
-    type = const.OFPAT_ENQUEUE
+    type = 11
 
     def __init__(self, port=None, queue_id=None):
         if port != None:
@@ -186,7 +187,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!H", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 6)
         packed.append(struct.pack("!L", self.queue_id))
         length = sum([len(x) for x in packed])
@@ -200,12 +201,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_ENQUEUE)
-        _len = reader.read('!H')[0]
-        obj.port = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 11)
+        _len = reader.read("!H")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(6)
-        obj.queue_id = reader.read('!L')[0]
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -235,8 +236,8 @@
         q.text('}')
 
 class nicira_dec_ttl(Action):
-    type = const.OFPAT_VENDOR
-    experimenter = 0x2320
+    type = 65535
+    experimenter = 8992
     subtype = 18
 
     def __init__(self):
@@ -261,12 +262,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_VENDOR)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!H")[0]
         assert(_subtype == 18)
         reader.skip(2)
         reader.skip(4)
@@ -292,7 +293,7 @@
         q.text('}')
 
 class output(Action):
-    type = const.OFPAT_OUTPUT
+    type = 0
 
     def __init__(self, port=None, max_len=None):
         if port != None:
@@ -309,7 +310,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!H", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append(struct.pack("!H", self.max_len))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
@@ -322,11 +323,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_OUTPUT)
-        _len = reader.read('!H')[0]
-        obj.port = reader.read('!H')[0]
-        obj.max_len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _len = reader.read("!H")[0]
+        obj.port = util.unpack_port_no(reader)
+        obj.max_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -356,7 +357,7 @@
         q.text('}')
 
 class set_dl_dst(Action):
-    type = const.OFPAT_SET_DL_DST
+    type = 5
 
     def __init__(self, dl_addr=None):
         if dl_addr != None:
@@ -382,9 +383,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_DL_DST)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _len = reader.read("!H")[0]
         obj.dl_addr = list(reader.read('!6B'))
         reader.skip(6)
         return obj
@@ -412,7 +413,7 @@
         q.text('}')
 
 class set_dl_src(Action):
-    type = const.OFPAT_SET_DL_SRC
+    type = 4
 
     def __init__(self, dl_addr=None):
         if dl_addr != None:
@@ -438,9 +439,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_DL_SRC)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _len = reader.read("!H")[0]
         obj.dl_addr = list(reader.read('!6B'))
         reader.skip(6)
         return obj
@@ -468,7 +469,7 @@
         q.text('}')
 
 class set_nw_dst(Action):
-    type = const.OFPAT_SET_NW_DST
+    type = 7
 
     def __init__(self, nw_addr=None):
         if nw_addr != None:
@@ -493,10 +494,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_DST)
-        _len = reader.read('!H')[0]
-        obj.nw_addr = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 7)
+        _len = reader.read("!H")[0]
+        obj.nw_addr = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -522,7 +523,7 @@
         q.text('}')
 
 class set_nw_src(Action):
-    type = const.OFPAT_SET_NW_SRC
+    type = 6
 
     def __init__(self, nw_addr=None):
         if nw_addr != None:
@@ -547,10 +548,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_SRC)
-        _len = reader.read('!H')[0]
-        obj.nw_addr = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 6)
+        _len = reader.read("!H")[0]
+        obj.nw_addr = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -576,7 +577,7 @@
         q.text('}')
 
 class set_nw_tos(Action):
-    type = const.OFPAT_SET_NW_TOS
+    type = 8
 
     def __init__(self, nw_tos=None):
         if nw_tos != None:
@@ -602,10 +603,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_TOS)
-        _len = reader.read('!H')[0]
-        obj.nw_tos = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 8)
+        _len = reader.read("!H")[0]
+        obj.nw_tos = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -632,7 +633,7 @@
         q.text('}')
 
 class set_tp_dst(Action):
-    type = const.OFPAT_SET_TP_DST
+    type = 10
 
     def __init__(self, tp_port=None):
         if tp_port != None:
@@ -658,10 +659,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_TP_DST)
-        _len = reader.read('!H')[0]
-        obj.tp_port = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 10)
+        _len = reader.read("!H")[0]
+        obj.tp_port = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -688,7 +689,7 @@
         q.text('}')
 
 class set_tp_src(Action):
-    type = const.OFPAT_SET_TP_SRC
+    type = 9
 
     def __init__(self, tp_port=None):
         if tp_port != None:
@@ -714,10 +715,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_TP_SRC)
-        _len = reader.read('!H')[0]
-        obj.tp_port = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 9)
+        _len = reader.read("!H")[0]
+        obj.tp_port = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -744,7 +745,7 @@
         q.text('}')
 
 class set_vlan_pcp(Action):
-    type = const.OFPAT_SET_VLAN_PCP
+    type = 2
 
     def __init__(self, vlan_pcp=None):
         if vlan_pcp != None:
@@ -770,10 +771,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_VLAN_PCP)
-        _len = reader.read('!H')[0]
-        obj.vlan_pcp = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
+        obj.vlan_pcp = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -800,7 +801,7 @@
         q.text('}')
 
 class set_vlan_vid(Action):
-    type = const.OFPAT_SET_VLAN_VID
+    type = 1
 
     def __init__(self, vlan_vid=None):
         if vlan_vid != None:
@@ -826,10 +827,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_VLAN_VID)
-        _len = reader.read('!H')[0]
-        obj.vlan_vid = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.vlan_vid = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -856,7 +857,7 @@
         q.text('}')
 
 class strip_vlan(Action):
-    type = const.OFPAT_STRIP_VLAN
+    type = 3
 
     def __init__(self):
         return
@@ -877,9 +878,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_STRIP_VLAN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -919,26 +920,26 @@
         raise loxi.ProtocolError("unexpected BSN experimenter subtype %#x" % subtype)
 
 parsers = {
-    const.OFPAT_ENQUEUE : enqueue.unpack,
     const.OFPAT_OUTPUT : output.unpack,
-    const.OFPAT_SET_DL_DST : set_dl_dst.unpack,
-    const.OFPAT_SET_DL_SRC : set_dl_src.unpack,
-    const.OFPAT_SET_NW_DST : set_nw_dst.unpack,
-    const.OFPAT_SET_NW_SRC : set_nw_src.unpack,
-    const.OFPAT_SET_NW_TOS : set_nw_tos.unpack,
-    const.OFPAT_SET_TP_DST : set_tp_dst.unpack,
-    const.OFPAT_SET_TP_SRC : set_tp_src.unpack,
-    const.OFPAT_SET_VLAN_PCP : set_vlan_pcp.unpack,
     const.OFPAT_SET_VLAN_VID : set_vlan_vid.unpack,
+    const.OFPAT_SET_VLAN_PCP : set_vlan_pcp.unpack,
     const.OFPAT_STRIP_VLAN : strip_vlan.unpack,
+    const.OFPAT_SET_DL_SRC : set_dl_src.unpack,
+    const.OFPAT_SET_DL_DST : set_dl_dst.unpack,
+    const.OFPAT_SET_NW_SRC : set_nw_src.unpack,
+    const.OFPAT_SET_NW_DST : set_nw_dst.unpack,
+    const.OFPAT_SET_NW_TOS : set_nw_tos.unpack,
+    const.OFPAT_SET_TP_SRC : set_tp_src.unpack,
+    const.OFPAT_SET_TP_DST : set_tp_dst.unpack,
+    const.OFPAT_ENQUEUE : enqueue.unpack,
     const.OFPAT_VENDOR : parse_vendor,
 }
 
 experimenter_parsers = {
-    0x2320 : {
+    8992 : {
         18: nicira_dec_ttl.unpack,
     },
-    0x5c16c7 : {
+    6035143 : {
         1: bsn_mirror.unpack,
         2: bsn_set_tunnel_dst.unpack,
     },
diff --git a/src/python/loxi/of10/common.py b/src/python/loxi/of10/common.py
index cfee494..616cf75 100644
--- a/src/python/loxi/of10/common.py
+++ b/src/python/loxi/of10/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
@@ -96,8 +97,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):
@@ -134,6 +135,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 flow_stats_entry(object):
 
     def __init__(self, table_id=None, match=None, duration_sec=None, duration_nsec=None, priority=None, idle_timeout=None, hard_timeout=None, cookie=None, packet_count=None, byte_count=None, actions=None):
@@ -198,7 +293,7 @@
         packed.append(struct.pack("!Q", self.cookie))
         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.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)
@@ -210,19 +305,19 @@
             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.match = common.match.unpack(reader)
-        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.actions = action.unpack_list(reader)
         return obj
 
@@ -290,11 +385,11 @@
 
 class match_v1(object):
 
-    def __init__(self, wildcards=None, in_port=None, eth_src=None, eth_dst=None, vlan_vid=None, vlan_pcp=None, eth_type=None, ip_dscp=None, ip_proto=None, ipv4_src=None, ipv4_dst=None, tcp_src=None, tcp_dst=None):
+    def __init__(self, wildcards=None, in_port=None, eth_src=None, eth_dst=None, vlan_vid=None, vlan_pcp=None, eth_type=None, ip_dscp=None, ip_proto=None, src_meta_id=None, dst_meta_id=None, ipv4_src=None, ipv4_dst=None, tcp_src=None, tcp_dst=None):
         if wildcards != None:
             self.wildcards = wildcards
         else:
-            self.wildcards = const.OFPFW_ALL
+            self.wildcards = util.init_wc_bmap()
         if in_port != None:
             self.in_port = in_port
         else:
@@ -327,6 +422,14 @@
             self.ip_proto = ip_proto
         else:
             self.ip_proto = 0
+        if src_meta_id != None:
+            self.src_meta_id = src_meta_id
+        else:
+            self.src_meta_id = 0
+        if dst_meta_id != None:
+            self.dst_meta_id = dst_meta_id
+        else:
+            self.dst_meta_id = 0
         if ipv4_src != None:
             self.ipv4_src = ipv4_src
         else:
@@ -347,8 +450,8 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!L", self.wildcards))
-        packed.append(struct.pack("!H", self.in_port))
+        packed.append(util.pack_wc_bmap(self.wildcards))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!6B", *self.eth_src))
         packed.append(struct.pack("!6B", *self.eth_dst))
         packed.append(struct.pack("!H", self.vlan_vid))
@@ -357,7 +460,8 @@
         packed.append(struct.pack("!H", self.eth_type))
         packed.append(struct.pack("!B", self.ip_dscp))
         packed.append(struct.pack("!B", self.ip_proto))
-        packed.append('\x00' * 2)
+        packed.append(struct.pack("!B", self.src_meta_id))
+        packed.append(struct.pack("!B", self.dst_meta_id))
         packed.append(struct.pack("!L", self.ipv4_src))
         packed.append(struct.pack("!L", self.ipv4_dst))
         packed.append(struct.pack("!H", self.tcp_src))
@@ -371,21 +475,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.wildcards = reader.read('!L')[0]
-        obj.in_port = reader.read('!H')[0]
+        obj.wildcards = util.unpack_wc_bmap(reader)
+        obj.in_port = util.unpack_port_no(reader)
         obj.eth_src = list(reader.read('!6B'))
         obj.eth_dst = list(reader.read('!6B'))
-        obj.vlan_vid = reader.read('!H')[0]
-        obj.vlan_pcp = reader.read('!B')[0]
+        obj.vlan_vid = reader.read("!H")[0]
+        obj.vlan_pcp = reader.read("!B")[0]
         reader.skip(1)
-        obj.eth_type = reader.read('!H')[0]
-        obj.ip_dscp = reader.read('!B')[0]
-        obj.ip_proto = reader.read('!B')[0]
-        reader.skip(2)
-        obj.ipv4_src = reader.read('!L')[0]
-        obj.ipv4_dst = reader.read('!L')[0]
-        obj.tcp_src = reader.read('!H')[0]
-        obj.tcp_dst = reader.read('!H')[0]
+        obj.eth_type = reader.read("!H")[0]
+        obj.ip_dscp = reader.read("!B")[0]
+        obj.ip_proto = reader.read("!B")[0]
+        obj.src_meta_id = reader.read("!B")[0]
+        obj.dst_meta_id = reader.read("!B")[0]
+        obj.ipv4_src = reader.read("!L")[0]
+        obj.ipv4_dst = reader.read("!L")[0]
+        obj.tcp_src = reader.read("!H")[0]
+        obj.tcp_dst = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -399,6 +504,8 @@
         if self.eth_type != other.eth_type: return False
         if self.ip_dscp != other.ip_dscp: return False
         if self.ip_proto != other.ip_proto: return False
+        if self.src_meta_id != other.src_meta_id: return False
+        if self.dst_meta_id != other.dst_meta_id: return False
         if self.ipv4_src != other.ipv4_src: return False
         if self.ipv4_dst != other.ipv4_dst: return False
         if self.tcp_src != other.tcp_src: return False
@@ -444,6 +551,12 @@
                 q.text("ip_proto = ");
                 q.text("%#x" % self.ip_proto)
                 q.text(","); q.breakable()
+                q.text("src_meta_id = ");
+                q.text("%#x" % self.src_meta_id)
+                q.text(","); q.breakable()
+                q.text("dst_meta_id = ");
+                q.text("%#x" % self.dst_meta_id)
+                q.text(","); q.breakable()
                 q.text("ipv4_src = ");
                 q.text(util.pretty_ipv4(self.ipv4_src))
                 q.text(","); q.breakable()
@@ -476,7 +589,7 @@
         packed.append(struct.pack("!L", self.queue_id))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         packed.append('\x00' * 2)
-        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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -488,8 +601,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.queue_id = reader.read('!L')[0]
-        _len = reader.read('!H')[0]
+        obj.queue_id = reader.read("!L")[0]
+        _len = reader.read("!H")[0]
         reader.skip(2)
         obj.properties = common.unpack_list_queue_prop(reader)
         return obj
@@ -563,7 +676,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append(struct.pack("!6B", *self.hw_addr))
         packed.append(struct.pack("!16s", self.name))
         packed.append(struct.pack("!L", self.config))
@@ -581,15 +694,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!H')[0]
+        obj.port_no = util.unpack_port_no(reader)
         obj.hw_addr = list(reader.read('!6B'))
         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.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]
         return obj
 
     def __eq__(self, other):
@@ -705,7 +818,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 6)
         packed.append(struct.pack("!Q", self.rx_packets))
         packed.append(struct.pack("!Q", self.tx_packets))
@@ -728,20 +841,20 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!H')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(6)
-        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):
@@ -815,7 +928,7 @@
         q.text('}')
 
 class queue_prop_min_rate(object):
-    type = const.OFPQT_MIN_RATE
+    type = 1
 
     def __init__(self, rate=None):
         if rate != None:
@@ -842,11 +955,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
 
@@ -899,7 +1012,7 @@
 
     def pack(self):
         packed = []
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 2)
         packed.append(struct.pack("!L", self.queue_id))
         packed.append(struct.pack("!Q", self.tx_bytes))
@@ -914,12 +1027,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.port_no = reader.read('!H')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(2)
-        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.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):
@@ -974,7 +1087,7 @@
         if wildcards != None:
             self.wildcards = wildcards
         else:
-            self.wildcards = const.OFPFW_ALL
+            self.wildcards = util.init_wc_bmap()
         if max_entries != None:
             self.max_entries = max_entries
         else:
@@ -998,7 +1111,7 @@
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
         packed.append(struct.pack("!32s", self.name))
-        packed.append(struct.pack("!L", self.wildcards))
+        packed.append(util.pack_wc_bmap(self.wildcards))
         packed.append(struct.pack("!L", self.max_entries))
         packed.append(struct.pack("!L", self.active_count))
         packed.append(struct.pack("!Q", self.lookup_count))
@@ -1012,14 +1125,14 @@
             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(3)
         obj.name = reader.read("!32s")[0].rstrip("\x00")
-        obj.wildcards = 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.wildcards = util.unpack_wc_bmap(reader)
+        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):
diff --git a/src/python/loxi/of10/const.py b/src/python/loxi/of10/const.py
index 3b9a177..0273c7a 100644
--- a/src/python/loxi/of10/const.py
+++ b/src/python/loxi/of10/const.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 const.py
 # Do not modify
@@ -8,23 +9,23 @@
 OFP_VERSION = 1
 
 # Identifiers from group macro_definitions
-OFP_FLOW_PERMANENT = 0
-OFP_ETH_ALEN = 6
-OFP_MAX_PORT_NAME_LEN = 16
 OFP_MAX_TABLE_NAME_LEN = 32
-SERIAL_NUM_LEN = 32
-OFPFW_ICMP_TYPE = 64
-OFP_DEFAULT_MISS_SEND_LEN = 128
-OFPFW_ICMP_CODE = 128
-DESC_STR_LEN = 256
-OFP_DL_TYPE_NOT_ETH_TYPE = 1535
-OFP_DL_TYPE_ETH2_CUTOFF = 1536
+OFP_MAX_PORT_NAME_LEN = 16
 OFP_TCP_PORT = 6633
 OFP_SSL_PORT = 6633
-OFP_DEFAULT_PRIORITY = 32768
+OFP_ETH_ALEN = 6
+OFP_DEFAULT_MISS_SEND_LEN = 128
 OFP_VLAN_NONE = 65535
-OFPQ_MIN_RATE_UNCFG = 65535
+OFPFW_ICMP_TYPE = 64
+OFPFW_ICMP_CODE = 128
+OFP_DL_TYPE_ETH2_CUTOFF = 1536
+OFP_DL_TYPE_NOT_ETH_TYPE = 1535
+OFP_FLOW_PERMANENT = 0
+OFP_DEFAULT_PRIORITY = 32768
+DESC_STR_LEN = 256
+SERIAL_NUM_LEN = 32
 OFPQ_ALL = 4294967295
+OFPQ_MIN_RATE_UNCFG = 65535
 
 # Identifiers from group ofp_action_type
 OFPAT_OUTPUT = 0
@@ -103,6 +104,13 @@
     8: 'OFPBRC_BUFFER_UNKNOWN',
 }
 
+# Identifiers from group ofp_bsn_vport_q_in_q_untagged
+OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 65535
+
+ofp_bsn_vport_q_in_q_untagged_map = {
+    65535: 'OF_BSN_VPORT_Q_IN_Q_UNTAGGED',
+}
+
 # Identifiers from group ofp_capabilities
 OFPC_FLOW_STATS = 1
 OFPC_TABLE_STATS = 2
@@ -227,6 +235,8 @@
 OFPFW_NW_DST_MASK = 1032192
 OFPFW_DL_VLAN_PCP = 1048576
 OFPFW_NW_TOS = 2097152
+OFPFW_SRC_META_ID = 4194304
+OFPFW_DST_META_ID = 8388608
 OFPFW_ALL = 4194303
 
 ofp_flow_wildcards_map = {
@@ -240,6 +250,8 @@
     128: 'OFPFW_TP_DST',
     1048576: 'OFPFW_DL_VLAN_PCP',
     2097152: 'OFPFW_NW_TOS',
+    4194304: 'OFPFW_SRC_META_ID',
+    8388608: 'OFPFW_DST_META_ID',
 }
 
 # Identifiers from group ofp_hello_failed_code
diff --git a/src/python/loxi/of10/message.py b/src/python/loxi/of10/message.py
index b95b3c4..e01c342 100644
--- a/src/python/loxi/of10/message.py
+++ b/src/python/loxi/of10/message.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 message.py
 # Do not modify
@@ -19,9 +20,9 @@
     xid = None
 
 class aggregate_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_AGGREGATE
+    version = 1
+    type = 17
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
         self.xid = xid
@@ -66,18 +67,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
-        obj.flow_count = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
+        obj.flow_count = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -128,9 +129,9 @@
         q.text('}')
 
 class aggregate_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_AGGREGATE
+    version = 1
+    type = 16
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
         self.xid = xid
@@ -162,7 +163,7 @@
         packed.append(self.match.pack())
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 1)
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -175,19 +176,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
         obj.match = common.match.unpack(reader)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(1)
-        obj.out_port = reader.read('!H')[0]
+        obj.out_port = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -237,8 +238,8 @@
         q.text('}')
 
 class barrier_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REPLY
+    version = 1
+    type = 19
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -261,12 +262,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -300,8 +301,8 @@
         q.text('}')
 
 class barrier_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REQUEST
+    version = 1
+    type = 18
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -324,12 +325,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -362,10 +363,486 @@
             q.breakable()
         q.text('}')
 
+class bsn_bw_clear_data_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 22
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 22)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_clear_data_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 21
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 21)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 20
+
+    def __init__(self, xid=None, enabled=None):
+        self.xid = xid
+        if enabled != None:
+            self.enabled = enabled
+        else:
+            self.enabled = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enabled))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 20)
+        obj.enabled = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enabled != other.enabled: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enabled = ");
+                q.text("%#x" % self.enabled)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 19
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 19)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 23
+
+    def __init__(self, xid=None, enable=None, status=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 23)
+        obj.enable = reader.read("!L")[0]
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 18
+
+    def __init__(self, xid=None, enable=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 18)
+        obj.enable = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+            q.breakable()
+        q.text('}')
+
 class bsn_get_interfaces_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 10
 
     def __init__(self, xid=None, interfaces=None):
@@ -383,7 +860,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.experimenter))
         packed.append(struct.pack("!L", self.subtype))
-        packed.append("".join([x.pack() for x in self.interfaces]))
+        packed.append(util.pack_list(self.interfaces))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -396,15 +873,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 10)
         obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
         return obj
@@ -444,9 +921,9 @@
         q.text('}')
 
 class bsn_get_interfaces_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 9
 
     def __init__(self, xid=None):
@@ -472,15 +949,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 9)
         return obj
 
@@ -515,9 +992,9 @@
         q.text('}')
 
 class bsn_get_ip_mask_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 2
 
     def __init__(self, xid=None, index=None, mask=None):
@@ -554,19 +1031,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 2)
-        obj.index = reader.read('!B')[0]
+        obj.index = reader.read("!B")[0]
         reader.skip(3)
-        obj.mask = reader.read('!L')[0]
+        obj.mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -608,9 +1085,9 @@
         q.text('}')
 
 class bsn_get_ip_mask_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 1
 
     def __init__(self, xid=None, index=None):
@@ -642,17 +1119,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 1)
-        obj.index = reader.read('!B')[0]
+        obj.index = reader.read("!B")[0]
         reader.skip(7)
         return obj
 
@@ -691,9 +1168,9 @@
         q.text('}')
 
 class bsn_get_l2_table_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 14
 
     def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
@@ -731,19 +1208,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 14)
-        obj.l2_table_enable = reader.read('!B')[0]
+        obj.l2_table_enable = reader.read("!B")[0]
         reader.skip(1)
-        obj.l2_table_priority = reader.read('!H')[0]
+        obj.l2_table_priority = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -786,9 +1263,9 @@
         q.text('}')
 
 class bsn_get_l2_table_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 13
 
     def __init__(self, xid=None):
@@ -814,15 +1291,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 13)
         return obj
 
@@ -857,9 +1334,9 @@
         q.text('}')
 
 class bsn_get_mirroring_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 5
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -891,17 +1368,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 5)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -940,9 +1417,9 @@
         q.text('}')
 
 class bsn_get_mirroring_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 4
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -974,17 +1451,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 4)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1023,9 +1500,9 @@
         q.text('}')
 
 class bsn_set_ip_mask(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 0
 
     def __init__(self, xid=None, index=None, mask=None):
@@ -1062,19 +1539,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 0)
-        obj.index = reader.read('!B')[0]
+        obj.index = reader.read("!B")[0]
         reader.skip(3)
-        obj.mask = reader.read('!L')[0]
+        obj.mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1115,10 +1592,113 @@
             q.breakable()
         q.text('}')
 
-class bsn_set_l2_table(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+class bsn_set_l2_table_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 24
+
+    def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None):
+        self.xid = xid
+        if l2_table_enable != None:
+            self.l2_table_enable = l2_table_enable
+        else:
+            self.l2_table_enable = 0
+        if l2_table_priority != None:
+            self.l2_table_priority = l2_table_priority
+        else:
+            self.l2_table_priority = 0
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!B", self.l2_table_enable))
+        packed.append('\x00' * 1)
+        packed.append(struct.pack("!H", self.l2_table_priority))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_set_l2_table_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 24)
+        obj.l2_table_enable = reader.read("!B")[0]
+        reader.skip(1)
+        obj.l2_table_priority = reader.read("!H")[0]
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.l2_table_enable != other.l2_table_enable: return False
+        if self.l2_table_priority != other.l2_table_priority: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_set_l2_table_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("l2_table_enable = ");
+                q.text("%#x" % self.l2_table_enable)
+                q.text(","); q.breakable()
+                q.text("l2_table_priority = ");
+                q.text("%#x" % self.l2_table_priority)
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_set_l2_table_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 12
 
     def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None):
@@ -1151,24 +1731,24 @@
     @staticmethod
     def unpack(buf):
         if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
-        obj = bsn_set_l2_table()
+        obj = bsn_set_l2_table_request()
         if type(buf) == loxi.generic_util.OFReader:
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 12)
-        obj.l2_table_enable = reader.read('!B')[0]
+        obj.l2_table_enable = reader.read("!B")[0]
         reader.skip(1)
-        obj.l2_table_priority = reader.read('!H')[0]
+        obj.l2_table_priority = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -1192,7 +1772,7 @@
         return loxi.pp.pp(self)
 
     def pretty_print(self, q):
-        q.text("bsn_set_l2_table {")
+        q.text("bsn_set_l2_table_request {")
         with q.group():
             with q.indent(2):
                 q.breakable()
@@ -1211,9 +1791,9 @@
         q.text('}')
 
 class bsn_set_mirroring(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 3
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -1245,17 +1825,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 3)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1293,10 +1873,91 @@
             q.breakable()
         q.text('}')
 
-class bsn_set_pktin_suppression(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+class bsn_set_pktin_suppression_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 25
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_set_pktin_suppression_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 25)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_set_pktin_suppression_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_set_pktin_suppression_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 11
 
     def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
@@ -1343,27 +2004,27 @@
     @staticmethod
     def unpack(buf):
         if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
-        obj = bsn_set_pktin_suppression()
+        obj = bsn_set_pktin_suppression_request()
         if type(buf) == loxi.generic_util.OFReader:
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 11)
-        obj.enabled = reader.read('!B')[0]
+        obj.enabled = reader.read("!B")[0]
         reader.skip(1)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.cookie = reader.read('!Q')[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.cookie = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -1389,7 +2050,7 @@
         return loxi.pp.pp(self)
 
     def pretty_print(self, q):
-        q.text("bsn_set_pktin_suppression {")
+        q.text("bsn_set_pktin_suppression_request {")
         with q.group():
             with q.indent(2):
                 q.breakable()
@@ -1417,9 +2078,9 @@
         q.text('}')
 
 class bsn_shell_command(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 6
 
     def __init__(self, xid=None, service=None, data=None):
@@ -1431,7 +2092,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1455,17 +2116,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 6)
-        obj.service = reader.read('!L')[0]
+        obj.service = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1508,9 +2169,9 @@
         q.text('}')
 
 class bsn_shell_output(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 7
 
     def __init__(self, xid=None, data=None):
@@ -1518,7 +2179,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1541,15 +2202,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 7)
         obj.data = str(reader.read_all())
         return obj
@@ -1589,9 +2250,9 @@
         q.text('}')
 
 class bsn_shell_status(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x5c16c7
+    version = 1
+    type = 4
+    experimenter = 6035143
     subtype = 8
 
     def __init__(self, xid=None, status=None):
@@ -1622,17 +2283,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 8)
-        obj.status = reader.read('!L')[0]
+        obj.status = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1669,10 +2330,344 @@
             q.breakable()
         q.text('}')
 
+class bsn_virtual_port_create_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 16
+
+    def __init__(self, xid=None, status=None, vport_no=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 16)
+        obj.status = reader.read("!L")[0]
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_create_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 15
+
+    def __init__(self, xid=None, vport=None):
+        self.xid = xid
+        if vport != None:
+            self.vport = vport
+        else:
+            self.vport = common.bsn_vport_q_in_q()
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(self.vport.pack())
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 15)
+        obj.vport = common.bsn_vport_q_in_q.unpack(reader)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport != other.vport: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport = ");
+                q.pp(self.vport)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_reply(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 26
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 26)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_request(Message):
+    version = 1
+    type = 4
+    experimenter = 6035143
+    subtype = 17
+
+    def __init__(self, xid=None, vport_no=None):
+        self.xid = xid
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 17)
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
 class desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_DESC
+    version = 1
+    type = 17
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
         self.xid = xid
@@ -1726,15 +2721,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
         obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
         obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
@@ -1797,9 +2792,9 @@
         q.text('}')
 
 class desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_DESC
+    version = 1
+    type = 16
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -1828,15 +2823,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -1874,15 +2869,15 @@
         q.text('}')
 
 class echo_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REPLY
+    version = 1
+    type = 3
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1903,12 +2898,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 3)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1947,15 +2942,15 @@
         q.text('}')
 
 class echo_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REQUEST
+    version = 1
+    type = 2
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1976,12 +2971,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 2)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -2020,8 +3015,8 @@
         q.text('}')
 
 class error_msg(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ERROR
+    version = 1
+    type = 1
 
     def __init__(self, xid=None, err_type=None, code=None, data=None):
         self.xid = xid
@@ -2036,7 +3031,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -2059,14 +3054,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ERROR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.err_type = reader.read('!H')[0]
-        obj.code = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.err_type = reader.read("!H")[0]
+        obj.code = reader.read("!H")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -2113,9 +3108,9 @@
         q.text('}')
 
 class experimenter_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_VENDOR
+    version = 1
+    type = 17
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, data=None):
         self.xid = xid
@@ -2130,7 +3125,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -2154,16 +3149,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_VENDOR)
-        obj.flags = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -2210,9 +3205,9 @@
         q.text('}')
 
 class experimenter_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_VENDOR
+    version = 1
+    type = 16
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, data=None):
         self.xid = xid
@@ -2227,7 +3222,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -2251,16 +3246,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_VENDOR)
-        obj.flags = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -2307,8 +3302,8 @@
         q.text('}')
 
 class features_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REPLY
+    version = 1
+    type = 6
 
     def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None):
         self.xid = xid
@@ -2349,7 +3344,7 @@
         packed.append('\x00' * 3)
         packed.append(struct.pack("!L", self.capabilities))
         packed.append(struct.pack("!L", self.actions))
-        packed.append("".join([x.pack() for x in self.ports]))
+        packed.append(util.pack_list(self.ports))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2362,18 +3357,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.datapath_id = reader.read('!Q')[0]
-        obj.n_buffers = reader.read('!L')[0]
-        obj.n_tables = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 6)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.datapath_id = reader.read("!Q")[0]
+        obj.n_buffers = reader.read("!L")[0]
+        obj.n_tables = reader.read("!B")[0]
         reader.skip(3)
-        obj.capabilities = reader.read('!L')[0]
-        obj.actions = reader.read('!L')[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.actions = reader.read("!L")[0]
         obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
         return obj
 
@@ -2432,8 +3427,8 @@
         q.text('}')
 
 class features_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REQUEST
+    version = 1
+    type = 5
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -2456,12 +3451,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 5)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2495,9 +3490,9 @@
         q.text('}')
 
 class flow_add(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_ADD
+    version = 1
+    type = 14
+    _command = 0
 
     def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
         self.xid = xid
@@ -2546,14 +3541,14 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(self.match.pack())
         packed.append(struct.pack("!Q", self.cookie))
-        packed.append(struct.pack("!H", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!H", self.flags))
-        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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2566,22 +3561,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        __command = reader.read('!H')[0]
-        assert(__command == const.OFPFC_ADD)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
+        obj.cookie = reader.read("!Q")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 0)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.flags = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader)
         return obj
 
@@ -2652,9 +3647,9 @@
         q.text('}')
 
 class flow_delete(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE
+    version = 1
+    type = 14
+    _command = 3
 
     def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
         self.xid = xid
@@ -2703,14 +3698,14 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(self.match.pack())
         packed.append(struct.pack("!Q", self.cookie))
-        packed.append(struct.pack("!H", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!H", self.flags))
-        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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2723,22 +3718,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        __command = reader.read('!H')[0]
-        assert(__command == const.OFPFC_DELETE)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
+        obj.cookie = reader.read("!Q")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 3)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.flags = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader)
         return obj
 
@@ -2809,9 +3804,9 @@
         q.text('}')
 
 class flow_delete_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE_STRICT
+    version = 1
+    type = 14
+    _command = 4
 
     def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
         self.xid = xid
@@ -2860,14 +3855,14 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(self.match.pack())
         packed.append(struct.pack("!Q", self.cookie))
-        packed.append(struct.pack("!H", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!H", self.flags))
-        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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2880,22 +3875,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        __command = reader.read('!H')[0]
-        assert(__command == const.OFPFC_DELETE_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
+        obj.cookie = reader.read("!Q")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 4)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.flags = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader)
         return obj
 
@@ -2966,9 +3961,9 @@
         q.text('}')
 
 class flow_modify(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY
+    version = 1
+    type = 14
+    _command = 1
 
     def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
         self.xid = xid
@@ -3017,14 +4012,14 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(self.match.pack())
         packed.append(struct.pack("!Q", self.cookie))
-        packed.append(struct.pack("!H", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!H", self.flags))
-        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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3037,22 +4032,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        __command = reader.read('!H')[0]
-        assert(__command == const.OFPFC_MODIFY)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
+        obj.cookie = reader.read("!Q")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 1)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.flags = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader)
         return obj
 
@@ -3123,9 +4118,9 @@
         q.text('}')
 
 class flow_modify_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY_STRICT
+    version = 1
+    type = 14
+    _command = 2
 
     def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None):
         self.xid = xid
@@ -3174,14 +4169,14 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(self.match.pack())
         packed.append(struct.pack("!Q", self.cookie))
-        packed.append(struct.pack("!H", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!H", self.flags))
-        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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3194,22 +4189,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        __command = reader.read('!H')[0]
-        assert(__command == const.OFPFC_MODIFY_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
+        obj.cookie = reader.read("!Q")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 2)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.flags = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader)
         return obj
 
@@ -3280,8 +4275,8 @@
         q.text('}')
 
 class flow_removed(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_REMOVED
+    version = 1
+    type = 11
 
     def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None):
         self.xid = xid
@@ -3351,23 +4346,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_REMOVED)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 11)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.match = common.match.unpack(reader)
-        obj.cookie = reader.read('!Q')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
         reader.skip(1)
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
-        obj.idle_timeout = reader.read('!H')[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
+        obj.idle_timeout = reader.read("!H")[0]
         reader.skip(2)
-        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):
@@ -3437,9 +4432,9 @@
         q.text('}')
 
 class flow_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_FLOW
+    version = 1
+    type = 17
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -3460,7 +4455,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3473,15 +4468,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         obj.entries = common.unpack_list_flow_stats_entry(reader)
         return obj
 
@@ -3524,9 +4519,9 @@
         q.text('}')
 
 class flow_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_FLOW
+    version = 1
+    type = 16
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None):
         self.xid = xid
@@ -3558,7 +4553,7 @@
         packed.append(self.match.pack())
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 1)
-        packed.append(struct.pack("!H", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3571,19 +4566,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         obj.match = common.match.unpack(reader)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(1)
-        obj.out_port = reader.read('!H')[0]
+        obj.out_port = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -3633,8 +4628,8 @@
         q.text('}')
 
 class get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REPLY
+    version = 1
+    type = 8
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -3667,14 +4662,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 8)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3716,8 +4711,8 @@
         q.text('}')
 
 class get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REQUEST
+    version = 1
+    type = 7
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3740,12 +4735,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 7)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3779,8 +4774,8 @@
         q.text('}')
 
 class hello(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_HELLO
+    version = 1
+    type = 0
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3803,12 +4798,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_HELLO)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3842,9 +4837,9 @@
         q.text('}')
 
 class nicira_controller_role_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x2320
+    version = 1
+    type = 4
+    experimenter = 8992
     subtype = 11
 
     def __init__(self, xid=None, role=None):
@@ -3875,17 +4870,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 11)
-        obj.role = reader.read('!L')[0]
+        obj.role = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3923,9 +4918,9 @@
         q.text('}')
 
 class nicira_controller_role_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_VENDOR
-    experimenter = 0x2320
+    version = 1
+    type = 4
+    experimenter = 8992
     subtype = 10
 
     def __init__(self, xid=None, role=None):
@@ -3956,17 +4951,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_VENDOR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 10)
-        obj.role = reader.read('!L')[0]
+        obj.role = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4004,8 +4999,8 @@
         q.text('}')
 
 class packet_in(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_IN
+    version = 1
+    type = 10
 
     def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None):
         self.xid = xid
@@ -4028,7 +5023,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -4038,7 +5033,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
         packed.append(struct.pack("!H", self.total_len))
-        packed.append(struct.pack("!H", self.in_port))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!B", self.reason))
         packed.append('\x00' * 1)
         packed.append(self.data)
@@ -4054,16 +5049,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_IN)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.total_len = reader.read('!H')[0]
-        obj.in_port = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 10)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.total_len = reader.read("!H")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        obj.reason = reader.read("!B")[0]
         reader.skip(1)
         obj.data = str(reader.read_all())
         return obj
@@ -4119,8 +5114,8 @@
         q.text('}')
 
 class packet_out(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_OUT
+    version = 1
+    type = 13
 
     def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
         self.xid = xid
@@ -4139,7 +5134,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -4148,9 +5143,9 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!H", self.in_port))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
-        packed.append("".join([x.pack() for x in self.actions]))
+        packed.append(util.pack_list(self.actions))
         packed[6] = struct.pack("!H", len(packed[-1]))
         packed.append(self.data)
         length = sum([len(x) for x in packed])
@@ -4165,15 +5160,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_OUT)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.in_port = reader.read('!H')[0]
-        _actions_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 13)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        _actions_len = reader.read("!H")[0]
         obj.actions = action.unpack_list(reader.slice(_actions_len))
         obj.data = str(reader.read_all())
         return obj
@@ -4225,8 +5220,8 @@
         q.text('}')
 
 class port_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_MOD
+    version = 1
+    type = 15
 
     def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
         self.xid = xid
@@ -4257,7 +5252,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append(struct.pack("!6B", *self.hw_addr))
         packed.append(struct.pack("!L", self.config))
         packed.append(struct.pack("!L", self.mask))
@@ -4275,17 +5270,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port_no = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 15)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port_no = util.unpack_port_no(reader)
         obj.hw_addr = list(reader.read('!6B'))
-        obj.config = reader.read('!L')[0]
-        obj.mask = reader.read('!L')[0]
-        obj.advertise = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
+        obj.mask = reader.read("!L")[0]
+        obj.advertise = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4340,9 +5335,9 @@
         q.text('}')
 
 class port_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_PORT
+    version = 1
+    type = 17
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4363,7 +5358,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4376,15 +5371,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
         obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
         return obj
 
@@ -4427,9 +5422,9 @@
         q.text('}')
 
 class port_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_PORT
+    version = 1
+    type = 16
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, port_no=None):
         self.xid = xid
@@ -4450,7 +5445,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 6)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4464,16 +5459,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
-        obj.port_no = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(6)
         return obj
 
@@ -4516,8 +5511,8 @@
         q.text('}')
 
 class port_status(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_STATUS
+    version = 1
+    type = 12
 
     def __init__(self, xid=None, reason=None, desc=None):
         self.xid = xid
@@ -4551,13 +5546,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_STATUS)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.reason = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 12)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.reason = reader.read("!B")[0]
         reader.skip(7)
         obj.desc = common.port_desc.unpack(reader)
         return obj
@@ -4601,8 +5596,8 @@
         q.text('}')
 
 class queue_get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REPLY
+    version = 1
+    type = 21
 
     def __init__(self, xid=None, port=None, queues=None):
         self.xid = xid
@@ -4621,9 +5616,9 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!H", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 6)
-        packed.append("".join([x.pack() for x in self.queues]))
+        packed.append(util.pack_list(self.queues))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4636,13 +5631,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 21)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(6)
         obj.queues = common.unpack_list_packet_queue(reader)
         return obj
@@ -4686,8 +5681,8 @@
         q.text('}')
 
 class queue_get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REQUEST
+    version = 1
+    type = 20
 
     def __init__(self, xid=None, port=None):
         self.xid = xid
@@ -4702,7 +5697,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!H", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 2)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4716,13 +5711,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 20)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(2)
         return obj
 
@@ -4761,9 +5756,9 @@
         q.text('}')
 
 class queue_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_QUEUE
+    version = 1
+    type = 17
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4784,7 +5779,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4797,15 +5792,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
         obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
         return obj
 
@@ -4848,9 +5843,9 @@
         q.text('}')
 
 class queue_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_QUEUE
+    version = 1
+    type = 16
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
         self.xid = xid
@@ -4875,7 +5870,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append(struct.pack("!H", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 2)
         packed.append(struct.pack("!L", self.queue_id))
         length = sum([len(x) for x in packed])
@@ -4890,18 +5885,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
-        obj.port_no = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(2)
-        obj.queue_id = reader.read('!L')[0]
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4947,8 +5942,8 @@
         q.text('}')
 
 class set_config(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_SET_CONFIG
+    version = 1
+    type = 9
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -4981,14 +5976,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_SET_CONFIG)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 9)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -5030,7 +6025,7 @@
         q.text('}')
 
 class table_mod(Message):
-    version = const.OFP_VERSION
+    version = 1
     type = 22
 
     def __init__(self, xid=None, table_id=None, config=None):
@@ -5065,15 +6060,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
         assert(_type == 22)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.table_id = reader.read('!B')[0]
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.config = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -5115,9 +6110,9 @@
         q.text('}')
 
 class table_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_TABLE
+    version = 1
+    type = 17
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -5138,7 +6133,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5151,15 +6146,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
         return obj
 
@@ -5202,9 +6197,9 @@
         q.text('}')
 
 class table_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_TABLE
+    version = 1
+    type = 16
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -5233,15 +6228,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 1)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -5340,29 +6335,29 @@
         raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
 
 parsers = {
-    22 : table_mod.unpack,
-    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
-    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
-    const.OFPT_ECHO_REPLY : echo_reply.unpack,
-    const.OFPT_ECHO_REQUEST : echo_request.unpack,
-    const.OFPT_ERROR : error_msg.unpack,
-    const.OFPT_FEATURES_REPLY : features_reply.unpack,
-    const.OFPT_FEATURES_REQUEST : features_request.unpack,
-    const.OFPT_FLOW_MOD : parse_flow_mod,
-    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
-    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
-    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
     const.OFPT_HELLO : hello.unpack,
-    const.OFPT_PACKET_IN : packet_in.unpack,
-    const.OFPT_PACKET_OUT : packet_out.unpack,
-    const.OFPT_PORT_MOD : port_mod.unpack,
-    const.OFPT_PORT_STATUS : port_status.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
-    const.OFPT_SET_CONFIG : set_config.unpack,
-    const.OFPT_STATS_REPLY : parse_stats_reply,
-    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_ERROR : error_msg.unpack,
+    const.OFPT_ECHO_REQUEST : echo_request.unpack,
+    const.OFPT_ECHO_REPLY : echo_reply.unpack,
     const.OFPT_VENDOR : parse_vendor,
+    const.OFPT_FEATURES_REQUEST : features_request.unpack,
+    const.OFPT_FEATURES_REPLY : features_reply.unpack,
+    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
+    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
+    const.OFPT_SET_CONFIG : set_config.unpack,
+    const.OFPT_PACKET_IN : packet_in.unpack,
+    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
+    const.OFPT_PORT_STATUS : port_status.unpack,
+    const.OFPT_PACKET_OUT : packet_out.unpack,
+    const.OFPT_FLOW_MOD : parse_flow_mod,
+    const.OFPT_PORT_MOD : port_mod.unpack,
+    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_STATS_REPLY : parse_stats_reply,
+    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
+    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
+    22 : table_mod.unpack,
 }
 
 flow_mod_parsers = {
@@ -5394,11 +6389,17 @@
 }
 
 experimenter_parsers = {
-    0x2320 : {
+    8992 : {
         11: nicira_controller_role_reply.unpack,
         10: nicira_controller_role_request.unpack,
     },
-    0x5c16c7 : {
+    6035143 : {
+        22: bsn_bw_clear_data_reply.unpack,
+        21: bsn_bw_clear_data_request.unpack,
+        20: bsn_bw_enable_get_reply.unpack,
+        19: bsn_bw_enable_get_request.unpack,
+        23: bsn_bw_enable_set_reply.unpack,
+        18: bsn_bw_enable_set_request.unpack,
         10: bsn_get_interfaces_reply.unpack,
         9: bsn_get_interfaces_request.unpack,
         2: bsn_get_ip_mask_reply.unpack,
@@ -5408,11 +6409,17 @@
         5: bsn_get_mirroring_reply.unpack,
         4: bsn_get_mirroring_request.unpack,
         0: bsn_set_ip_mask.unpack,
-        12: bsn_set_l2_table.unpack,
+        24: bsn_set_l2_table_reply.unpack,
+        12: bsn_set_l2_table_request.unpack,
         3: bsn_set_mirroring.unpack,
-        11: bsn_set_pktin_suppression.unpack,
+        25: bsn_set_pktin_suppression_reply.unpack,
+        11: bsn_set_pktin_suppression_request.unpack,
         6: bsn_shell_command.unpack,
         7: bsn_shell_output.unpack,
         8: bsn_shell_status.unpack,
+        16: bsn_virtual_port_create_reply.unpack,
+        15: bsn_virtual_port_create_request.unpack,
+        26: bsn_virtual_port_remove_reply.unpack,
+        17: bsn_virtual_port_remove_request.unpack,
     },
 }
diff --git a/src/python/loxi/of10/util.py b/src/python/loxi/of10/util.py
index 45aa2d0..de54fa8 100644
--- a/src/python/loxi/of10/util.py
+++ b/src/python/loxi/of10/util.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 util.py
 # Do not modify
@@ -43,3 +44,36 @@
         if v == v2:
             return k
     return v
+
+def pack_port_no(value):
+    return struct.pack("!H", value)
+
+def unpack_port_no(reader):
+    return reader.read("!H")[0]
+
+def pack_fm_cmd(value):
+    return struct.pack("!H", value)
+
+def unpack_fm_cmd(reader):
+    return reader.read("!H")[0]
+
+def init_wc_bmap():
+    return const.OFPFW_ALL
+
+def pack_wc_bmap(value):
+    return struct.pack("!L", value)
+
+def unpack_wc_bmap(reader):
+    return reader.read("!L")[0]
+
+def init_match_bmap():
+    return const.OFPFW_ALL
+
+def pack_match_bmap(value):
+    return struct.pack("!L", value)
+
+def unpack_match_bmap(reader):
+    return reader.read("!L")[0]
+
+def pack_list(values):
+    return "".join([x.pack() for x in values])
diff --git a/src/python/loxi/of11/__init__.py b/src/python/loxi/of11/__init__.py
index edb9e20..e24e54a 100644
--- a/src/python/loxi/of11/__init__.py
+++ b/src/python/loxi/of11/__init__.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 init.py
 # Do not modify
diff --git a/src/python/loxi/of11/action.py b/src/python/loxi/of11/action.py
index 7853607..44a3b70 100644
--- a/src/python/loxi/of11/action.py
+++ b/src/python/loxi/of11/action.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 action.py
 # Do not modify
@@ -23,8 +24,8 @@
     pass
 
 class bsn_mirror(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 1
 
     def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
@@ -63,16 +64,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 1)
-        obj.dest_port = reader.read('!L')[0]
-        obj.vlan_tag = reader.read('!L')[0]
-        obj.copy_stage = reader.read('!B')[0]
+        obj.dest_port = reader.read("!L")[0]
+        obj.vlan_tag = reader.read("!L")[0]
+        obj.copy_stage = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -107,8 +108,8 @@
         q.text('}')
 
 class bsn_set_tunnel_dst(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 2
 
     def __init__(self, dst=None):
@@ -136,14 +137,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 2)
-        obj.dst = reader.read('!L')[0]
+        obj.dst = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -169,7 +170,7 @@
         q.text('}')
 
 class copy_ttl_in(Action):
-    type = const.OFPAT_COPY_TTL_IN
+    type = 12
 
     def __init__(self):
         return
@@ -190,9 +191,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_IN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 12)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -216,7 +217,7 @@
         q.text('}')
 
 class copy_ttl_out(Action):
-    type = const.OFPAT_COPY_TTL_OUT
+    type = 11
 
     def __init__(self):
         return
@@ -237,9 +238,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_OUT)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 11)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -263,7 +264,7 @@
         q.text('}')
 
 class dec_mpls_ttl(Action):
-    type = const.OFPAT_DEC_MPLS_TTL
+    type = 16
 
     def __init__(self):
         return
@@ -284,9 +285,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_MPLS_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 16)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -310,7 +311,7 @@
         q.text('}')
 
 class dec_nw_ttl(Action):
-    type = const.OFPAT_DEC_NW_TTL
+    type = 24
 
     def __init__(self):
         return
@@ -331,9 +332,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_NW_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 24)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -357,7 +358,7 @@
         q.text('}')
 
 class group(Action):
-    type = const.OFPAT_GROUP
+    type = 22
 
     def __init__(self, group_id=None):
         if group_id != None:
@@ -382,10 +383,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_GROUP)
-        _len = reader.read('!H')[0]
-        obj.group_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 22)
+        _len = reader.read("!H")[0]
+        obj.group_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -411,8 +412,8 @@
         q.text('}')
 
 class nicira_dec_ttl(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x2320
+    type = 65535
+    experimenter = 8992
     subtype = 18
 
     def __init__(self):
@@ -437,12 +438,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!H")[0]
         assert(_subtype == 18)
         reader.skip(2)
         reader.skip(4)
@@ -468,7 +469,7 @@
         q.text('}')
 
 class output(Action):
-    type = const.OFPAT_OUTPUT
+    type = 0
 
     def __init__(self, port=None, max_len=None):
         if port != None:
@@ -485,7 +486,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append(struct.pack("!H", self.max_len))
         packed.append('\x00' * 6)
         length = sum([len(x) for x in packed])
@@ -499,11 +500,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_OUTPUT)
-        _len = reader.read('!H')[0]
-        obj.port = reader.read('!L')[0]
-        obj.max_len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _len = reader.read("!H")[0]
+        obj.port = util.unpack_port_no(reader)
+        obj.max_len = reader.read("!H")[0]
         reader.skip(6)
         return obj
 
@@ -534,7 +535,7 @@
         q.text('}')
 
 class pop_mpls(Action):
-    type = const.OFPAT_POP_MPLS
+    type = 20
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -560,10 +561,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 20)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -590,7 +591,7 @@
         q.text('}')
 
 class pop_vlan(Action):
-    type = const.OFPAT_POP_VLAN
+    type = 18
 
     def __init__(self):
         return
@@ -611,9 +612,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_VLAN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 18)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -637,7 +638,7 @@
         q.text('}')
 
 class push_mpls(Action):
-    type = const.OFPAT_PUSH_MPLS
+    type = 19
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -663,10 +664,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 19)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -693,7 +694,7 @@
         q.text('}')
 
 class push_vlan(Action):
-    type = const.OFPAT_PUSH_VLAN
+    type = 17
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -719,10 +720,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_VLAN)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 17)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -749,7 +750,7 @@
         q.text('}')
 
 class set_dl_dst(Action):
-    type = const.OFPAT_SET_DL_DST
+    type = 4
 
     def __init__(self, dl_addr=None):
         if dl_addr != None:
@@ -775,9 +776,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_DL_DST)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _len = reader.read("!H")[0]
         obj.dl_addr = list(reader.read('!6B'))
         reader.skip(6)
         return obj
@@ -805,7 +806,7 @@
         q.text('}')
 
 class set_dl_src(Action):
-    type = const.OFPAT_SET_DL_SRC
+    type = 3
 
     def __init__(self, dl_addr=None):
         if dl_addr != None:
@@ -831,9 +832,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_DL_SRC)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _len = reader.read("!H")[0]
         obj.dl_addr = list(reader.read('!6B'))
         reader.skip(6)
         return obj
@@ -861,7 +862,7 @@
         q.text('}')
 
 class set_mpls_label(Action):
-    type = const.OFPAT_SET_MPLS_LABEL
+    type = 13
 
     def __init__(self, mpls_label=None):
         if mpls_label != None:
@@ -886,10 +887,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_MPLS_LABEL)
-        _len = reader.read('!H')[0]
-        obj.mpls_label = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 13)
+        _len = reader.read("!H")[0]
+        obj.mpls_label = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -915,7 +916,7 @@
         q.text('}')
 
 class set_mpls_tc(Action):
-    type = const.OFPAT_SET_MPLS_TC
+    type = 14
 
     def __init__(self, mpls_tc=None):
         if mpls_tc != None:
@@ -941,10 +942,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_MPLS_TC)
-        _len = reader.read('!H')[0]
-        obj.mpls_tc = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 14)
+        _len = reader.read("!H")[0]
+        obj.mpls_tc = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -971,7 +972,7 @@
         q.text('}')
 
 class set_mpls_ttl(Action):
-    type = const.OFPAT_SET_MPLS_TTL
+    type = 15
 
     def __init__(self, mpls_ttl=None):
         if mpls_ttl != None:
@@ -997,10 +998,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_MPLS_TTL)
-        _len = reader.read('!H')[0]
-        obj.mpls_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 15)
+        _len = reader.read("!H")[0]
+        obj.mpls_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1027,7 +1028,7 @@
         q.text('}')
 
 class set_nw_dst(Action):
-    type = const.OFPAT_SET_NW_DST
+    type = 6
 
     def __init__(self, nw_addr=None):
         if nw_addr != None:
@@ -1052,10 +1053,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_DST)
-        _len = reader.read('!H')[0]
-        obj.nw_addr = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 6)
+        _len = reader.read("!H")[0]
+        obj.nw_addr = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1081,7 +1082,7 @@
         q.text('}')
 
 class set_nw_ecn(Action):
-    type = const.OFPAT_SET_NW_ECN
+    type = 8
 
     def __init__(self, nw_ecn=None):
         if nw_ecn != None:
@@ -1107,10 +1108,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_ECN)
-        _len = reader.read('!H')[0]
-        obj.nw_ecn = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 8)
+        _len = reader.read("!H")[0]
+        obj.nw_ecn = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1137,7 +1138,7 @@
         q.text('}')
 
 class set_nw_src(Action):
-    type = const.OFPAT_SET_NW_SRC
+    type = 5
 
     def __init__(self, nw_addr=None):
         if nw_addr != None:
@@ -1162,10 +1163,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_SRC)
-        _len = reader.read('!H')[0]
-        obj.nw_addr = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _len = reader.read("!H")[0]
+        obj.nw_addr = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1191,7 +1192,7 @@
         q.text('}')
 
 class set_nw_tos(Action):
-    type = const.OFPAT_SET_NW_TOS
+    type = 7
 
     def __init__(self, nw_tos=None):
         if nw_tos != None:
@@ -1217,10 +1218,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_TOS)
-        _len = reader.read('!H')[0]
-        obj.nw_tos = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 7)
+        _len = reader.read("!H")[0]
+        obj.nw_tos = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1247,7 +1248,7 @@
         q.text('}')
 
 class set_nw_ttl(Action):
-    type = const.OFPAT_SET_NW_TTL
+    type = 23
 
     def __init__(self, nw_ttl=None):
         if nw_ttl != None:
@@ -1273,10 +1274,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_TTL)
-        _len = reader.read('!H')[0]
-        obj.nw_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 23)
+        _len = reader.read("!H")[0]
+        obj.nw_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1303,7 +1304,7 @@
         q.text('}')
 
 class set_queue(Action):
-    type = const.OFPAT_SET_QUEUE
+    type = 21
 
     def __init__(self, queue_id=None):
         if queue_id != None:
@@ -1328,10 +1329,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_QUEUE)
-        _len = reader.read('!H')[0]
-        obj.queue_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 21)
+        _len = reader.read("!H")[0]
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1357,7 +1358,7 @@
         q.text('}')
 
 class set_tp_dst(Action):
-    type = const.OFPAT_SET_TP_DST
+    type = 10
 
     def __init__(self, tp_port=None):
         if tp_port != None:
@@ -1383,10 +1384,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_TP_DST)
-        _len = reader.read('!H')[0]
-        obj.tp_port = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 10)
+        _len = reader.read("!H")[0]
+        obj.tp_port = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -1413,7 +1414,7 @@
         q.text('}')
 
 class set_tp_src(Action):
-    type = const.OFPAT_SET_TP_SRC
+    type = 9
 
     def __init__(self, tp_port=None):
         if tp_port != None:
@@ -1439,10 +1440,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_TP_SRC)
-        _len = reader.read('!H')[0]
-        obj.tp_port = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 9)
+        _len = reader.read("!H")[0]
+        obj.tp_port = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -1469,7 +1470,7 @@
         q.text('}')
 
 class set_vlan_pcp(Action):
-    type = const.OFPAT_SET_VLAN_PCP
+    type = 2
 
     def __init__(self, vlan_pcp=None):
         if vlan_pcp != None:
@@ -1495,10 +1496,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_VLAN_PCP)
-        _len = reader.read('!H')[0]
-        obj.vlan_pcp = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
+        obj.vlan_pcp = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1525,7 +1526,7 @@
         q.text('}')
 
 class set_vlan_vid(Action):
-    type = const.OFPAT_SET_VLAN_VID
+    type = 1
 
     def __init__(self, vlan_vid=None):
         if vlan_vid != None:
@@ -1551,10 +1552,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_VLAN_VID)
-        _len = reader.read('!H')[0]
-        obj.vlan_vid = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.vlan_vid = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -1597,33 +1598,40 @@
         raise loxi.ProtocolError("unexpected BSN experimenter subtype %#x" % subtype)
 
 parsers = {
-    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
-    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
-    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
-    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
-    const.OFPAT_EXPERIMENTER : parse_experimenter,
-    const.OFPAT_GROUP : group.unpack,
     const.OFPAT_OUTPUT : output.unpack,
-    const.OFPAT_POP_MPLS : pop_mpls.unpack,
-    const.OFPAT_POP_VLAN : pop_vlan.unpack,
-    const.OFPAT_PUSH_MPLS : push_mpls.unpack,
-    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
-    const.OFPAT_SET_DL_DST : set_dl_dst.unpack,
+    const.OFPAT_SET_VLAN_VID : set_vlan_vid.unpack,
+    const.OFPAT_SET_VLAN_PCP : set_vlan_pcp.unpack,
     const.OFPAT_SET_DL_SRC : set_dl_src.unpack,
+    const.OFPAT_SET_DL_DST : set_dl_dst.unpack,
+    const.OFPAT_SET_NW_SRC : set_nw_src.unpack,
+    const.OFPAT_SET_NW_DST : set_nw_dst.unpack,
+    const.OFPAT_SET_NW_TOS : set_nw_tos.unpack,
+    const.OFPAT_SET_NW_ECN : set_nw_ecn.unpack,
+    const.OFPAT_SET_TP_SRC : set_tp_src.unpack,
+    const.OFPAT_SET_TP_DST : set_tp_dst.unpack,
+    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
+    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
     const.OFPAT_SET_MPLS_LABEL : set_mpls_label.unpack,
     const.OFPAT_SET_MPLS_TC : set_mpls_tc.unpack,
     const.OFPAT_SET_MPLS_TTL : set_mpls_ttl.unpack,
-    const.OFPAT_SET_NW_DST : set_nw_dst.unpack,
-    const.OFPAT_SET_NW_ECN : set_nw_ecn.unpack,
-    const.OFPAT_SET_NW_SRC : set_nw_src.unpack,
-    const.OFPAT_SET_NW_TOS : set_nw_tos.unpack,
-    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
+    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
+    const.OFPAT_POP_VLAN : pop_vlan.unpack,
+    const.OFPAT_PUSH_MPLS : push_mpls.unpack,
+    const.OFPAT_POP_MPLS : pop_mpls.unpack,
     const.OFPAT_SET_QUEUE : set_queue.unpack,
-    const.OFPAT_SET_TP_DST : set_tp_dst.unpack,
-    const.OFPAT_SET_TP_SRC : set_tp_src.unpack,
-    const.OFPAT_SET_VLAN_PCP : set_vlan_pcp.unpack,
-    const.OFPAT_SET_VLAN_VID : set_vlan_vid.unpack,
+    const.OFPAT_GROUP : group.unpack,
+    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
+    const.OFPAT_EXPERIMENTER : parse_experimenter,
 }
 
 experimenter_parsers = {
+    8992 : {
+        18: nicira_dec_ttl.unpack,
+    },
+    6035143 : {
+        1: bsn_mirror.unpack,
+        2: bsn_set_tunnel_dst.unpack,
+    },
 }
diff --git a/src/python/loxi/of11/common.py b/src/python/loxi/of11/common.py
index 138d451..969b561 100644
--- a/src/python/loxi/of11/common.py
+++ b/src/python/loxi/of11/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
@@ -97,8 +98,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):
@@ -135,6 +136,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):
@@ -160,10 +255,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)
@@ -175,10 +270,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
@@ -243,8 +338,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):
@@ -337,7 +432,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)
@@ -349,18 +444,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
@@ -450,7 +545,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)
@@ -462,10 +557,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
 
@@ -533,7 +628,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)
@@ -545,13 +640,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
 
@@ -604,7 +699,7 @@
         if wildcards != None:
             self.wildcards = wildcards
         else:
-            self.wildcards = const.OFPFW_ALL
+            self.wildcards = util.init_wc_bmap()
         if eth_src != None:
             self.eth_src = eth_src
         else:
@@ -687,8 +782,8 @@
         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.in_port))
-        packed.append(struct.pack("!L", self.wildcards))
+        packed.append(util.pack_port_no(self.in_port))
+        packed.append(util.pack_wc_bmap(self.wildcards))
         packed.append(struct.pack("!6B", *self.eth_src))
         packed.append(struct.pack("!6B", *self.eth_src_mask))
         packed.append(struct.pack("!6B", *self.eth_dst))
@@ -721,32 +816,32 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
         assert(_type == 0)
-        _length = reader.read('!H')[0]
-        obj.in_port = reader.read('!L')[0]
-        obj.wildcards = reader.read('!L')[0]
+        _length = reader.read("!H")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        obj.wildcards = util.unpack_wc_bmap(reader)
         obj.eth_src = list(reader.read('!6B'))
         obj.eth_src_mask = list(reader.read('!6B'))
         obj.eth_dst = list(reader.read('!6B'))
         obj.eth_dst_mask = list(reader.read('!6B'))
-        obj.vlan_vid = reader.read('!H')[0]
-        obj.vlan_pcp = reader.read('!B')[0]
+        obj.vlan_vid = reader.read("!H")[0]
+        obj.vlan_pcp = reader.read("!B")[0]
         reader.skip(1)
-        obj.eth_type = reader.read('!H')[0]
-        obj.ip_dscp = reader.read('!B')[0]
-        obj.ip_proto = reader.read('!B')[0]
-        obj.ipv4_src = reader.read('!L')[0]
-        obj.ipv4_src_mask = reader.read('!L')[0]
-        obj.ipv4_dst = reader.read('!L')[0]
-        obj.ipv4_dst_mask = reader.read('!L')[0]
-        obj.tcp_src = reader.read('!H')[0]
-        obj.tcp_dst = reader.read('!H')[0]
-        obj.mpls_label = reader.read('!L')[0]
-        obj.mpls_tc = reader.read('!B')[0]
+        obj.eth_type = reader.read("!H")[0]
+        obj.ip_dscp = reader.read("!B")[0]
+        obj.ip_proto = reader.read("!B")[0]
+        obj.ipv4_src = reader.read("!L")[0]
+        obj.ipv4_src_mask = reader.read("!L")[0]
+        obj.ipv4_dst = reader.read("!L")[0]
+        obj.ipv4_dst_mask = reader.read("!L")[0]
+        obj.tcp_src = reader.read("!H")[0]
+        obj.tcp_dst = reader.read("!H")[0]
+        obj.mpls_label = reader.read("!L")[0]
+        obj.mpls_tc = reader.read("!B")[0]
         reader.skip(3)
-        obj.metadata = reader.read('!Q')[0]
-        obj.metadata_mask = reader.read('!Q')[0]
+        obj.metadata = reader.read("!Q")[0]
+        obj.metadata_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -869,7 +964,7 @@
         packed.append(struct.pack("!L", self.queue_id))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         packed.append('\x00' * 2)
-        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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -881,8 +976,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.queue_id = reader.read('!L')[0]
-        _len = reader.read('!H')[0]
+        obj.queue_id = reader.read("!L")[0]
+        _len = reader.read("!H")[0]
         reader.skip(2)
         obj.properties = common.unpack_list_queue_prop(reader)
         return obj
@@ -964,7 +1059,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)
@@ -986,19 +1081,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):
@@ -1122,7 +1217,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))
@@ -1145,20 +1240,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):
@@ -1232,7 +1327,7 @@
         q.text('}')
 
 class queue_prop_min_rate(object):
-    type = const.OFPQT_MIN_RATE
+    type = 1
 
     def __init__(self, rate=None):
         if rate != None:
@@ -1259,11 +1354,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
 
@@ -1316,7 +1411,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))
@@ -1330,11 +1425,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):
@@ -1389,11 +1484,11 @@
         if wildcards != None:
             self.wildcards = wildcards
         else:
-            self.wildcards = const.OFPFW_ALL
+            self.wildcards = util.init_wc_bmap()
         if match != None:
             self.match = match
         else:
-            self.match = const.OFPFW_ALL
+            self.match = util.init_match_bmap()
         if instructions != None:
             self.instructions = instructions
         else:
@@ -1433,8 +1528,8 @@
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 7)
         packed.append(struct.pack("!32s", self.name))
-        packed.append(struct.pack("!L", self.wildcards))
-        packed.append(struct.pack("!L", self.match))
+        packed.append(util.pack_wc_bmap(self.wildcards))
+        packed.append(util.pack_match_bmap(self.match))
         packed.append(struct.pack("!L", self.instructions))
         packed.append(struct.pack("!L", self.write_actions))
         packed.append(struct.pack("!L", self.apply_actions))
@@ -1452,19 +1547,19 @@
             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.wildcards = reader.read('!L')[0]
-        obj.match = reader.read('!L')[0]
-        obj.instructions = reader.read('!L')[0]
-        obj.write_actions = reader.read('!L')[0]
-        obj.apply_actions = 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.wildcards = util.unpack_wc_bmap(reader)
+        obj.match = util.unpack_match_bmap(reader)
+        obj.instructions = reader.read("!L")[0]
+        obj.write_actions = reader.read("!L")[0]
+        obj.apply_actions = 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):
diff --git a/src/python/loxi/of11/const.py b/src/python/loxi/of11/const.py
index b6cca94..bd0fd11 100644
--- a/src/python/loxi/of11/const.py
+++ b/src/python/loxi/of11/const.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 const.py
 # Do not modify
@@ -8,24 +9,24 @@
 OFP_VERSION = 2
 
 # Identifiers from group macro_definitions
-OFP_VLAN_NONE = 0
-OFP_FLOW_PERMANENT = 0
-OFP_ETH_ALEN = 6
-OFP_MAX_PORT_NAME_LEN = 16
 OFP_MAX_TABLE_NAME_LEN = 32
-SERIAL_NUM_LEN = 32
-OFPFW_ICMP_TYPE = 64
-OFPMT_STANDARD_LENGTH = 88
-OFP_DEFAULT_MISS_SEND_LEN = 128
-OFPFW_ICMP_CODE = 128
-DESC_STR_LEN = 256
-OFP_DL_TYPE_NOT_ETH_TYPE = 1535
-OFP_DL_TYPE_ETH2_CUTOFF = 1536
+OFP_MAX_PORT_NAME_LEN = 16
 OFP_TCP_PORT = 6633
 OFP_SSL_PORT = 6633
+OFP_ETH_ALEN = 6
+OFP_DEFAULT_MISS_SEND_LEN = 128
+OFPFW_ICMP_TYPE = 64
+OFPFW_ICMP_CODE = 128
+OFP_DL_TYPE_ETH2_CUTOFF = 1536
+OFP_DL_TYPE_NOT_ETH_TYPE = 1535
+OFP_VLAN_NONE = 0
+OFPMT_STANDARD_LENGTH = 88
+OFP_FLOW_PERMANENT = 0
 OFP_DEFAULT_PRIORITY = 32768
-OFPQ_MIN_RATE_UNCFG = 65535
+DESC_STR_LEN = 256
+SERIAL_NUM_LEN = 32
 OFPQ_ALL = 4294967295
+OFPQ_MIN_RATE_UNCFG = 65535
 
 # Identifiers from group ofp_action_type
 OFPAT_OUTPUT = 0
@@ -178,6 +179,13 @@
     9: 'OFPBRC_BAD_TABLE_ID',
 }
 
+# Identifiers from group ofp_bsn_vport_q_in_q_untagged
+OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 65535
+
+ofp_bsn_vport_q_in_q_untagged_map = {
+    65535: 'OF_BSN_VPORT_Q_IN_Q_UNTAGGED',
+}
+
 # Identifiers from group ofp_capabilities
 OFPC_FLOW_STATS = 1
 OFPC_TABLE_STATS = 2
diff --git a/src/python/loxi/of11/instruction.py b/src/python/loxi/of11/instruction.py
index 52ee289..961f3c6 100644
--- a/src/python/loxi/of11/instruction.py
+++ b/src/python/loxi/of11/instruction.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 instruction.py
 # Do not modify
@@ -24,7 +25,7 @@
     pass
 
 class apply_actions(Instruction):
-    type = const.OFPIT_APPLY_ACTIONS
+    type = 4
 
     def __init__(self, actions=None):
         if actions != None:
@@ -38,7 +39,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -50,9 +51,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_APPLY_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -80,7 +81,7 @@
         q.text('}')
 
 class clear_actions(Instruction):
-    type = const.OFPIT_CLEAR_ACTIONS
+    type = 5
 
     def __init__(self):
         return
@@ -101,9 +102,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_CLEAR_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -127,7 +128,7 @@
         q.text('}')
 
 class experimenter(Instruction):
-    type = const.OFPIT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, experimenter=None, data=None):
         if experimenter != None:
@@ -137,7 +138,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
         return
 
     def pack(self):
@@ -157,10 +158,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -191,7 +192,7 @@
         q.text('}')
 
 class goto_table(Instruction):
-    type = const.OFPIT_GOTO_TABLE
+    type = 1
 
     def __init__(self, table_id=None):
         if table_id != None:
@@ -217,10 +218,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_GOTO_TABLE)
-        _len = reader.read('!H')[0]
-        obj.table_id = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -247,7 +248,7 @@
         q.text('}')
 
 class write_actions(Instruction):
-    type = const.OFPIT_WRITE_ACTIONS
+    type = 3
 
     def __init__(self, actions=None):
         if actions != None:
@@ -261,7 +262,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -273,9 +274,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -303,7 +304,7 @@
         q.text('}')
 
 class write_metadata(Instruction):
-    type = const.OFPIT_WRITE_METADATA
+    type = 2
 
     def __init__(self, metadata=None, metadata_mask=None):
         if metadata != None:
@@ -334,12 +335,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_METADATA)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.metadata = reader.read('!Q')[0]
-        obj.metadata_mask = reader.read('!Q')[0]
+        obj.metadata = reader.read("!Q")[0]
+        obj.metadata_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -370,10 +371,10 @@
 
 
 parsers = {
+    const.OFPIT_GOTO_TABLE : goto_table.unpack,
+    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
+    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
     const.OFPIT_APPLY_ACTIONS : apply_actions.unpack,
     const.OFPIT_CLEAR_ACTIONS : clear_actions.unpack,
     const.OFPIT_EXPERIMENTER : experimenter.unpack,
-    const.OFPIT_GOTO_TABLE : goto_table.unpack,
-    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
-    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
 }
diff --git a/src/python/loxi/of11/message.py b/src/python/loxi/of11/message.py
index 8d922b5..12aa4a1 100644
--- a/src/python/loxi/of11/message.py
+++ b/src/python/loxi/of11/message.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 message.py
 # Do not modify
@@ -20,9 +21,9 @@
     xid = None
 
 class aggregate_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_AGGREGATE
+    version = 2
+    type = 19
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
         self.xid = xid
@@ -68,19 +69,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
-        obj.flow_count = reader.read('!L')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
+        obj.flow_count = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -131,9 +132,9 @@
         q.text('}')
 
 class aggregate_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_AGGREGATE
+    version = 2
+    type = 18
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
         self.xid = xid
@@ -177,7 +178,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -195,23 +196,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -274,8 +275,8 @@
         q.text('}')
 
 class barrier_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REPLY
+    version = 2
+    type = 21
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -298,12 +299,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 21)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -337,8 +338,8 @@
         q.text('}')
 
 class barrier_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REQUEST
+    version = 2
+    type = 20
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -361,12 +362,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 20)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -399,10 +400,486 @@
             q.breakable()
         q.text('}')
 
+class bsn_bw_clear_data_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 22
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 22)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_clear_data_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 21
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 21)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 20
+
+    def __init__(self, xid=None, enabled=None):
+        self.xid = xid
+        if enabled != None:
+            self.enabled = enabled
+        else:
+            self.enabled = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enabled))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 20)
+        obj.enabled = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enabled != other.enabled: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enabled = ");
+                q.text("%#x" % self.enabled)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 19
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 19)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 23
+
+    def __init__(self, xid=None, enable=None, status=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 23)
+        obj.enable = reader.read("!L")[0]
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 18
+
+    def __init__(self, xid=None, enable=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 18)
+        obj.enable = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+            q.breakable()
+        q.text('}')
+
 class bsn_get_interfaces_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 10
 
     def __init__(self, xid=None, interfaces=None):
@@ -420,7 +897,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.experimenter))
         packed.append(struct.pack("!L", self.subtype))
-        packed.append("".join([x.pack() for x in self.interfaces]))
+        packed.append(util.pack_list(self.interfaces))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -433,15 +910,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 10)
         obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
         return obj
@@ -481,9 +958,9 @@
         q.text('}')
 
 class bsn_get_interfaces_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 9
 
     def __init__(self, xid=None):
@@ -509,15 +986,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 9)
         return obj
 
@@ -552,9 +1029,9 @@
         q.text('}')
 
 class bsn_get_mirroring_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 5
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -586,17 +1063,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 5)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -635,9 +1112,9 @@
         q.text('}')
 
 class bsn_get_mirroring_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 4
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -669,17 +1146,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 4)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -718,9 +1195,9 @@
         q.text('}')
 
 class bsn_set_mirroring(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 3
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -752,17 +1229,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 3)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -800,10 +1277,91 @@
             q.breakable()
         q.text('}')
 
-class bsn_set_pktin_suppression(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+class bsn_set_pktin_suppression_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 25
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_set_pktin_suppression_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 25)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_set_pktin_suppression_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_set_pktin_suppression_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
     subtype = 11
 
     def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
@@ -850,27 +1408,27 @@
     @staticmethod
     def unpack(buf):
         if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
-        obj = bsn_set_pktin_suppression()
+        obj = bsn_set_pktin_suppression_request()
         if type(buf) == loxi.generic_util.OFReader:
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 11)
-        obj.enabled = reader.read('!B')[0]
+        obj.enabled = reader.read("!B")[0]
         reader.skip(1)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.cookie = reader.read('!Q')[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.cookie = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -896,7 +1454,7 @@
         return loxi.pp.pp(self)
 
     def pretty_print(self, q):
-        q.text("bsn_set_pktin_suppression {")
+        q.text("bsn_set_pktin_suppression_request {")
         with q.group():
             with q.indent(2):
                 q.breakable()
@@ -923,10 +1481,344 @@
             q.breakable()
         q.text('}')
 
+class bsn_virtual_port_create_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 16
+
+    def __init__(self, xid=None, status=None, vport_no=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 16)
+        obj.status = reader.read("!L")[0]
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_create_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 15
+
+    def __init__(self, xid=None, vport=None):
+        self.xid = xid
+        if vport != None:
+            self.vport = vport
+        else:
+            self.vport = common.bsn_vport_q_in_q()
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(self.vport.pack())
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 15)
+        obj.vport = common.bsn_vport_q_in_q.unpack(reader)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport != other.vport: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport = ");
+                q.pp(self.vport)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_reply(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 26
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 26)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_request(Message):
+    version = 2
+    type = 4
+    experimenter = 6035143
+    subtype = 17
+
+    def __init__(self, xid=None, vport_no=None):
+        self.xid = xid
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 17)
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
 class desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_DESC
+    version = 2
+    type = 19
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
         self.xid = xid
@@ -981,15 +1873,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
         obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
@@ -1053,9 +1945,9 @@
         q.text('}')
 
 class desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_DESC
+    version = 2
+    type = 18
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -1085,15 +1977,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -1132,15 +2024,15 @@
         q.text('}')
 
 class echo_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REPLY
+    version = 2
+    type = 3
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1161,12 +2053,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 3)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1205,15 +2097,15 @@
         q.text('}')
 
 class echo_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REQUEST
+    version = 2
+    type = 2
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1234,12 +2126,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 2)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1278,8 +2170,8 @@
         q.text('}')
 
 class error_msg(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ERROR
+    version = 2
+    type = 1
 
     def __init__(self, xid=None, err_type=None, code=None, data=None):
         self.xid = xid
@@ -1294,7 +2186,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1317,14 +2209,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ERROR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.err_type = reader.read('!H')[0]
-        obj.code = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.err_type = reader.read("!H")[0]
+        obj.code = reader.read("!H")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1371,9 +2263,9 @@
         q.text('}')
 
 class experimenter_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_EXPERIMENTER
+    version = 2
+    type = 19
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, data=None):
         self.xid = xid
@@ -1388,7 +2280,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1414,17 +2306,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_EXPERIMENTER)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = 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
@@ -1472,9 +2364,9 @@
         q.text('}')
 
 class experimenter_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_EXPERIMENTER
+    version = 2
+    type = 18
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, data=None):
         self.xid = xid
@@ -1489,7 +2381,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1515,17 +2407,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_EXPERIMENTER)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = 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
@@ -1573,8 +2465,8 @@
         q.text('}')
 
 class features_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REPLY
+    version = 2
+    type = 6
 
     def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None):
         self.xid = xid
@@ -1615,7 +2507,7 @@
         packed.append('\x00' * 3)
         packed.append(struct.pack("!L", self.capabilities))
         packed.append(struct.pack("!L", self.reserved))
-        packed.append("".join([x.pack() for x in self.ports]))
+        packed.append(util.pack_list(self.ports))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1628,18 +2520,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.datapath_id = reader.read('!Q')[0]
-        obj.n_buffers = reader.read('!L')[0]
-        obj.n_tables = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 6)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.datapath_id = reader.read("!Q")[0]
+        obj.n_buffers = reader.read("!L")[0]
+        obj.n_tables = reader.read("!B")[0]
         reader.skip(3)
-        obj.capabilities = reader.read('!L')[0]
-        obj.reserved = reader.read('!L')[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.reserved = reader.read("!L")[0]
         obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
         return obj
 
@@ -1698,8 +2590,8 @@
         q.text('}')
 
 class features_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REQUEST
+    version = 2
+    type = 5
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -1722,12 +2614,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 5)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1761,9 +2653,9 @@
         q.text('}')
 
 class flow_add(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_ADD
+    version = 2
+    type = 14
+    _command = 0
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -1825,17 +2717,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1848,24 +2740,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_ADD)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 0)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -1950,9 +2842,9 @@
         q.text('}')
 
 class flow_delete(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE
+    version = 2
+    type = 14
+    _command = 3
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2014,17 +2906,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2037,24 +2929,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 3)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2139,9 +3031,9 @@
         q.text('}')
 
 class flow_delete_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE_STRICT
+    version = 2
+    type = 14
+    _command = 4
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2203,17 +3095,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2226,24 +3118,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 4)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2328,9 +3220,9 @@
         q.text('}')
 
 class flow_modify(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY
+    version = 2
+    type = 14
+    _command = 1
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2392,17 +3284,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2415,24 +3307,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 1)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2517,9 +3409,9 @@
         q.text('}')
 
 class flow_modify_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY_STRICT
+    version = 2
+    type = 14
+    _command = 2
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2581,17 +3473,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2604,24 +3496,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 2)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2706,8 +3598,8 @@
         q.text('}')
 
 class flow_removed(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_REMOVED
+    version = 2
+    type = 11
 
     def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None, match=None):
         self.xid = xid
@@ -2781,22 +3673,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_REMOVED)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
-        obj.idle_timeout = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 11)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
+        obj.idle_timeout = reader.read("!H")[0]
         reader.skip(2)
-        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.match = common.match.unpack(reader)
         return obj
 
@@ -2871,9 +3763,9 @@
         q.text('}')
 
 class flow_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_FLOW
+    version = 2
+    type = 19
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -2895,7 +3787,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2908,15 +3800,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_flow_stats_entry(reader)
         return obj
@@ -2960,9 +3852,9 @@
         q.text('}')
 
 class flow_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_FLOW
+    version = 2
+    type = 18
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
         self.xid = xid
@@ -3006,7 +3898,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -3024,23 +3916,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -3103,8 +3995,8 @@
         q.text('}')
 
 class get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REPLY
+    version = 2
+    type = 8
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -3137,14 +4029,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 8)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3186,8 +4078,8 @@
         q.text('}')
 
 class get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REQUEST
+    version = 2
+    type = 7
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3210,12 +4102,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 7)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3249,9 +4141,9 @@
         q.text('}')
 
 class group_desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_GROUP_DESC
+    version = 2
+    type = 19
+    stats_type = 7
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -3273,7 +4165,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3286,15 +4178,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 7)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_desc_stats_entry(reader)
         return obj
@@ -3338,9 +4230,9 @@
         q.text('}')
 
 class group_desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_GROUP_DESC
+    version = 2
+    type = 18
+    stats_type = 7
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -3370,15 +4262,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 7)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -3417,8 +4309,8 @@
         q.text('}')
 
 class group_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GROUP_MOD
+    version = 2
+    type = 15
 
     def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
         self.xid = xid
@@ -3449,7 +4341,7 @@
         packed.append(struct.pack("!B", self.group_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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3462,16 +4354,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GROUP_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.command = reader.read('!H')[0]
-        obj.group_type = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 15)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.command = reader.read("!H")[0]
+        obj.group_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
 
@@ -3522,9 +4414,9 @@
         q.text('}')
 
 class group_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_GROUP
+    version = 2
+    type = 19
+    stats_type = 6
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -3546,7 +4438,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3559,15 +4451,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 6)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_stats_entry(reader)
         return obj
@@ -3611,9 +4503,9 @@
         q.text('}')
 
 class group_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_GROUP
+    version = 2
+    type = 18
+    stats_type = 6
 
     def __init__(self, xid=None, flags=None, group_id=None):
         self.xid = xid
@@ -3649,17 +4541,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 6)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.group_id = reader.read('!L')[0]
+        obj.group_id = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -3702,8 +4594,8 @@
         q.text('}')
 
 class hello(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_HELLO
+    version = 2
+    type = 0
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3726,12 +4618,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_HELLO)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3765,8 +4657,8 @@
         q.text('}')
 
 class packet_in(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_IN
+    version = 2
+    type = 10
 
     def __init__(self, xid=None, buffer_id=None, in_port=None, in_phy_port=None, total_len=None, reason=None, table_id=None, data=None):
         self.xid = xid
@@ -3797,7 +4689,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -3806,8 +4698,8 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.in_port))
-        packed.append(struct.pack("!L", self.in_phy_port))
+        packed.append(util.pack_port_no(self.in_port))
+        packed.append(util.pack_port_no(self.in_phy_port))
         packed.append(struct.pack("!H", self.total_len))
         packed.append(struct.pack("!B", self.reason))
         packed.append(struct.pack("!B", self.table_id))
@@ -3824,18 +4716,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_IN)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.in_port = reader.read('!L')[0]
-        obj.in_phy_port = reader.read('!L')[0]
-        obj.total_len = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 10)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        obj.in_phy_port = util.unpack_port_no(reader)
+        obj.total_len = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -3898,8 +4790,8 @@
         q.text('}')
 
 class packet_out(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_OUT
+    version = 2
+    type = 13
 
     def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
         self.xid = xid
@@ -3918,7 +4810,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -3927,10 +4819,10 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.in_port))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
         packed.append('\x00' * 6)
-        packed.append("".join([x.pack() for x in self.actions]))
+        packed.append(util.pack_list(self.actions))
         packed[6] = struct.pack("!H", len(packed[-1]))
         packed.append(self.data)
         length = sum([len(x) for x in packed])
@@ -3945,15 +4837,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_OUT)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.in_port = reader.read('!L')[0]
-        _actions_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 13)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        _actions_len = reader.read("!H")[0]
         reader.skip(6)
         obj.actions = action.unpack_list(reader.slice(_actions_len))
         obj.data = str(reader.read_all())
@@ -4006,8 +4898,8 @@
         q.text('}')
 
 class port_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_MOD
+    version = 2
+    type = 16
 
     def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
         self.xid = xid
@@ -4038,7 +4930,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        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)
@@ -4058,19 +4950,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port_no = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = 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.config = reader.read('!L')[0]
-        obj.mask = reader.read('!L')[0]
-        obj.advertise = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
+        obj.mask = reader.read("!L")[0]
+        obj.advertise = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4125,9 +5017,9 @@
         q.text('}')
 
 class port_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_PORT
+    version = 2
+    type = 19
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4149,7 +5041,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4162,15 +5054,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
         return obj
@@ -4214,9 +5106,9 @@
         q.text('}')
 
 class port_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_PORT
+    version = 2
+    type = 18
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, port_no=None):
         self.xid = xid
@@ -4238,7 +5130,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4252,17 +5144,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -4305,8 +5197,8 @@
         q.text('}')
 
 class port_status(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_STATUS
+    version = 2
+    type = 12
 
     def __init__(self, xid=None, reason=None, desc=None):
         self.xid = xid
@@ -4340,13 +5232,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_STATUS)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.reason = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 12)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.reason = reader.read("!B")[0]
         reader.skip(7)
         obj.desc = common.port_desc.unpack(reader)
         return obj
@@ -4390,8 +5282,8 @@
         q.text('}')
 
 class queue_get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REPLY
+    version = 2
+    type = 23
 
     def __init__(self, xid=None, port=None, queues=None):
         self.xid = xid
@@ -4410,9 +5302,9 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.queues]))
+        packed.append(util.pack_list(self.queues))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4425,13 +5317,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 23)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         obj.queues = common.unpack_list_packet_queue(reader)
         return obj
@@ -4475,8 +5367,8 @@
         q.text('}')
 
 class queue_get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REQUEST
+    version = 2
+    type = 22
 
     def __init__(self, xid=None, port=None):
         self.xid = xid
@@ -4491,7 +5383,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4505,13 +5397,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 22)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -4550,9 +5442,9 @@
         q.text('}')
 
 class queue_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_QUEUE
+    version = 2
+    type = 19
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4574,7 +5466,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4587,15 +5479,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
         return obj
@@ -4639,9 +5531,9 @@
         q.text('}')
 
 class queue_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_QUEUE
+    version = 2
+    type = 18
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
         self.xid = xid
@@ -4667,7 +5559,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        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))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4681,18 +5573,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
-        obj.queue_id = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4738,8 +5630,8 @@
         q.text('}')
 
 class set_config(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_SET_CONFIG
+    version = 2
+    type = 9
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -4772,14 +5664,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_SET_CONFIG)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 9)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -4821,8 +5713,8 @@
         q.text('}')
 
 class table_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_TABLE_MOD
+    version = 2
+    type = 17
 
     def __init__(self, xid=None, table_id=None, config=None):
         self.xid = xid
@@ -4856,15 +5748,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_TABLE_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.table_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.config = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4906,9 +5798,9 @@
         q.text('}')
 
 class table_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_TABLE
+    version = 2
+    type = 19
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4930,7 +5822,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4943,15 +5835,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
         return obj
@@ -4995,9 +5887,9 @@
         q.text('}')
 
 class table_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_TABLE
+    version = 2
+    type = 18
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -5027,15 +5919,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 2)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -5135,30 +6027,30 @@
         raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
 
 parsers = {
-    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
-    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
-    const.OFPT_ECHO_REPLY : echo_reply.unpack,
-    const.OFPT_ECHO_REQUEST : echo_request.unpack,
-    const.OFPT_ERROR : error_msg.unpack,
-    const.OFPT_EXPERIMENTER : parse_experimenter,
-    const.OFPT_FEATURES_REPLY : features_reply.unpack,
-    const.OFPT_FEATURES_REQUEST : features_request.unpack,
-    const.OFPT_FLOW_MOD : parse_flow_mod,
-    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
-    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
-    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
-    const.OFPT_GROUP_MOD : group_mod.unpack,
     const.OFPT_HELLO : hello.unpack,
-    const.OFPT_PACKET_IN : packet_in.unpack,
-    const.OFPT_PACKET_OUT : packet_out.unpack,
-    const.OFPT_PORT_MOD : port_mod.unpack,
-    const.OFPT_PORT_STATUS : port_status.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
+    const.OFPT_ERROR : error_msg.unpack,
+    const.OFPT_ECHO_REQUEST : echo_request.unpack,
+    const.OFPT_ECHO_REPLY : echo_reply.unpack,
+    const.OFPT_EXPERIMENTER : parse_experimenter,
+    const.OFPT_FEATURES_REQUEST : features_request.unpack,
+    const.OFPT_FEATURES_REPLY : features_reply.unpack,
+    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
+    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
     const.OFPT_SET_CONFIG : set_config.unpack,
-    const.OFPT_STATS_REPLY : parse_stats_reply,
-    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_PACKET_IN : packet_in.unpack,
+    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
+    const.OFPT_PORT_STATUS : port_status.unpack,
+    const.OFPT_PACKET_OUT : packet_out.unpack,
+    const.OFPT_FLOW_MOD : parse_flow_mod,
+    const.OFPT_GROUP_MOD : group_mod.unpack,
+    const.OFPT_PORT_MOD : port_mod.unpack,
     const.OFPT_TABLE_MOD : table_mod.unpack,
+    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_STATS_REPLY : parse_stats_reply,
+    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
+    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
 }
 
 flow_mod_parsers = {
@@ -5194,4 +6086,23 @@
 }
 
 experimenter_parsers = {
+    6035143 : {
+        22: bsn_bw_clear_data_reply.unpack,
+        21: bsn_bw_clear_data_request.unpack,
+        20: bsn_bw_enable_get_reply.unpack,
+        19: bsn_bw_enable_get_request.unpack,
+        23: bsn_bw_enable_set_reply.unpack,
+        18: bsn_bw_enable_set_request.unpack,
+        10: bsn_get_interfaces_reply.unpack,
+        9: bsn_get_interfaces_request.unpack,
+        5: bsn_get_mirroring_reply.unpack,
+        4: bsn_get_mirroring_request.unpack,
+        3: bsn_set_mirroring.unpack,
+        25: bsn_set_pktin_suppression_reply.unpack,
+        11: bsn_set_pktin_suppression_request.unpack,
+        16: bsn_virtual_port_create_reply.unpack,
+        15: bsn_virtual_port_create_request.unpack,
+        26: bsn_virtual_port_remove_reply.unpack,
+        17: bsn_virtual_port_remove_request.unpack,
+    },
 }
diff --git a/src/python/loxi/of11/util.py b/src/python/loxi/of11/util.py
index 45aa2d0..13c927a 100644
--- a/src/python/loxi/of11/util.py
+++ b/src/python/loxi/of11/util.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 util.py
 # Do not modify
@@ -43,3 +44,36 @@
         if v == v2:
             return k
     return v
+
+def pack_port_no(value):
+    return struct.pack("!L", value)
+
+def unpack_port_no(reader):
+    return reader.read("!L")[0]
+
+def pack_fm_cmd(value):
+    return struct.pack("!B", value)
+
+def unpack_fm_cmd(reader):
+    return reader.read("!B")[0]
+
+def init_wc_bmap():
+    return const.OFPFW_ALL
+
+def pack_wc_bmap(value):
+    return struct.pack("!L", value)
+
+def unpack_wc_bmap(reader):
+    return reader.read("!L")[0]
+
+def init_match_bmap():
+    return const.OFPFW_ALL
+
+def pack_match_bmap(value):
+    return struct.pack("!L", value)
+
+def unpack_match_bmap(reader):
+    return reader.read("!L")[0]
+
+def pack_list(values):
+    return "".join([x.pack() for x in values])
diff --git a/src/python/loxi/of12/__init__.py b/src/python/loxi/of12/__init__.py
index 5610646..ca8395c 100644
--- a/src/python/loxi/of12/__init__.py
+++ b/src/python/loxi/of12/__init__.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 init.py
 # Do not modify
diff --git a/src/python/loxi/of12/action.py b/src/python/loxi/of12/action.py
index 8775b88..f1f9272 100644
--- a/src/python/loxi/of12/action.py
+++ b/src/python/loxi/of12/action.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 action.py
 # Do not modify
@@ -23,8 +24,8 @@
     pass
 
 class bsn_mirror(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 1
 
     def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
@@ -63,16 +64,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 1)
-        obj.dest_port = reader.read('!L')[0]
-        obj.vlan_tag = reader.read('!L')[0]
-        obj.copy_stage = reader.read('!B')[0]
+        obj.dest_port = reader.read("!L")[0]
+        obj.vlan_tag = reader.read("!L")[0]
+        obj.copy_stage = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -107,8 +108,8 @@
         q.text('}')
 
 class bsn_set_tunnel_dst(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 2
 
     def __init__(self, dst=None):
@@ -136,14 +137,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 2)
-        obj.dst = reader.read('!L')[0]
+        obj.dst = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -169,7 +170,7 @@
         q.text('}')
 
 class copy_ttl_in(Action):
-    type = const.OFPAT_COPY_TTL_IN
+    type = 12
 
     def __init__(self):
         return
@@ -190,9 +191,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_IN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 12)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -216,7 +217,7 @@
         q.text('}')
 
 class copy_ttl_out(Action):
-    type = const.OFPAT_COPY_TTL_OUT
+    type = 11
 
     def __init__(self):
         return
@@ -237,9 +238,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_OUT)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 11)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -263,7 +264,7 @@
         q.text('}')
 
 class dec_mpls_ttl(Action):
-    type = const.OFPAT_DEC_MPLS_TTL
+    type = 16
 
     def __init__(self):
         return
@@ -284,9 +285,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_MPLS_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 16)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -310,7 +311,7 @@
         q.text('}')
 
 class dec_nw_ttl(Action):
-    type = const.OFPAT_DEC_NW_TTL
+    type = 24
 
     def __init__(self):
         return
@@ -331,9 +332,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_NW_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 24)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -357,7 +358,7 @@
         q.text('}')
 
 class group(Action):
-    type = const.OFPAT_GROUP
+    type = 22
 
     def __init__(self, group_id=None):
         if group_id != None:
@@ -382,10 +383,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_GROUP)
-        _len = reader.read('!H')[0]
-        obj.group_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 22)
+        _len = reader.read("!H")[0]
+        obj.group_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -411,8 +412,8 @@
         q.text('}')
 
 class nicira_dec_ttl(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x2320
+    type = 65535
+    experimenter = 8992
     subtype = 18
 
     def __init__(self):
@@ -437,12 +438,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!H")[0]
         assert(_subtype == 18)
         reader.skip(2)
         reader.skip(4)
@@ -468,7 +469,7 @@
         q.text('}')
 
 class output(Action):
-    type = const.OFPAT_OUTPUT
+    type = 0
 
     def __init__(self, port=None, max_len=None):
         if port != None:
@@ -485,7 +486,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append(struct.pack("!H", self.max_len))
         packed.append('\x00' * 6)
         length = sum([len(x) for x in packed])
@@ -499,11 +500,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_OUTPUT)
-        _len = reader.read('!H')[0]
-        obj.port = reader.read('!L')[0]
-        obj.max_len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _len = reader.read("!H")[0]
+        obj.port = util.unpack_port_no(reader)
+        obj.max_len = reader.read("!H")[0]
         reader.skip(6)
         return obj
 
@@ -534,7 +535,7 @@
         q.text('}')
 
 class pop_mpls(Action):
-    type = const.OFPAT_POP_MPLS
+    type = 20
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -560,10 +561,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 20)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -590,7 +591,7 @@
         q.text('}')
 
 class pop_vlan(Action):
-    type = const.OFPAT_POP_VLAN
+    type = 18
 
     def __init__(self):
         return
@@ -611,9 +612,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_VLAN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 18)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -637,7 +638,7 @@
         q.text('}')
 
 class push_mpls(Action):
-    type = const.OFPAT_PUSH_MPLS
+    type = 19
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -663,10 +664,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 19)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -693,7 +694,7 @@
         q.text('}')
 
 class push_vlan(Action):
-    type = const.OFPAT_PUSH_VLAN
+    type = 17
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -719,10 +720,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_VLAN)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 17)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -749,13 +750,13 @@
         q.text('}')
 
 class set_field(Action):
-    type = const.OFPAT_SET_FIELD
+    type = 25
 
     def __init__(self, field=None):
         if field != None:
             self.field = field
         else:
-            self.field = ""
+            self.field = ''
         return
 
     def pack(self):
@@ -774,9 +775,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_FIELD)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 25)
+        _len = reader.read("!H")[0]
         obj.field = str(reader.read_all())
         return obj
 
@@ -803,7 +804,7 @@
         q.text('}')
 
 class set_mpls_ttl(Action):
-    type = const.OFPAT_SET_MPLS_TTL
+    type = 15
 
     def __init__(self, mpls_ttl=None):
         if mpls_ttl != None:
@@ -829,10 +830,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_MPLS_TTL)
-        _len = reader.read('!H')[0]
-        obj.mpls_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 15)
+        _len = reader.read("!H")[0]
+        obj.mpls_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -859,7 +860,7 @@
         q.text('}')
 
 class set_nw_ttl(Action):
-    type = const.OFPAT_SET_NW_TTL
+    type = 23
 
     def __init__(self, nw_ttl=None):
         if nw_ttl != None:
@@ -885,10 +886,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_TTL)
-        _len = reader.read('!H')[0]
-        obj.nw_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 23)
+        _len = reader.read("!H")[0]
+        obj.nw_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -915,7 +916,7 @@
         q.text('}')
 
 class set_queue(Action):
-    type = const.OFPAT_SET_QUEUE
+    type = 21
 
     def __init__(self, queue_id=None):
         if queue_id != None:
@@ -940,10 +941,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_QUEUE)
-        _len = reader.read('!H')[0]
-        obj.queue_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 21)
+        _len = reader.read("!H")[0]
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -985,22 +986,29 @@
         raise loxi.ProtocolError("unexpected BSN experimenter subtype %#x" % subtype)
 
 parsers = {
-    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
-    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
-    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
-    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
-    const.OFPAT_EXPERIMENTER : parse_experimenter,
-    const.OFPAT_GROUP : group.unpack,
     const.OFPAT_OUTPUT : output.unpack,
-    const.OFPAT_POP_MPLS : pop_mpls.unpack,
+    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
+    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
+    const.OFPAT_SET_MPLS_TTL : set_mpls_ttl.unpack,
+    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
+    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
     const.OFPAT_POP_VLAN : pop_vlan.unpack,
     const.OFPAT_PUSH_MPLS : push_mpls.unpack,
-    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
-    const.OFPAT_SET_FIELD : set_field.unpack,
-    const.OFPAT_SET_MPLS_TTL : set_mpls_ttl.unpack,
-    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_POP_MPLS : pop_mpls.unpack,
     const.OFPAT_SET_QUEUE : set_queue.unpack,
+    const.OFPAT_GROUP : group.unpack,
+    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
+    const.OFPAT_SET_FIELD : set_field.unpack,
+    const.OFPAT_EXPERIMENTER : parse_experimenter,
 }
 
 experimenter_parsers = {
+    8992 : {
+        18: nicira_dec_ttl.unpack,
+    },
+    6035143 : {
+        1: bsn_mirror.unpack,
+        2: bsn_set_tunnel_dst.unpack,
+    },
 }
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):
diff --git a/src/python/loxi/of12/const.py b/src/python/loxi/of12/const.py
index fa9c93c..20f99bb 100644
--- a/src/python/loxi/of12/const.py
+++ b/src/python/loxi/of12/const.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 const.py
 # Do not modify
@@ -8,21 +9,21 @@
 OFP_VERSION = 3
 
 # Identifiers from group macro_definitions
-OFP_VLAN_NONE = 0
-OFP_FLOW_PERMANENT = 0
-OFP_ETH_ALEN = 6
-OFP_MAX_PORT_NAME_LEN = 16
 OFP_MAX_TABLE_NAME_LEN = 32
-SERIAL_NUM_LEN = 32
-OFP_DEFAULT_MISS_SEND_LEN = 128
-DESC_STR_LEN = 256
+OFP_MAX_PORT_NAME_LEN = 16
 OFP_TCP_PORT = 6633
 OFP_SSL_PORT = 6633
+OFP_ETH_ALEN = 6
+OFP_DEFAULT_MISS_SEND_LEN = 128
+OFP_VLAN_NONE = 0
+OFP_FLOW_PERMANENT = 0
 OFP_DEFAULT_PRIORITY = 32768
+OFP_NO_BUFFER = 4294967295
+DESC_STR_LEN = 256
+SERIAL_NUM_LEN = 32
+OFPQ_ALL = 4294967295
 OFPQ_MIN_RATE_UNCFG = 65535
 OFPQ_MAX_RATE_UNCFG = 65535
-OFPQ_ALL = 4294967295
-OFP_NO_BUFFER = 4294967295
 
 # Identifiers from group ofp_action_type
 OFPAT_OUTPUT = 0
@@ -179,6 +180,13 @@
     12: 'OFPBRC_BAD_PACKET',
 }
 
+# Identifiers from group ofp_bsn_vport_q_in_q_untagged
+OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 65535
+
+ofp_bsn_vport_q_in_q_untagged_map = {
+    65535: 'OF_BSN_VPORT_Q_IN_Q_UNTAGGED',
+}
+
 # Identifiers from group ofp_capabilities
 OFPC_FLOW_STATS = 1
 OFPC_TABLE_STATS = 2
diff --git a/src/python/loxi/of12/instruction.py b/src/python/loxi/of12/instruction.py
index 52ee289..961f3c6 100644
--- a/src/python/loxi/of12/instruction.py
+++ b/src/python/loxi/of12/instruction.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 instruction.py
 # Do not modify
@@ -24,7 +25,7 @@
     pass
 
 class apply_actions(Instruction):
-    type = const.OFPIT_APPLY_ACTIONS
+    type = 4
 
     def __init__(self, actions=None):
         if actions != None:
@@ -38,7 +39,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -50,9 +51,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_APPLY_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -80,7 +81,7 @@
         q.text('}')
 
 class clear_actions(Instruction):
-    type = const.OFPIT_CLEAR_ACTIONS
+    type = 5
 
     def __init__(self):
         return
@@ -101,9 +102,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_CLEAR_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -127,7 +128,7 @@
         q.text('}')
 
 class experimenter(Instruction):
-    type = const.OFPIT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, experimenter=None, data=None):
         if experimenter != None:
@@ -137,7 +138,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
         return
 
     def pack(self):
@@ -157,10 +158,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -191,7 +192,7 @@
         q.text('}')
 
 class goto_table(Instruction):
-    type = const.OFPIT_GOTO_TABLE
+    type = 1
 
     def __init__(self, table_id=None):
         if table_id != None:
@@ -217,10 +218,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_GOTO_TABLE)
-        _len = reader.read('!H')[0]
-        obj.table_id = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -247,7 +248,7 @@
         q.text('}')
 
 class write_actions(Instruction):
-    type = const.OFPIT_WRITE_ACTIONS
+    type = 3
 
     def __init__(self, actions=None):
         if actions != None:
@@ -261,7 +262,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -273,9 +274,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -303,7 +304,7 @@
         q.text('}')
 
 class write_metadata(Instruction):
-    type = const.OFPIT_WRITE_METADATA
+    type = 2
 
     def __init__(self, metadata=None, metadata_mask=None):
         if metadata != None:
@@ -334,12 +335,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_METADATA)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.metadata = reader.read('!Q')[0]
-        obj.metadata_mask = reader.read('!Q')[0]
+        obj.metadata = reader.read("!Q")[0]
+        obj.metadata_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -370,10 +371,10 @@
 
 
 parsers = {
+    const.OFPIT_GOTO_TABLE : goto_table.unpack,
+    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
+    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
     const.OFPIT_APPLY_ACTIONS : apply_actions.unpack,
     const.OFPIT_CLEAR_ACTIONS : clear_actions.unpack,
     const.OFPIT_EXPERIMENTER : experimenter.unpack,
-    const.OFPIT_GOTO_TABLE : goto_table.unpack,
-    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
-    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
 }
diff --git a/src/python/loxi/of12/message.py b/src/python/loxi/of12/message.py
index f5b75e4..76424fe 100644
--- a/src/python/loxi/of12/message.py
+++ b/src/python/loxi/of12/message.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 message.py
 # Do not modify
@@ -20,9 +21,9 @@
     xid = None
 
 class aggregate_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_AGGREGATE
+    version = 3
+    type = 19
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
         self.xid = xid
@@ -68,19 +69,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
-        obj.flow_count = reader.read('!L')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
+        obj.flow_count = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -131,9 +132,9 @@
         q.text('}')
 
 class aggregate_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_AGGREGATE
+    version = 3
+    type = 18
+    stats_type = 2
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
         self.xid = xid
@@ -177,7 +178,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -195,23 +196,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_AGGREGATE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 2)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -274,8 +275,8 @@
         q.text('}')
 
 class barrier_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REPLY
+    version = 3
+    type = 21
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -298,12 +299,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 21)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -337,8 +338,8 @@
         q.text('}')
 
 class barrier_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REQUEST
+    version = 3
+    type = 20
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -361,12 +362,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 20)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -399,10 +400,486 @@
             q.breakable()
         q.text('}')
 
+class bsn_bw_clear_data_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 22
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 22)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_clear_data_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 21
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 21)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 20
+
+    def __init__(self, xid=None, enabled=None):
+        self.xid = xid
+        if enabled != None:
+            self.enabled = enabled
+        else:
+            self.enabled = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enabled))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 20)
+        obj.enabled = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enabled != other.enabled: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enabled = ");
+                q.text("%#x" % self.enabled)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 19
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 19)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 23
+
+    def __init__(self, xid=None, enable=None, status=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 23)
+        obj.enable = reader.read("!L")[0]
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 18
+
+    def __init__(self, xid=None, enable=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 18)
+        obj.enable = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+            q.breakable()
+        q.text('}')
+
 class bsn_get_interfaces_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 10
 
     def __init__(self, xid=None, interfaces=None):
@@ -420,7 +897,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.experimenter))
         packed.append(struct.pack("!L", self.subtype))
-        packed.append("".join([x.pack() for x in self.interfaces]))
+        packed.append(util.pack_list(self.interfaces))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -433,15 +910,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 10)
         obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
         return obj
@@ -481,9 +958,9 @@
         q.text('}')
 
 class bsn_get_interfaces_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 9
 
     def __init__(self, xid=None):
@@ -509,15 +986,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 9)
         return obj
 
@@ -552,9 +1029,9 @@
         q.text('}')
 
 class bsn_get_mirroring_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 5
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -586,17 +1063,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 5)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -635,9 +1112,9 @@
         q.text('}')
 
 class bsn_get_mirroring_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 4
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -669,17 +1146,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 4)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -718,9 +1195,9 @@
         q.text('}')
 
 class bsn_set_mirroring(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 3
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -752,17 +1229,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 3)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -800,10 +1277,91 @@
             q.breakable()
         q.text('}')
 
-class bsn_set_pktin_suppression(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+class bsn_set_pktin_suppression_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 25
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_set_pktin_suppression_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 25)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_set_pktin_suppression_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_set_pktin_suppression_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
     subtype = 11
 
     def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
@@ -850,27 +1408,27 @@
     @staticmethod
     def unpack(buf):
         if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
-        obj = bsn_set_pktin_suppression()
+        obj = bsn_set_pktin_suppression_request()
         if type(buf) == loxi.generic_util.OFReader:
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 11)
-        obj.enabled = reader.read('!B')[0]
+        obj.enabled = reader.read("!B")[0]
         reader.skip(1)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.cookie = reader.read('!Q')[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.cookie = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -896,7 +1454,7 @@
         return loxi.pp.pp(self)
 
     def pretty_print(self, q):
-        q.text("bsn_set_pktin_suppression {")
+        q.text("bsn_set_pktin_suppression_request {")
         with q.group():
             with q.indent(2):
                 q.breakable()
@@ -923,10 +1481,344 @@
             q.breakable()
         q.text('}')
 
+class bsn_virtual_port_create_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 16
+
+    def __init__(self, xid=None, status=None, vport_no=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 16)
+        obj.status = reader.read("!L")[0]
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_create_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 15
+
+    def __init__(self, xid=None, vport=None):
+        self.xid = xid
+        if vport != None:
+            self.vport = vport
+        else:
+            self.vport = common.bsn_vport_q_in_q()
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(self.vport.pack())
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 15)
+        obj.vport = common.bsn_vport_q_in_q.unpack(reader)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport != other.vport: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport = ");
+                q.pp(self.vport)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_reply(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 26
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 26)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_request(Message):
+    version = 3
+    type = 4
+    experimenter = 6035143
+    subtype = 17
+
+    def __init__(self, xid=None, vport_no=None):
+        self.xid = xid
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 17)
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
 class desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_DESC
+    version = 3
+    type = 19
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
         self.xid = xid
@@ -981,15 +1873,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
         obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
@@ -1053,9 +1945,9 @@
         q.text('}')
 
 class desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_DESC
+    version = 3
+    type = 18
+    stats_type = 0
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -1085,15 +1977,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 0)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -1132,15 +2024,15 @@
         q.text('}')
 
 class echo_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REPLY
+    version = 3
+    type = 3
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1161,12 +2053,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 3)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1205,15 +2097,15 @@
         q.text('}')
 
 class echo_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REQUEST
+    version = 3
+    type = 2
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1234,12 +2126,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 2)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1278,8 +2170,8 @@
         q.text('}')
 
 class error_msg(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ERROR
+    version = 3
+    type = 1
 
     def __init__(self, xid=None, err_type=None, code=None, data=None):
         self.xid = xid
@@ -1294,7 +2186,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1317,14 +2209,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ERROR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.err_type = reader.read('!H')[0]
-        obj.code = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.err_type = reader.read("!H")[0]
+        obj.code = reader.read("!H")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1371,9 +2263,9 @@
         q.text('}')
 
 class experimenter_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_EXPERIMENTER
+    version = 3
+    type = 19
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None):
         self.xid = xid
@@ -1392,7 +2284,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1418,18 +2310,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_EXPERIMENTER)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!L')[0]
+        obj.experimenter = reader.read("!L")[0]
+        obj.subtype = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1480,9 +2372,9 @@
         q.text('}')
 
 class experimenter_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_EXPERIMENTER
+    version = 3
+    type = 18
+    stats_type = 65535
 
     def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None):
         self.xid = xid
@@ -1501,7 +2393,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1527,18 +2419,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_EXPERIMENTER)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 65535)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!L')[0]
+        obj.experimenter = reader.read("!L")[0]
+        obj.subtype = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1589,8 +2481,8 @@
         q.text('}')
 
 class features_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REPLY
+    version = 3
+    type = 6
 
     def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None):
         self.xid = xid
@@ -1631,7 +2523,7 @@
         packed.append('\x00' * 3)
         packed.append(struct.pack("!L", self.capabilities))
         packed.append(struct.pack("!L", self.reserved))
-        packed.append("".join([x.pack() for x in self.ports]))
+        packed.append(util.pack_list(self.ports))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1644,18 +2536,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.datapath_id = reader.read('!Q')[0]
-        obj.n_buffers = reader.read('!L')[0]
-        obj.n_tables = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 6)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.datapath_id = reader.read("!Q")[0]
+        obj.n_buffers = reader.read("!L")[0]
+        obj.n_tables = reader.read("!B")[0]
         reader.skip(3)
-        obj.capabilities = reader.read('!L')[0]
-        obj.reserved = reader.read('!L')[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.reserved = reader.read("!L")[0]
         obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
         return obj
 
@@ -1714,8 +2606,8 @@
         q.text('}')
 
 class features_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REQUEST
+    version = 3
+    type = 5
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -1738,12 +2630,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 5)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1777,9 +2669,9 @@
         q.text('}')
 
 class flow_add(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_ADD
+    version = 3
+    type = 14
+    _command = 0
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -1841,17 +2733,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1864,24 +2756,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_ADD)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 0)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -1966,9 +2858,9 @@
         q.text('}')
 
 class flow_delete(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE
+    version = 3
+    type = 14
+    _command = 3
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2030,17 +2922,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2053,24 +2945,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 3)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2155,9 +3047,9 @@
         q.text('}')
 
 class flow_delete_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE_STRICT
+    version = 3
+    type = 14
+    _command = 4
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2219,17 +3111,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2242,24 +3134,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 4)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2344,9 +3236,9 @@
         q.text('}')
 
 class flow_modify(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY
+    version = 3
+    type = 14
+    _command = 1
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2408,17 +3300,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2431,24 +3323,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 1)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2533,9 +3425,9 @@
         q.text('}')
 
 class flow_modify_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY_STRICT
+    version = 3
+    type = 14
+    _command = 2
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2597,17 +3489,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2620,24 +3512,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 2)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2722,8 +3614,8 @@
         q.text('}')
 
 class flow_removed(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_REMOVED
+    version = 3
+    type = 11
 
     def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
         self.xid = xid
@@ -2801,22 +3693,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_REMOVED)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 11)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -2895,9 +3787,9 @@
         q.text('}')
 
 class flow_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_FLOW
+    version = 3
+    type = 19
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -2919,7 +3811,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2932,15 +3824,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_flow_stats_entry(reader)
         return obj
@@ -2984,9 +3876,9 @@
         q.text('}')
 
 class flow_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_FLOW
+    version = 3
+    type = 18
+    stats_type = 1
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
         self.xid = xid
@@ -3030,7 +3922,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -3048,23 +3940,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_FLOW)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 1)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -3127,8 +4019,8 @@
         q.text('}')
 
 class get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REPLY
+    version = 3
+    type = 8
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -3161,14 +4053,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 8)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3210,8 +4102,8 @@
         q.text('}')
 
 class get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REQUEST
+    version = 3
+    type = 7
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3234,12 +4126,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 7)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3273,9 +4165,9 @@
         q.text('}')
 
 class group_desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_GROUP_DESC
+    version = 3
+    type = 19
+    stats_type = 7
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -3297,7 +4189,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3310,15 +4202,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 7)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_desc_stats_entry(reader)
         return obj
@@ -3362,9 +4254,9 @@
         q.text('}')
 
 class group_desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_GROUP_DESC
+    version = 3
+    type = 18
+    stats_type = 7
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -3394,15 +4286,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_DESC)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 7)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -3441,9 +4333,9 @@
         q.text('}')
 
 class group_features_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_GROUP_FEATURES
+    version = 3
+    type = 19
+    stats_type = 8
 
     def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
         self.xid = xid
@@ -3523,26 +4415,26 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_FEATURES)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 8)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.types = reader.read('!L')[0]
-        obj.capabilities = reader.read('!L')[0]
-        obj.max_groups_all = reader.read('!L')[0]
-        obj.max_groups_select = reader.read('!L')[0]
-        obj.max_groups_indirect = reader.read('!L')[0]
-        obj.max_groups_ff = reader.read('!L')[0]
-        obj.actions_all = reader.read('!L')[0]
-        obj.actions_select = reader.read('!L')[0]
-        obj.actions_indirect = reader.read('!L')[0]
-        obj.actions_ff = reader.read('!L')[0]
+        obj.types = reader.read("!L")[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.max_groups_all = reader.read("!L")[0]
+        obj.max_groups_select = reader.read("!L")[0]
+        obj.max_groups_indirect = reader.read("!L")[0]
+        obj.max_groups_ff = reader.read("!L")[0]
+        obj.actions_all = reader.read("!L")[0]
+        obj.actions_select = reader.read("!L")[0]
+        obj.actions_indirect = reader.read("!L")[0]
+        obj.actions_ff = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3620,9 +4512,9 @@
         q.text('}')
 
 class group_features_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_GROUP_FEATURES
+    version = 3
+    type = 18
+    stats_type = 8
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -3652,15 +4544,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP_FEATURES)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 8)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -3699,8 +4591,8 @@
         q.text('}')
 
 class group_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GROUP_MOD
+    version = 3
+    type = 15
 
     def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
         self.xid = xid
@@ -3731,7 +4623,7 @@
         packed.append(struct.pack("!B", self.group_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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3744,16 +4636,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GROUP_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.command = reader.read('!H')[0]
-        obj.group_type = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 15)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.command = reader.read("!H")[0]
+        obj.group_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
 
@@ -3804,9 +4696,9 @@
         q.text('}')
 
 class group_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_GROUP
+    version = 3
+    type = 19
+    stats_type = 6
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -3828,7 +4720,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3841,15 +4733,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 6)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_stats_entry(reader)
         return obj
@@ -3893,9 +4785,9 @@
         q.text('}')
 
 class group_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_GROUP
+    version = 3
+    type = 18
+    stats_type = 6
 
     def __init__(self, xid=None, flags=None, group_id=None):
         self.xid = xid
@@ -3931,17 +4823,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_GROUP)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 6)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.group_id = reader.read('!L')[0]
+        obj.group_id = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -3984,8 +4876,8 @@
         q.text('}')
 
 class hello(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_HELLO
+    version = 3
+    type = 0
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -4008,12 +4900,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_HELLO)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4047,8 +4939,8 @@
         q.text('}')
 
 class packet_in(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_IN
+    version = 3
+    type = 10
 
     def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None):
         self.xid = xid
@@ -4075,7 +4967,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -4102,16 +4994,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_IN)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.total_len = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 10)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.total_len = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
         obj.match = common.match.unpack(reader)
         reader.skip(2)
         obj.data = str(reader.read_all())
@@ -4172,8 +5064,8 @@
         q.text('}')
 
 class packet_out(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_OUT
+    version = 3
+    type = 13
 
     def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
         self.xid = xid
@@ -4192,7 +5084,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -4201,10 +5093,10 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.in_port))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
         packed.append('\x00' * 6)
-        packed.append("".join([x.pack() for x in self.actions]))
+        packed.append(util.pack_list(self.actions))
         packed[6] = struct.pack("!H", len(packed[-1]))
         packed.append(self.data)
         length = sum([len(x) for x in packed])
@@ -4219,15 +5111,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_OUT)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.in_port = reader.read('!L')[0]
-        _actions_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 13)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        _actions_len = reader.read("!H")[0]
         reader.skip(6)
         obj.actions = action.unpack_list(reader.slice(_actions_len))
         obj.data = str(reader.read_all())
@@ -4280,8 +5172,8 @@
         q.text('}')
 
 class port_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_MOD
+    version = 3
+    type = 16
 
     def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
         self.xid = xid
@@ -4312,7 +5204,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        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)
@@ -4332,19 +5224,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port_no = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = 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.config = reader.read('!L')[0]
-        obj.mask = reader.read('!L')[0]
-        obj.advertise = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
+        obj.mask = reader.read("!L")[0]
+        obj.advertise = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4399,9 +5291,9 @@
         q.text('}')
 
 class port_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_PORT
+    version = 3
+    type = 19
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4423,7 +5315,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4436,15 +5328,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
         return obj
@@ -4488,9 +5380,9 @@
         q.text('}')
 
 class port_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_PORT
+    version = 3
+    type = 18
+    stats_type = 4
 
     def __init__(self, xid=None, flags=None, port_no=None):
         self.xid = xid
@@ -4512,7 +5404,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4526,17 +5418,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_PORT)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 4)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -4579,8 +5471,8 @@
         q.text('}')
 
 class port_status(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_STATUS
+    version = 3
+    type = 12
 
     def __init__(self, xid=None, reason=None, desc=None):
         self.xid = xid
@@ -4614,13 +5506,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_STATUS)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.reason = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 12)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.reason = reader.read("!B")[0]
         reader.skip(7)
         obj.desc = common.port_desc.unpack(reader)
         return obj
@@ -4664,8 +5556,8 @@
         q.text('}')
 
 class queue_get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REPLY
+    version = 3
+    type = 23
 
     def __init__(self, xid=None, port=None, queues=None):
         self.xid = xid
@@ -4684,9 +5576,9 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.queues]))
+        packed.append(util.pack_list(self.queues))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4699,13 +5591,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 23)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         obj.queues = common.unpack_list_packet_queue(reader)
         return obj
@@ -4749,8 +5641,8 @@
         q.text('}')
 
 class queue_get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REQUEST
+    version = 3
+    type = 22
 
     def __init__(self, xid=None, port=None):
         self.xid = xid
@@ -4765,7 +5657,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4779,13 +5671,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 22)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -4824,9 +5716,9 @@
         q.text('}')
 
 class queue_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_QUEUE
+    version = 3
+    type = 19
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -4848,7 +5740,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4861,15 +5753,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
         return obj
@@ -4913,9 +5805,9 @@
         q.text('}')
 
 class queue_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_QUEUE
+    version = 3
+    type = 18
+    stats_type = 5
 
     def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
         self.xid = xid
@@ -4941,7 +5833,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        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))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -4955,18 +5847,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_QUEUE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 5)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
-        obj.queue_id = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -5012,15 +5904,15 @@
         q.text('}')
 
 class role_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ROLE_REPLY
+    version = 3
+    type = 25
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -5041,12 +5933,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ROLE_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 25)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -5085,8 +5977,8 @@
         q.text('}')
 
 class role_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ROLE_REQUEST
+    version = 3
+    type = 24
 
     def __init__(self, xid=None, role=None, generation_id=None):
         self.xid = xid
@@ -5120,15 +6012,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ROLE_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.role = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 24)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.role = reader.read("!L")[0]
         reader.skip(4)
-        obj.generation_id = reader.read('!Q')[0]
+        obj.generation_id = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -5170,8 +6062,8 @@
         q.text('}')
 
 class set_config(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_SET_CONFIG
+    version = 3
+    type = 9
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -5204,14 +6096,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_SET_CONFIG)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 9)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -5253,8 +6145,8 @@
         q.text('}')
 
 class table_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_TABLE_MOD
+    version = 3
+    type = 17
 
     def __init__(self, xid=None, table_id=None, config=None):
         self.xid = xid
@@ -5288,15 +6180,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_TABLE_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.table_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.config = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -5338,9 +6230,9 @@
         q.text('}')
 
 class table_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REPLY
-    stats_type = const.OFPST_TABLE
+    version = 3
+    type = 19
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None, entries=None):
         self.xid = xid
@@ -5362,7 +6254,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5375,15 +6267,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
         return obj
@@ -5427,9 +6319,9 @@
         q.text('}')
 
 class table_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_STATS_REQUEST
-    stats_type = const.OFPST_TABLE
+    version = 3
+    type = 18
+    stats_type = 3
 
     def __init__(self, xid=None, flags=None):
         self.xid = xid
@@ -5459,15 +6351,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_STATS_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
-        assert(_stats_type == const.OFPST_TABLE)
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 3)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
+        assert(_stats_type == 3)
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -5567,32 +6459,32 @@
         raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
 
 parsers = {
-    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
-    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
-    const.OFPT_ECHO_REPLY : echo_reply.unpack,
-    const.OFPT_ECHO_REQUEST : echo_request.unpack,
-    const.OFPT_ERROR : error_msg.unpack,
-    const.OFPT_EXPERIMENTER : parse_experimenter,
-    const.OFPT_FEATURES_REPLY : features_reply.unpack,
-    const.OFPT_FEATURES_REQUEST : features_request.unpack,
-    const.OFPT_FLOW_MOD : parse_flow_mod,
-    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
-    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
-    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
-    const.OFPT_GROUP_MOD : group_mod.unpack,
     const.OFPT_HELLO : hello.unpack,
-    const.OFPT_PACKET_IN : packet_in.unpack,
-    const.OFPT_PACKET_OUT : packet_out.unpack,
-    const.OFPT_PORT_MOD : port_mod.unpack,
-    const.OFPT_PORT_STATUS : port_status.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
-    const.OFPT_ROLE_REPLY : role_reply.unpack,
-    const.OFPT_ROLE_REQUEST : role_request.unpack,
+    const.OFPT_ERROR : error_msg.unpack,
+    const.OFPT_ECHO_REQUEST : echo_request.unpack,
+    const.OFPT_ECHO_REPLY : echo_reply.unpack,
+    const.OFPT_EXPERIMENTER : parse_experimenter,
+    const.OFPT_FEATURES_REQUEST : features_request.unpack,
+    const.OFPT_FEATURES_REPLY : features_reply.unpack,
+    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
+    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
     const.OFPT_SET_CONFIG : set_config.unpack,
-    const.OFPT_STATS_REPLY : parse_stats_reply,
-    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_PACKET_IN : packet_in.unpack,
+    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
+    const.OFPT_PORT_STATUS : port_status.unpack,
+    const.OFPT_PACKET_OUT : packet_out.unpack,
+    const.OFPT_FLOW_MOD : parse_flow_mod,
+    const.OFPT_GROUP_MOD : group_mod.unpack,
+    const.OFPT_PORT_MOD : port_mod.unpack,
     const.OFPT_TABLE_MOD : table_mod.unpack,
+    const.OFPT_STATS_REQUEST : parse_stats_request,
+    const.OFPT_STATS_REPLY : parse_stats_reply,
+    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
+    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
+    const.OFPT_ROLE_REQUEST : role_request.unpack,
+    const.OFPT_ROLE_REPLY : role_reply.unpack,
 }
 
 flow_mod_parsers = {
@@ -5630,4 +6522,23 @@
 }
 
 experimenter_parsers = {
+    6035143 : {
+        22: bsn_bw_clear_data_reply.unpack,
+        21: bsn_bw_clear_data_request.unpack,
+        20: bsn_bw_enable_get_reply.unpack,
+        19: bsn_bw_enable_get_request.unpack,
+        23: bsn_bw_enable_set_reply.unpack,
+        18: bsn_bw_enable_set_request.unpack,
+        10: bsn_get_interfaces_reply.unpack,
+        9: bsn_get_interfaces_request.unpack,
+        5: bsn_get_mirroring_reply.unpack,
+        4: bsn_get_mirroring_request.unpack,
+        3: bsn_set_mirroring.unpack,
+        25: bsn_set_pktin_suppression_reply.unpack,
+        11: bsn_set_pktin_suppression_request.unpack,
+        16: bsn_virtual_port_create_reply.unpack,
+        15: bsn_virtual_port_create_request.unpack,
+        26: bsn_virtual_port_remove_reply.unpack,
+        17: bsn_virtual_port_remove_request.unpack,
+    },
 }
diff --git a/src/python/loxi/of12/oxm.py b/src/python/loxi/of12/oxm.py
index d3bc046..fb1291d 100644
--- a/src/python/loxi/of12/oxm.py
+++ b/src/python/loxi/of12/oxm.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 oxm.py
 # Do not modify
@@ -26,7 +27,7 @@
     pass
 
 class arp_op(OXM):
-    type_len = 0x80002a02
+    type_len = 2147494402
 
     def __init__(self, value=None):
         if value != None:
@@ -47,9 +48,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494402)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -75,7 +76,7 @@
         q.text('}')
 
 class arp_op_masked(OXM):
-    type_len = 0x80002b04
+    type_len = 2147494660
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -101,10 +102,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494660)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -134,7 +135,7 @@
         q.text('}')
 
 class arp_sha(OXM):
-    type_len = 0x80003006
+    type_len = 2147495942
 
     def __init__(self, value=None):
         if value != None:
@@ -155,8 +156,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003006)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495942)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -183,7 +184,7 @@
         q.text('}')
 
 class arp_sha_masked(OXM):
-    type_len = 0x8000310c
+    type_len = 2147496204
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -209,8 +210,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000310c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496204)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -242,7 +243,7 @@
         q.text('}')
 
 class arp_spa(OXM):
-    type_len = 0x80002c04
+    type_len = 2147494916
 
     def __init__(self, value=None):
         if value != None:
@@ -263,9 +264,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002c04)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494916)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -291,7 +292,7 @@
         q.text('}')
 
 class arp_spa_masked(OXM):
-    type_len = 0x80002d08
+    type_len = 2147495176
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -317,10 +318,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002d08)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495176)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -350,7 +351,7 @@
         q.text('}')
 
 class arp_tha(OXM):
-    type_len = 0x80003206
+    type_len = 2147496454
 
     def __init__(self, value=None):
         if value != None:
@@ -371,8 +372,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003206)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496454)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -399,7 +400,7 @@
         q.text('}')
 
 class arp_tha_masked(OXM):
-    type_len = 0x8000330c
+    type_len = 2147496716
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -425,8 +426,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000330c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496716)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -458,7 +459,7 @@
         q.text('}')
 
 class arp_tpa(OXM):
-    type_len = 0x80002e04
+    type_len = 2147495428
 
     def __init__(self, value=None):
         if value != None:
@@ -479,9 +480,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002e04)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495428)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -507,7 +508,7 @@
         q.text('}')
 
 class arp_tpa_masked(OXM):
-    type_len = 0x80002f08
+    type_len = 2147495688
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -533,10 +534,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002f08)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495688)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -565,8 +566,116 @@
             q.breakable()
         q.text('}')
 
+class dst_meta_id(OXM):
+    type_len = 258561
+
+    def __init__(self, value=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = dst_meta_id()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258561)
+        obj.value = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: 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("dst_meta_id {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+            q.breakable()
+        q.text('}')
+
+class dst_meta_id_masked(OXM):
+    type_len = 258818
+
+    def __init__(self, value=None, value_mask=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+        if value_mask != None:
+            self.value_mask = value_mask
+        else:
+            self.value_mask = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        packed.append(struct.pack("!B", self.value_mask))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = dst_meta_id_masked()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258818)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: return False
+        if self.value_mask != other.value_mask: 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("dst_meta_id_masked {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+                q.text(","); q.breakable()
+                q.text("value_mask = ");
+                q.text("%#x" % self.value_mask)
+            q.breakable()
+        q.text('}')
+
 class eth_dst(OXM):
-    type_len = 0x80000606
+    type_len = 2147485190
 
     def __init__(self, value=None):
         if value != None:
@@ -587,8 +696,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000606)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485190)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -615,7 +724,7 @@
         q.text('}')
 
 class eth_dst_masked(OXM):
-    type_len = 0x8000070c
+    type_len = 2147485452
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -641,8 +750,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000070c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485452)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -674,7 +783,7 @@
         q.text('}')
 
 class eth_src(OXM):
-    type_len = 0x80000806
+    type_len = 2147485702
 
     def __init__(self, value=None):
         if value != None:
@@ -695,8 +804,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000806)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485702)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -723,7 +832,7 @@
         q.text('}')
 
 class eth_src_masked(OXM):
-    type_len = 0x8000090c
+    type_len = 2147485964
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -749,8 +858,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000090c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485964)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -782,7 +891,7 @@
         q.text('}')
 
 class eth_type(OXM):
-    type_len = 0x80000a02
+    type_len = 2147486210
 
     def __init__(self, value=None):
         if value != None:
@@ -803,9 +912,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486210)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -831,7 +940,7 @@
         q.text('}')
 
 class eth_type_masked(OXM):
-    type_len = 0x80000b04
+    type_len = 2147486468
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -857,10 +966,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486468)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -890,7 +999,7 @@
         q.text('}')
 
 class icmpv4_code(OXM):
-    type_len = 0x80002801
+    type_len = 2147493889
 
     def __init__(self, value=None):
         if value != None:
@@ -911,9 +1020,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002801)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493889)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -939,7 +1048,7 @@
         q.text('}')
 
 class icmpv4_code_masked(OXM):
-    type_len = 0x80002902
+    type_len = 2147494146
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -965,10 +1074,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002902)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494146)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -998,7 +1107,7 @@
         q.text('}')
 
 class icmpv4_type(OXM):
-    type_len = 0x80002601
+    type_len = 2147493377
 
     def __init__(self, value=None):
         if value != None:
@@ -1019,9 +1128,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002601)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493377)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1047,7 +1156,7 @@
         q.text('}')
 
 class icmpv4_type_masked(OXM):
-    type_len = 0x80002702
+    type_len = 2147493634
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1073,10 +1182,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002702)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493634)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1106,7 +1215,7 @@
         q.text('}')
 
 class icmpv6_code(OXM):
-    type_len = 0x80003c01
+    type_len = 2147499009
 
     def __init__(self, value=None):
         if value != None:
@@ -1127,9 +1236,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003c01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499009)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1155,7 +1264,7 @@
         q.text('}')
 
 class icmpv6_code_masked(OXM):
-    type_len = 0x80003d02
+    type_len = 2147499266
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1181,10 +1290,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003d02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499266)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1214,7 +1323,7 @@
         q.text('}')
 
 class icmpv6_type(OXM):
-    type_len = 0x80003a01
+    type_len = 2147498497
 
     def __init__(self, value=None):
         if value != None:
@@ -1235,9 +1344,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003a01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498497)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1263,7 +1372,7 @@
         q.text('}')
 
 class icmpv6_type_masked(OXM):
-    type_len = 0x80003b02
+    type_len = 2147498754
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1289,10 +1398,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003b02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498754)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1322,7 +1431,7 @@
         q.text('}')
 
 class in_phy_port(OXM):
-    type_len = 0x80000204
+    type_len = 2147484164
 
     def __init__(self, value=None):
         if value != None:
@@ -1333,7 +1442,7 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
+        packed.append(util.pack_port_no(self.value))
         return ''.join(packed)
 
     @staticmethod
@@ -1343,9 +1452,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000204)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484164)
+        obj.value = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1371,7 +1480,7 @@
         q.text('}')
 
 class in_phy_port_masked(OXM):
-    type_len = 0x80000308
+    type_len = 2147484424
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1386,8 +1495,8 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
-        packed.append(struct.pack("!L", self.value_mask))
+        packed.append(util.pack_port_no(self.value))
+        packed.append(util.pack_port_no(self.value_mask))
         return ''.join(packed)
 
     @staticmethod
@@ -1397,10 +1506,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000308)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484424)
+        obj.value = util.unpack_port_no(reader)
+        obj.value_mask = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1430,7 +1539,7 @@
         q.text('}')
 
 class in_port(OXM):
-    type_len = 0x80000004
+    type_len = 2147483652
 
     def __init__(self, value=None):
         if value != None:
@@ -1441,7 +1550,7 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
+        packed.append(util.pack_port_no(self.value))
         return ''.join(packed)
 
     @staticmethod
@@ -1451,9 +1560,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000004)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147483652)
+        obj.value = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1479,7 +1588,7 @@
         q.text('}')
 
 class in_port_masked(OXM):
-    type_len = 0x80000108
+    type_len = 2147483912
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1494,8 +1603,8 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
-        packed.append(struct.pack("!L", self.value_mask))
+        packed.append(util.pack_port_no(self.value))
+        packed.append(util.pack_port_no(self.value_mask))
         return ''.join(packed)
 
     @staticmethod
@@ -1505,10 +1614,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000108)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147483912)
+        obj.value = util.unpack_port_no(reader)
+        obj.value_mask = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1538,7 +1647,7 @@
         q.text('}')
 
 class ip_dscp(OXM):
-    type_len = 0x80001001
+    type_len = 2147487745
 
     def __init__(self, value=None):
         if value != None:
@@ -1559,9 +1668,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001001)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487745)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1587,7 +1696,7 @@
         q.text('}')
 
 class ip_dscp_masked(OXM):
-    type_len = 0x80001102
+    type_len = 2147488002
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1613,10 +1722,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001102)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488002)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1646,7 +1755,7 @@
         q.text('}')
 
 class ip_ecn(OXM):
-    type_len = 0x80001201
+    type_len = 2147488257
 
     def __init__(self, value=None):
         if value != None:
@@ -1667,9 +1776,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001201)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488257)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1695,7 +1804,7 @@
         q.text('}')
 
 class ip_ecn_masked(OXM):
-    type_len = 0x80001302
+    type_len = 2147488514
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1721,10 +1830,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001302)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488514)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1754,7 +1863,7 @@
         q.text('}')
 
 class ip_proto(OXM):
-    type_len = 0x80001401
+    type_len = 2147488769
 
     def __init__(self, value=None):
         if value != None:
@@ -1775,9 +1884,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001401)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488769)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1803,7 +1912,7 @@
         q.text('}')
 
 class ip_proto_masked(OXM):
-    type_len = 0x80001502
+    type_len = 2147489026
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1829,10 +1938,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001502)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489026)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1862,7 +1971,7 @@
         q.text('}')
 
 class ipv4_dst(OXM):
-    type_len = 0x80001804
+    type_len = 2147489796
 
     def __init__(self, value=None):
         if value != None:
@@ -1883,9 +1992,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001804)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489796)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1911,7 +2020,7 @@
         q.text('}')
 
 class ipv4_dst_masked(OXM):
-    type_len = 0x80001908
+    type_len = 2147490056
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1937,10 +2046,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001908)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490056)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1970,7 +2079,7 @@
         q.text('}')
 
 class ipv4_src(OXM):
-    type_len = 0x80001604
+    type_len = 2147489284
 
     def __init__(self, value=None):
         if value != None:
@@ -1991,9 +2100,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001604)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489284)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2019,7 +2128,7 @@
         q.text('}')
 
 class ipv4_src_masked(OXM):
-    type_len = 0x80001708
+    type_len = 2147489544
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2045,10 +2154,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001708)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489544)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2078,7 +2187,7 @@
         q.text('}')
 
 class ipv6_dst(OXM):
-    type_len = 0x80003610
+    type_len = 2147497488
 
     def __init__(self, value=None):
         if value != None:
@@ -2099,8 +2208,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003610)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497488)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2127,7 +2236,7 @@
         q.text('}')
 
 class ipv6_dst_masked(OXM):
-    type_len = 0x80003720
+    type_len = 2147497760
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2153,8 +2262,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003720)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497760)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2186,7 +2295,7 @@
         q.text('}')
 
 class ipv6_flabel(OXM):
-    type_len = 0x80003804
+    type_len = 2147497988
 
     def __init__(self, value=None):
         if value != None:
@@ -2207,9 +2316,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003804)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497988)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2235,7 +2344,7 @@
         q.text('}')
 
 class ipv6_flabel_masked(OXM):
-    type_len = 0x80003908
+    type_len = 2147498248
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2261,10 +2370,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003908)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498248)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2294,7 +2403,7 @@
         q.text('}')
 
 class ipv6_nd_sll(OXM):
-    type_len = 0x80004006
+    type_len = 2147500038
 
     def __init__(self, value=None):
         if value != None:
@@ -2315,8 +2424,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004006)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500038)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -2343,7 +2452,7 @@
         q.text('}')
 
 class ipv6_nd_sll_masked(OXM):
-    type_len = 0x8000410c
+    type_len = 2147500300
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2369,8 +2478,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000410c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500300)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -2402,7 +2511,7 @@
         q.text('}')
 
 class ipv6_nd_target(OXM):
-    type_len = 0x80003e10
+    type_len = 2147499536
 
     def __init__(self, value=None):
         if value != None:
@@ -2423,8 +2532,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003e10)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499536)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2451,7 +2560,7 @@
         q.text('}')
 
 class ipv6_nd_target_masked(OXM):
-    type_len = 0x80003f20
+    type_len = 2147499808
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2477,8 +2586,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003f20)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499808)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2510,7 +2619,7 @@
         q.text('}')
 
 class ipv6_nd_tll(OXM):
-    type_len = 0x80004206
+    type_len = 2147500550
 
     def __init__(self, value=None):
         if value != None:
@@ -2531,8 +2640,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004206)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500550)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -2559,7 +2668,7 @@
         q.text('}')
 
 class ipv6_nd_tll_masked(OXM):
-    type_len = 0x8000430c
+    type_len = 2147500812
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2585,8 +2694,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000430c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500812)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -2618,7 +2727,7 @@
         q.text('}')
 
 class ipv6_src(OXM):
-    type_len = 0x80003410
+    type_len = 2147496976
 
     def __init__(self, value=None):
         if value != None:
@@ -2639,8 +2748,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003410)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496976)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2667,7 +2776,7 @@
         q.text('}')
 
 class ipv6_src_masked(OXM):
-    type_len = 0x80003520
+    type_len = 2147497248
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2693,8 +2802,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003520)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497248)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2726,7 +2835,7 @@
         q.text('}')
 
 class metadata(OXM):
-    type_len = 0x80000408
+    type_len = 2147484680
 
     def __init__(self, value=None):
         if value != None:
@@ -2747,9 +2856,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000408)
-        obj.value = reader.read('!Q')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484680)
+        obj.value = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -2775,7 +2884,7 @@
         q.text('}')
 
 class metadata_masked(OXM):
-    type_len = 0x80000510
+    type_len = 2147484944
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2801,10 +2910,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000510)
-        obj.value = reader.read('!Q')[0]
-        obj.value_mask = reader.read('!Q')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484944)
+        obj.value = reader.read("!Q")[0]
+        obj.value_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -2834,7 +2943,7 @@
         q.text('}')
 
 class mpls_label(OXM):
-    type_len = 0x80004404
+    type_len = 2147501060
 
     def __init__(self, value=None):
         if value != None:
@@ -2855,9 +2964,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004404)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501060)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2883,7 +2992,7 @@
         q.text('}')
 
 class mpls_label_masked(OXM):
-    type_len = 0x80004508
+    type_len = 2147501320
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2909,10 +3018,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004508)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501320)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2942,7 +3051,7 @@
         q.text('}')
 
 class mpls_tc(OXM):
-    type_len = 0x80004601
+    type_len = 2147501569
 
     def __init__(self, value=None):
         if value != None:
@@ -2963,9 +3072,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004601)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501569)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -2991,7 +3100,7 @@
         q.text('}')
 
 class mpls_tc_masked(OXM):
-    type_len = 0x80004702
+    type_len = 2147501826
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3017,10 +3126,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004702)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501826)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3050,7 +3159,7 @@
         q.text('}')
 
 class sctp_dst(OXM):
-    type_len = 0x80002402
+    type_len = 2147492866
 
     def __init__(self, value=None):
         if value != None:
@@ -3071,9 +3180,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002402)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492866)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3099,7 +3208,7 @@
         q.text('}')
 
 class sctp_dst_masked(OXM):
-    type_len = 0x80002504
+    type_len = 2147493124
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3125,10 +3234,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002504)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493124)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3158,7 +3267,7 @@
         q.text('}')
 
 class sctp_src(OXM):
-    type_len = 0x80002202
+    type_len = 2147492354
 
     def __init__(self, value=None):
         if value != None:
@@ -3179,9 +3288,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002202)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492354)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3207,7 +3316,7 @@
         q.text('}')
 
 class sctp_src_masked(OXM):
-    type_len = 0x80002304
+    type_len = 2147492612
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3233,10 +3342,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002304)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492612)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3265,8 +3374,116 @@
             q.breakable()
         q.text('}')
 
+class src_meta_id(OXM):
+    type_len = 258049
+
+    def __init__(self, value=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = src_meta_id()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258049)
+        obj.value = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: 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("src_meta_id {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+            q.breakable()
+        q.text('}')
+
+class src_meta_id_masked(OXM):
+    type_len = 258306
+
+    def __init__(self, value=None, value_mask=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+        if value_mask != None:
+            self.value_mask = value_mask
+        else:
+            self.value_mask = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        packed.append(struct.pack("!B", self.value_mask))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = src_meta_id_masked()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258306)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: return False
+        if self.value_mask != other.value_mask: 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("src_meta_id_masked {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+                q.text(","); q.breakable()
+                q.text("value_mask = ");
+                q.text("%#x" % self.value_mask)
+            q.breakable()
+        q.text('}')
+
 class tcp_dst(OXM):
-    type_len = 0x80001c02
+    type_len = 2147490818
 
     def __init__(self, value=None):
         if value != None:
@@ -3287,9 +3504,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001c02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490818)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3315,7 +3532,7 @@
         q.text('}')
 
 class tcp_dst_masked(OXM):
-    type_len = 0x80001d04
+    type_len = 2147491076
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3341,10 +3558,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001d04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491076)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3374,7 +3591,7 @@
         q.text('}')
 
 class tcp_src(OXM):
-    type_len = 0x80001a02
+    type_len = 2147490306
 
     def __init__(self, value=None):
         if value != None:
@@ -3395,9 +3612,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490306)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3423,7 +3640,7 @@
         q.text('}')
 
 class tcp_src_masked(OXM):
-    type_len = 0x80001b04
+    type_len = 2147490564
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3449,10 +3666,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490564)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3482,7 +3699,7 @@
         q.text('}')
 
 class udp_dst(OXM):
-    type_len = 0x80002002
+    type_len = 2147491842
 
     def __init__(self, value=None):
         if value != None:
@@ -3503,9 +3720,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002002)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491842)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3531,7 +3748,7 @@
         q.text('}')
 
 class udp_dst_masked(OXM):
-    type_len = 0x80002104
+    type_len = 2147492100
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3557,10 +3774,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002104)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492100)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3590,7 +3807,7 @@
         q.text('}')
 
 class udp_src(OXM):
-    type_len = 0x80001e02
+    type_len = 2147491330
 
     def __init__(self, value=None):
         if value != None:
@@ -3611,9 +3828,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001e02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491330)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3639,7 +3856,7 @@
         q.text('}')
 
 class udp_src_masked(OXM):
-    type_len = 0x80001f04
+    type_len = 2147491588
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3665,10 +3882,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001f04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491588)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3698,7 +3915,7 @@
         q.text('}')
 
 class vlan_pcp(OXM):
-    type_len = 0x80000e01
+    type_len = 2147487233
 
     def __init__(self, value=None):
         if value != None:
@@ -3719,9 +3936,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000e01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487233)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3747,7 +3964,7 @@
         q.text('}')
 
 class vlan_pcp_masked(OXM):
-    type_len = 0x80000f02
+    type_len = 2147487490
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3773,10 +3990,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000f02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487490)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3806,7 +4023,7 @@
         q.text('}')
 
 class vlan_vid(OXM):
-    type_len = 0x80000c02
+    type_len = 2147486722
 
     def __init__(self, value=None):
         if value != None:
@@ -3827,9 +4044,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000c02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486722)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3855,7 +4072,7 @@
         q.text('}')
 
 class vlan_vid_masked(OXM):
-    type_len = 0x80000d04
+    type_len = 2147486980
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3881,10 +4098,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000d04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486980)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3915,6 +4132,10 @@
 
 
 parsers = {
+    258049 : src_meta_id.unpack,
+    258306 : src_meta_id_masked.unpack,
+    258561 : dst_meta_id.unpack,
+    258818 : dst_meta_id_masked.unpack,
     2147483652 : in_port.unpack,
     2147483912 : in_port_masked.unpack,
     2147484164 : in_phy_port.unpack,
diff --git a/src/python/loxi/of12/util.py b/src/python/loxi/of12/util.py
index d431d4c..56b5729 100644
--- a/src/python/loxi/of12/util.py
+++ b/src/python/loxi/of12/util.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 util.py
 # Do not modify
@@ -35,3 +36,36 @@
         if v == v2:
             return k
     return v
+
+def pack_port_no(value):
+    return struct.pack("!L", value)
+
+def unpack_port_no(reader):
+    return reader.read("!L")[0]
+
+def pack_fm_cmd(value):
+    return struct.pack("!B", value)
+
+def unpack_fm_cmd(reader):
+    return reader.read("!B")[0]
+
+def init_wc_bmap():
+    return 0
+
+def pack_wc_bmap(value):
+    return struct.pack("!Q", value)
+
+def unpack_wc_bmap(reader):
+    return reader.read("!Q")[0]
+
+def init_match_bmap():
+    return 0
+
+def pack_match_bmap(value):
+    return struct.pack("!Q", value)
+
+def unpack_match_bmap(reader):
+    return reader.read("!Q")[0]
+
+def pack_list(values):
+    return "".join([x.pack() for x in values])
diff --git a/src/python/loxi/of13/__init__.py b/src/python/loxi/of13/__init__.py
index 48364b1..2099537 100644
--- a/src/python/loxi/of13/__init__.py
+++ b/src/python/loxi/of13/__init__.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 init.py
 # Do not modify
diff --git a/src/python/loxi/of13/action.py b/src/python/loxi/of13/action.py
index 2a0629c..645916a 100644
--- a/src/python/loxi/of13/action.py
+++ b/src/python/loxi/of13/action.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 action.py
 # Do not modify
@@ -23,8 +24,8 @@
     pass
 
 class bsn_mirror(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 1
 
     def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
@@ -63,16 +64,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 1)
-        obj.dest_port = reader.read('!L')[0]
-        obj.vlan_tag = reader.read('!L')[0]
-        obj.copy_stage = reader.read('!B')[0]
+        obj.dest_port = reader.read("!L")[0]
+        obj.vlan_tag = reader.read("!L")[0]
+        obj.copy_stage = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -107,8 +108,8 @@
         q.text('}')
 
 class bsn_set_tunnel_dst(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    type = 65535
+    experimenter = 6035143
     subtype = 2
 
     def __init__(self, dst=None):
@@ -136,14 +137,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 2)
-        obj.dst = reader.read('!L')[0]
+        obj.dst = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -169,7 +170,7 @@
         q.text('}')
 
 class copy_ttl_in(Action):
-    type = const.OFPAT_COPY_TTL_IN
+    type = 12
 
     def __init__(self):
         return
@@ -190,9 +191,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_IN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 12)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -216,7 +217,7 @@
         q.text('}')
 
 class copy_ttl_out(Action):
-    type = const.OFPAT_COPY_TTL_OUT
+    type = 11
 
     def __init__(self):
         return
@@ -237,9 +238,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_COPY_TTL_OUT)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 11)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -263,7 +264,7 @@
         q.text('}')
 
 class dec_mpls_ttl(Action):
-    type = const.OFPAT_DEC_MPLS_TTL
+    type = 16
 
     def __init__(self):
         return
@@ -284,9 +285,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_MPLS_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 16)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -310,7 +311,7 @@
         q.text('}')
 
 class dec_nw_ttl(Action):
-    type = const.OFPAT_DEC_NW_TTL
+    type = 24
 
     def __init__(self):
         return
@@ -331,9 +332,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_DEC_NW_TTL)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 24)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -357,7 +358,7 @@
         q.text('}')
 
 class group(Action):
-    type = const.OFPAT_GROUP
+    type = 22
 
     def __init__(self, group_id=None):
         if group_id != None:
@@ -382,10 +383,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_GROUP)
-        _len = reader.read('!H')[0]
-        obj.group_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 22)
+        _len = reader.read("!H")[0]
+        obj.group_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -411,8 +412,8 @@
         q.text('}')
 
 class nicira_dec_ttl(Action):
-    type = const.OFPAT_EXPERIMENTER
-    experimenter = 0x2320
+    type = 65535
+    experimenter = 8992
     subtype = 18
 
     def __init__(self):
@@ -437,12 +438,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x2320)
-        _subtype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 8992)
+        _subtype = reader.read("!H")[0]
         assert(_subtype == 18)
         reader.skip(2)
         reader.skip(4)
@@ -468,7 +469,7 @@
         q.text('}')
 
 class output(Action):
-    type = const.OFPAT_OUTPUT
+    type = 0
 
     def __init__(self, port=None, max_len=None):
         if port != None:
@@ -485,7 +486,7 @@
         packed = []
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append(struct.pack("!H", self.max_len))
         packed.append('\x00' * 6)
         length = sum([len(x) for x in packed])
@@ -499,11 +500,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_OUTPUT)
-        _len = reader.read('!H')[0]
-        obj.port = reader.read('!L')[0]
-        obj.max_len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _len = reader.read("!H")[0]
+        obj.port = util.unpack_port_no(reader)
+        obj.max_len = reader.read("!H")[0]
         reader.skip(6)
         return obj
 
@@ -534,7 +535,7 @@
         q.text('}')
 
 class pop_mpls(Action):
-    type = const.OFPAT_POP_MPLS
+    type = 20
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -560,10 +561,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 20)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -590,7 +591,7 @@
         q.text('}')
 
 class pop_pbb(Action):
-    type = const.OFPAT_POP_PBB
+    type = 27
 
     def __init__(self):
         return
@@ -611,9 +612,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_PBB)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 27)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -637,7 +638,7 @@
         q.text('}')
 
 class pop_vlan(Action):
-    type = const.OFPAT_POP_VLAN
+    type = 18
 
     def __init__(self):
         return
@@ -658,9 +659,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_POP_VLAN)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 18)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -684,7 +685,7 @@
         q.text('}')
 
 class push_mpls(Action):
-    type = const.OFPAT_PUSH_MPLS
+    type = 19
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -710,10 +711,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_MPLS)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 19)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -740,7 +741,7 @@
         q.text('}')
 
 class push_pbb(Action):
-    type = const.OFPAT_PUSH_PBB
+    type = 26
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -766,10 +767,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_PBB)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 26)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -796,7 +797,7 @@
         q.text('}')
 
 class push_vlan(Action):
-    type = const.OFPAT_PUSH_VLAN
+    type = 17
 
     def __init__(self, ethertype=None):
         if ethertype != None:
@@ -822,10 +823,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_PUSH_VLAN)
-        _len = reader.read('!H')[0]
-        obj.ethertype = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 17)
+        _len = reader.read("!H")[0]
+        obj.ethertype = reader.read("!H")[0]
         reader.skip(2)
         return obj
 
@@ -852,13 +853,13 @@
         q.text('}')
 
 class set_field(Action):
-    type = const.OFPAT_SET_FIELD
+    type = 25
 
     def __init__(self, field=None):
         if field != None:
             self.field = field
         else:
-            self.field = ""
+            self.field = ''
         return
 
     def pack(self):
@@ -877,9 +878,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_FIELD)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 25)
+        _len = reader.read("!H")[0]
         obj.field = str(reader.read_all())
         return obj
 
@@ -906,7 +907,7 @@
         q.text('}')
 
 class set_mpls_ttl(Action):
-    type = const.OFPAT_SET_MPLS_TTL
+    type = 15
 
     def __init__(self, mpls_ttl=None):
         if mpls_ttl != None:
@@ -932,10 +933,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_MPLS_TTL)
-        _len = reader.read('!H')[0]
-        obj.mpls_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 15)
+        _len = reader.read("!H")[0]
+        obj.mpls_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -962,7 +963,7 @@
         q.text('}')
 
 class set_nw_ttl(Action):
-    type = const.OFPAT_SET_NW_TTL
+    type = 23
 
     def __init__(self, nw_ttl=None):
         if nw_ttl != None:
@@ -988,10 +989,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_NW_TTL)
-        _len = reader.read('!H')[0]
-        obj.nw_ttl = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 23)
+        _len = reader.read("!H")[0]
+        obj.nw_ttl = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1018,7 +1019,7 @@
         q.text('}')
 
 class set_queue(Action):
-    type = const.OFPAT_SET_QUEUE
+    type = 21
 
     def __init__(self, queue_id=None):
         if queue_id != None:
@@ -1043,10 +1044,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPAT_SET_QUEUE)
-        _len = reader.read('!H')[0]
-        obj.queue_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 21)
+        _len = reader.read("!H")[0]
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1088,24 +1089,31 @@
         raise loxi.ProtocolError("unexpected BSN experimenter subtype %#x" % subtype)
 
 parsers = {
-    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
-    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
-    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
-    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
-    const.OFPAT_EXPERIMENTER : parse_experimenter,
-    const.OFPAT_GROUP : group.unpack,
     const.OFPAT_OUTPUT : output.unpack,
-    const.OFPAT_POP_MPLS : pop_mpls.unpack,
-    const.OFPAT_POP_PBB : pop_pbb.unpack,
+    const.OFPAT_COPY_TTL_OUT : copy_ttl_out.unpack,
+    const.OFPAT_COPY_TTL_IN : copy_ttl_in.unpack,
+    const.OFPAT_SET_MPLS_TTL : set_mpls_ttl.unpack,
+    const.OFPAT_DEC_MPLS_TTL : dec_mpls_ttl.unpack,
+    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
     const.OFPAT_POP_VLAN : pop_vlan.unpack,
     const.OFPAT_PUSH_MPLS : push_mpls.unpack,
-    const.OFPAT_PUSH_PBB : push_pbb.unpack,
-    const.OFPAT_PUSH_VLAN : push_vlan.unpack,
-    const.OFPAT_SET_FIELD : set_field.unpack,
-    const.OFPAT_SET_MPLS_TTL : set_mpls_ttl.unpack,
-    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_POP_MPLS : pop_mpls.unpack,
     const.OFPAT_SET_QUEUE : set_queue.unpack,
+    const.OFPAT_GROUP : group.unpack,
+    const.OFPAT_SET_NW_TTL : set_nw_ttl.unpack,
+    const.OFPAT_DEC_NW_TTL : dec_nw_ttl.unpack,
+    const.OFPAT_SET_FIELD : set_field.unpack,
+    const.OFPAT_PUSH_PBB : push_pbb.unpack,
+    const.OFPAT_POP_PBB : pop_pbb.unpack,
+    const.OFPAT_EXPERIMENTER : parse_experimenter,
 }
 
 experimenter_parsers = {
+    8992 : {
+        18: nicira_dec_ttl.unpack,
+    },
+    6035143 : {
+        1: bsn_mirror.unpack,
+        2: bsn_set_tunnel_dst.unpack,
+    },
 }
diff --git a/src/python/loxi/of13/common.py b/src/python/loxi/of13/common.py
index 84572eb..e3f9921 100644
--- a/src/python/loxi/of13/common.py
+++ b/src/python/loxi/of13/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
@@ -59,1100 +60,6 @@
         return meter_stats.unpack(reader.slice(length))
     return loxi.generic_util.unpack_list(reader, wrapper)
 
-class action_id_bsn_mirror(object):
-
-    def __init__(self, type=None, experimenter=None, subtype=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        if experimenter != None:
-            self.experimenter = experimenter
-        else:
-            self.experimenter = 0
-        if subtype != None:
-            self.subtype = subtype
-        else:
-            self.subtype = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.experimenter))
-        packed.append(struct.pack("!L", self.subtype))
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_bsn_mirror()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!L')[0]
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: return False
-        if self.experimenter != other.experimenter: return False
-        if self.subtype != other.subtype: 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("action_id_bsn_mirror {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
-                q.text("experimenter = ");
-                q.text("%#x" % self.experimenter)
-                q.text(","); q.breakable()
-                q.text("subtype = ");
-                q.text("%#x" % self.subtype)
-            q.breakable()
-        q.text('}')
-
-class action_id_bsn_set_tunnel_dst(object):
-
-    def __init__(self, type=None, experimenter=None, subtype=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        if experimenter != None:
-            self.experimenter = experimenter
-        else:
-            self.experimenter = 0
-        if subtype != None:
-            self.subtype = subtype
-        else:
-            self.subtype = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.experimenter))
-        packed.append(struct.pack("!L", self.subtype))
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_bsn_set_tunnel_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!L')[0]
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: return False
-        if self.experimenter != other.experimenter: return False
-        if self.subtype != other.subtype: 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("action_id_bsn_set_tunnel_dst {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
-                q.text("experimenter = ");
-                q.text("%#x" % self.experimenter)
-                q.text(","); q.breakable()
-                q.text("subtype = ");
-                q.text("%#x" % self.subtype)
-            q.breakable()
-        q.text('}')
-
-class action_id_copy_ttl_in(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_copy_ttl_in()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_copy_ttl_in {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_copy_ttl_out(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_copy_ttl_out()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_copy_ttl_out {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_dec_mpls_ttl(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_dec_mpls_ttl()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_dec_mpls_ttl {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_dec_nw_ttl(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_dec_nw_ttl()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_dec_nw_ttl {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_experimenter(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_experimenter()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_experimenter {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_group(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_group()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_group {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_nicira_dec_ttl(object):
-
-    def __init__(self, type=None, experimenter=None, subtype=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        if experimenter != None:
-            self.experimenter = experimenter
-        else:
-            self.experimenter = 0
-        if subtype != None:
-            self.subtype = subtype
-        else:
-            self.subtype = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append(struct.pack("!L", self.experimenter))
-        packed.append(struct.pack("!H", self.subtype))
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_nicira_dec_ttl()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!H')[0]
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: return False
-        if self.experimenter != other.experimenter: return False
-        if self.subtype != other.subtype: 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("action_id_nicira_dec_ttl {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
-                q.text("experimenter = ");
-                q.text("%#x" % self.experimenter)
-                q.text(","); q.breakable()
-                q.text("subtype = ");
-                q.text("%#x" % self.subtype)
-            q.breakable()
-        q.text('}')
-
-class action_id_output(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_output()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_output {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_pop_mpls(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_pop_mpls()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_pop_mpls {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_pop_pbb(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_pop_pbb()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_pop_pbb {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_pop_vlan(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_pop_vlan()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_pop_vlan {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_push_mpls(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_push_mpls()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_push_mpls {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_push_pbb(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_push_pbb()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_push_pbb {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_push_vlan(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_push_vlan()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_push_vlan {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_set_field(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_set_field()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_set_field {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_set_mpls_ttl(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_set_mpls_ttl()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_set_mpls_ttl {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_set_nw_ttl(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_set_nw_ttl()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_set_nw_ttl {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
-class action_id_set_queue(object):
-
-    def __init__(self, type=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
-        return
-
-    def pack(self):
-        packed = []
-        packed.append(struct.pack("!H", self.type))
-        packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
-        packed.append('\x00' * 4)
-        length = sum([len(x) for x in packed])
-        packed[1] = struct.pack("!H", length)
-        return ''.join(packed)
-
-    @staticmethod
-    def unpack(buf):
-        obj = action_id_set_queue()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _len = reader.read('!H')[0]
-        reader.skip(4)
-        return obj
-
-    def __eq__(self, other):
-        if type(self) != type(other): return False
-        if self.type != other.type: 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("action_id_set_queue {")
-        with q.group():
-            with q.indent(2):
-                q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-            q.breakable()
-        q.text('}')
-
 class bsn_interface(object):
 
     def __init__(self, hw_addr=None, name=None, ipv4_addr=None, ipv4_netmask=None):
@@ -1193,8 +100,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):
@@ -1231,6 +138,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):
@@ -1256,10 +257,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)
@@ -1271,10 +272,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
@@ -1339,8 +340,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):
@@ -1433,7 +434,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)
@@ -1445,18 +446,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
@@ -1546,7 +547,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)
@@ -1558,10 +559,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
 
@@ -1639,7 +640,7 @@
         packed.append(struct.pack("!Q", self.byte_count))
         packed.append(struct.pack("!L", self.duration_sec))
         packed.append(struct.pack("!L", self.duration_nsec))
-        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)
@@ -1651,15 +652,15 @@
             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.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
         obj.bucket_stats = loxi.generic_util.unpack_list(reader, common.bucket_counter.unpack)
         return obj
 
@@ -1710,7 +711,7 @@
         q.text('}')
 
 class hello_elem_versionbitmap(object):
-    type = const.OFPHET_VERSIONBITMAP
+    type = 1
 
     def __init__(self, bitmaps=None):
         if bitmaps != None:
@@ -1723,7 +724,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.bitmaps]))
+        packed.append(util.pack_list(self.bitmaps))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1735,9 +736,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPHET_VERSIONBITMAP)
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
         obj.bitmaps = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
@@ -1777,7 +778,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))
@@ -1790,9 +791,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
@@ -1845,8 +846,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.packet_band_count = reader.read('!Q')[0]
-        obj.byte_band_count = reader.read('!Q')[0]
+        obj.packet_band_count = reader.read("!Q")[0]
+        obj.byte_band_count = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -1897,7 +898,7 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 0
         packed.append(struct.pack("!H", self.flags))
         packed.append(struct.pack("!L", self.meter_id))
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -1909,9 +910,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _length = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.meter_id = reader.read('!L')[0]
+        _length = reader.read("!H")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.meter_id = reader.read("!L")[0]
         obj.entries = meter_band.unpack_list(reader)
         return obj
 
@@ -1987,11 +988,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.max_meter = reader.read('!L')[0]
-        obj.band_types = reader.read('!L')[0]
-        obj.capabilities = reader.read('!L')[0]
-        obj.max_bands = reader.read('!B')[0]
-        obj.max_color = reader.read('!B')[0]
+        obj.max_meter = reader.read("!L")[0]
+        obj.band_types = reader.read("!L")[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.max_bands = reader.read("!B")[0]
+        obj.max_color = reader.read("!B")[0]
         reader.skip(2)
         return obj
 
@@ -2076,7 +1077,7 @@
         packed.append(struct.pack("!Q", self.byte_in_count))
         packed.append(struct.pack("!L", self.duration_sec))
         packed.append(struct.pack("!L", self.duration_nsec))
-        packed.append("".join([x.pack() for x in self.band_stats]))
+        packed.append(util.pack_list(self.band_stats))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2088,14 +1089,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.meter_id = reader.read('!L')[0]
-        _len = reader.read('!H')[0]
+        obj.meter_id = reader.read("!L")[0]
+        _len = reader.read("!H")[0]
         reader.skip(6)
-        obj.flow_count = reader.read('!L')[0]
-        obj.packet_in_count = reader.read('!Q')[0]
-        obj.byte_in_count = reader.read('!Q')[0]
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
+        obj.flow_count = reader.read("!L")[0]
+        obj.packet_in_count = reader.read("!Q")[0]
+        obj.byte_in_count = reader.read("!Q")[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
         obj.band_stats = loxi.generic_util.unpack_list(reader, common.meter_band_stats.unpack)
         return obj
 
@@ -2165,10 +1166,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)
@@ -2180,9 +1181,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
@@ -2268,7 +1269,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)
@@ -2290,19 +1291,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):
@@ -2434,7 +1435,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))
@@ -2459,22 +1460,22 @@
             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.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[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]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2556,7 +1557,7 @@
         q.text('}')
 
 class queue_prop_experimenter(object):
-    type = const.OFPQT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, experimenter=None, data=None):
         if experimenter != None:
@@ -2566,7 +1567,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
         return
 
     def pack(self):
@@ -2588,11 +1589,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
@@ -2624,7 +1625,7 @@
         q.text('}')
 
 class queue_prop_max_rate(object):
-    type = const.OFPQT_MAX_RATE
+    type = 2
 
     def __init__(self, rate=None):
         if rate != None:
@@ -2651,11 +1652,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
 
@@ -2682,7 +1683,7 @@
         q.text('}')
 
 class queue_prop_min_rate(object):
-    type = const.OFPQT_MIN_RATE
+    type = 1
 
     def __init__(self, rate=None):
         if rate != None:
@@ -2709,11 +1710,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
 
@@ -2774,7 +1775,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))
@@ -2790,13 +1791,13 @@
             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.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[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]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2846,12 +1847,9 @@
         q.text('}')
 
 class table_feature_prop_apply_actions(object):
+    type = 6
 
-    def __init__(self, type=None, action_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, action_ids=None):
         if action_ids != None:
             self.action_ids = action_ids
         else:
@@ -2862,7 +1860,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.action_ids]))
+        packed.append(util.pack_list(self.action_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2874,14 +1872,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
-        obj.action_ids = loxi.unimplemented('unpack list of_list_action_id_t')
+        _type = reader.read("!H")[0]
+        assert(_type == 6)
+        _length = reader.read("!H")[0]
+        obj.action_ids = loxi.unimplemented('unpack list(of_action_id_t)')
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.action_ids != other.action_ids: return False
         return True
 
@@ -2897,21 +1895,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("action_ids = ");
                 q.pp(self.action_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_apply_actions_miss(object):
+    type = 7
 
-    def __init__(self, type=None, action_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, action_ids=None):
         if action_ids != None:
             self.action_ids = action_ids
         else:
@@ -2922,7 +1914,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.action_ids]))
+        packed.append(util.pack_list(self.action_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2934,14 +1926,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
-        obj.action_ids = loxi.unimplemented('unpack list of_list_action_id_t')
+        _type = reader.read("!H")[0]
+        assert(_type == 7)
+        _length = reader.read("!H")[0]
+        obj.action_ids = loxi.unimplemented('unpack list(of_action_id_t)')
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.action_ids != other.action_ids: return False
         return True
 
@@ -2957,21 +1949,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("action_ids = ");
                 q.pp(self.action_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_apply_setfield(object):
+    type = 14
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -2982,7 +1968,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2994,14 +1980,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3017,21 +2003,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_apply_setfield_miss(object):
+    type = 15
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -3042,7 +2022,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3054,14 +2034,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 15)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3077,21 +2057,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_experimenter(object):
+    type = 65535
 
-    def __init__(self, type=None, experimenter=None, subtype=None, experimenter_data=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, experimenter=None, subtype=None, experimenter_data=None):
         if experimenter != None:
             self.experimenter = experimenter
         else:
@@ -3103,7 +2077,7 @@
         if experimenter_data != None:
             self.experimenter_data = experimenter_data
         else:
-            self.experimenter_data = ""
+            self.experimenter_data = ''
         return
 
     def pack(self):
@@ -3124,16 +2098,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
-        obj.subtype = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _length = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
+        obj.subtype = reader.read("!L")[0]
         obj.experimenter_data = str(reader.read_all())
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.experimenter != other.experimenter: return False
         if self.subtype != other.subtype: return False
         if self.experimenter_data != other.experimenter_data: return False
@@ -3151,9 +2125,6 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("experimenter = ");
                 q.text("%#x" % self.experimenter)
                 q.text(","); q.breakable()
@@ -3166,12 +2137,9 @@
         q.text('}')
 
 class table_feature_prop_instructions(object):
+    type = 0
 
-    def __init__(self, type=None, instruction_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, instruction_ids=None):
         if instruction_ids != None:
             self.instruction_ids = instruction_ids
         else:
@@ -3182,7 +2150,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.instruction_ids]))
+        packed.append(util.pack_list(self.instruction_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3194,14 +2162,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
         obj.instruction_ids = instruction.unpack_list(reader)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.instruction_ids != other.instruction_ids: return False
         return True
 
@@ -3217,21 +2185,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("instruction_ids = ");
                 q.pp(self.instruction_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_instructions_miss(object):
+    type = 1
 
-    def __init__(self, type=None, instruction_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, instruction_ids=None):
         if instruction_ids != None:
             self.instruction_ids = instruction_ids
         else:
@@ -3242,7 +2204,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.instruction_ids]))
+        packed.append(util.pack_list(self.instruction_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3254,14 +2216,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
         obj.instruction_ids = instruction.unpack_list(reader)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.instruction_ids != other.instruction_ids: return False
         return True
 
@@ -3277,21 +2239,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("instruction_ids = ");
                 q.pp(self.instruction_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_match(object):
+    type = 8
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -3302,7 +2258,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3314,14 +2270,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 8)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3337,21 +2293,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_next_tables(object):
+    type = 2
 
-    def __init__(self, type=None, next_table_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, next_table_ids=None):
         if next_table_ids != None:
             self.next_table_ids = next_table_ids
         else:
@@ -3362,7 +2312,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.next_table_ids]))
+        packed.append(util.pack_list(self.next_table_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3374,14 +2324,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _length = reader.read("!H")[0]
         obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.next_table_ids != other.next_table_ids: return False
         return True
 
@@ -3397,21 +2347,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("next_table_ids = ");
                 q.pp(self.next_table_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_next_tables_miss(object):
+    type = 3
 
-    def __init__(self, type=None, next_table_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, next_table_ids=None):
         if next_table_ids != None:
             self.next_table_ids = next_table_ids
         else:
@@ -3422,7 +2366,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.next_table_ids]))
+        packed.append(util.pack_list(self.next_table_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3434,14 +2378,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _length = reader.read("!H")[0]
         obj.next_table_ids = loxi.generic_util.unpack_list(reader, common.uint8.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.next_table_ids != other.next_table_ids: return False
         return True
 
@@ -3457,21 +2401,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("next_table_ids = ");
                 q.pp(self.next_table_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_wildcards(object):
+    type = 10
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -3482,7 +2420,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3494,14 +2432,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 10)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3517,21 +2455,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_write_actions(object):
+    type = 4
 
-    def __init__(self, type=None, action_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, action_ids=None):
         if action_ids != None:
             self.action_ids = action_ids
         else:
@@ -3542,7 +2474,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.action_ids]))
+        packed.append(util.pack_list(self.action_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3554,14 +2486,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
-        obj.action_ids = loxi.unimplemented('unpack list of_list_action_id_t')
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.action_ids = loxi.unimplemented('unpack list(of_action_id_t)')
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.action_ids != other.action_ids: return False
         return True
 
@@ -3577,21 +2509,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("action_ids = ");
                 q.pp(self.action_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_write_actions_miss(object):
+    type = 5
 
-    def __init__(self, type=None, action_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, action_ids=None):
         if action_ids != None:
             self.action_ids = action_ids
         else:
@@ -3602,7 +2528,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.action_ids]))
+        packed.append(util.pack_list(self.action_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3614,14 +2540,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
-        obj.action_ids = loxi.unimplemented('unpack list of_list_action_id_t')
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _length = reader.read("!H")[0]
+        obj.action_ids = loxi.unimplemented('unpack list(of_action_id_t)')
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.action_ids != other.action_ids: return False
         return True
 
@@ -3637,21 +2563,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("action_ids = ");
                 q.pp(self.action_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_write_setfield(object):
+    type = 12
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -3662,7 +2582,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3674,14 +2594,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 12)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3697,21 +2617,15 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
         q.text('}')
 
 class table_feature_prop_write_setfield_miss(object):
+    type = 13
 
-    def __init__(self, type=None, oxm_ids=None):
-        if type != None:
-            self.type = type
-        else:
-            self.type = 0
+    def __init__(self, oxm_ids=None):
         if oxm_ids != None:
             self.oxm_ids = oxm_ids
         else:
@@ -3722,7 +2636,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_ids]))
+        packed.append(util.pack_list(self.oxm_ids))
         length = sum([len(x) for x in packed])
         packed[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3734,14 +2648,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.type = reader.read('!H')[0]
-        _length = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 13)
+        _length = reader.read("!H")[0]
         obj.oxm_ids = loxi.generic_util.unpack_list(reader, common.uint32.unpack)
         return obj
 
     def __eq__(self, other):
         if type(self) != type(other): return False
-        if self.type != other.type: return False
         if self.oxm_ids != other.oxm_ids: return False
         return True
 
@@ -3757,9 +2671,6 @@
         with q.group():
             with q.indent(2):
                 q.breakable()
-                q.text("type = ");
-                q.text("%#x" % self.type)
-                q.text(","); q.breakable()
                 q.text("oxm_ids = ");
                 q.pp(self.oxm_ids)
             q.breakable()
@@ -3808,7 +2719,7 @@
         packed.append(struct.pack("!Q", self.metadata_write))
         packed.append(struct.pack("!L", self.config))
         packed.append(struct.pack("!L", self.max_entries))
-        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[0] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3820,15 +2731,15 @@
             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(5)
         obj.name = reader.read("!32s")[0].rstrip("\x00")
-        obj.metadata_match = reader.read('!Q')[0]
-        obj.metadata_write = reader.read('!Q')[0]
-        obj.config = reader.read('!L')[0]
-        obj.max_entries = reader.read('!L')[0]
-        obj.properties = loxi.unimplemented('unpack list of_list_table_feature_prop_t')
+        obj.metadata_match = reader.read("!Q")[0]
+        obj.metadata_write = reader.read("!Q")[0]
+        obj.config = reader.read("!L")[0]
+        obj.max_entries = reader.read("!L")[0]
+        obj.properties = loxi.unimplemented('unpack list(of_table_feature_prop_t)')
         return obj
 
     def __eq__(self, other):
@@ -3914,11 +2825,11 @@
             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(3)
-        obj.active_count = reader.read('!L')[0]
-        obj.lookup_count = reader.read('!Q')[0]
-        obj.matched_count = reader.read('!Q')[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):
@@ -3976,7 +2887,7 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.value = reader.read('!L')[0]
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -4022,7 +2933,7 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        obj.value = reader.read('!B')[0]
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
diff --git a/src/python/loxi/of13/const.py b/src/python/loxi/of13/const.py
index c04b1db..e2545f1 100644
--- a/src/python/loxi/of13/const.py
+++ b/src/python/loxi/of13/const.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 const.py
 # Do not modify
@@ -8,21 +9,21 @@
 OFP_VERSION = 4
 
 # Identifiers from group macro_definitions
-OFP_VLAN_NONE = 0
-OFP_FLOW_PERMANENT = 0
-OFP_ETH_ALEN = 6
-OFP_MAX_PORT_NAME_LEN = 16
 OFP_MAX_TABLE_NAME_LEN = 32
-SERIAL_NUM_LEN = 32
-OFP_DEFAULT_MISS_SEND_LEN = 128
-DESC_STR_LEN = 256
+OFP_MAX_PORT_NAME_LEN = 16
 OFP_TCP_PORT = 6633
 OFP_SSL_PORT = 6633
+OFP_ETH_ALEN = 6
+OFP_DEFAULT_MISS_SEND_LEN = 128
+OFP_VLAN_NONE = 0
+OFP_FLOW_PERMANENT = 0
 OFP_DEFAULT_PRIORITY = 32768
-OFPQ_MIN_RATE_UNCFG = 65535
-OFPQ_MAX_RATE_UNCFG = 65535
-OFPQ_ALL = 4294967295
 OFP_NO_BUFFER = 4294967295
+DESC_STR_LEN = 256
+SERIAL_NUM_LEN = 32
+OFPQ_ALL = 4294967295
+OFPQ_MAX_RATE_UNCFG = 65535
+OFPQ_MIN_RATE_UNCFG = 65535
 
 # Identifiers from group ofp_action_type
 OFPAT_OUTPUT = 0
@@ -185,6 +186,13 @@
     13: 'OFPBRC_MULTIPART_BUFFER_OVERFLOW',
 }
 
+# Identifiers from group ofp_bsn_vport_q_in_q_untagged
+OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 65535
+
+ofp_bsn_vport_q_in_q_untagged_map = {
+    65535: 'OF_BSN_VPORT_Q_IN_Q_UNTAGGED',
+}
+
 # Identifiers from group ofp_capabilities
 OFPC_FLOW_STATS = 1
 OFPC_TABLE_STATS = 2
diff --git a/src/python/loxi/of13/instruction.py b/src/python/loxi/of13/instruction.py
index 08b5124..5b825d0 100644
--- a/src/python/loxi/of13/instruction.py
+++ b/src/python/loxi/of13/instruction.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 instruction.py
 # Do not modify
@@ -24,7 +25,7 @@
     pass
 
 class apply_actions(Instruction):
-    type = const.OFPIT_APPLY_ACTIONS
+    type = 4
 
     def __init__(self, actions=None):
         if actions != None:
@@ -38,7 +39,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -50,9 +51,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_APPLY_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 4)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -80,7 +81,7 @@
         q.text('}')
 
 class clear_actions(Instruction):
-    type = const.OFPIT_CLEAR_ACTIONS
+    type = 5
 
     def __init__(self):
         return
@@ -101,9 +102,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_CLEAR_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 5)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -127,7 +128,7 @@
         q.text('}')
 
 class experimenter(Instruction):
-    type = const.OFPIT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, experimenter=None, data=None):
         if experimenter != None:
@@ -137,7 +138,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
         return
 
     def pack(self):
@@ -157,10 +158,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        obj.experimenter = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -191,7 +192,7 @@
         q.text('}')
 
 class goto_table(Instruction):
-    type = const.OFPIT_GOTO_TABLE
+    type = 1
 
     def __init__(self, table_id=None):
         if table_id != None:
@@ -217,10 +218,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_GOTO_TABLE)
-        _len = reader.read('!H')[0]
-        obj.table_id = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -247,7 +248,7 @@
         q.text('}')
 
 class meter(Instruction):
-    type = const.OFPIT_METER
+    type = 6
 
     def __init__(self, meter_id=None):
         if meter_id != None:
@@ -272,10 +273,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_METER)
-        _len = reader.read('!H')[0]
-        obj.meter_id = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 6)
+        _len = reader.read("!H")[0]
+        obj.meter_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -301,7 +302,7 @@
         q.text('}')
 
 class write_actions(Instruction):
-    type = const.OFPIT_WRITE_ACTIONS
+    type = 3
 
     def __init__(self, actions=None):
         if actions != None:
@@ -315,7 +316,7 @@
         packed.append(struct.pack("!H", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
         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[1] = struct.pack("!H", length)
         return ''.join(packed)
@@ -327,9 +328,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_ACTIONS)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 3)
+        _len = reader.read("!H")[0]
         reader.skip(4)
         obj.actions = action.unpack_list(reader)
         return obj
@@ -357,7 +358,7 @@
         q.text('}')
 
 class write_metadata(Instruction):
-    type = const.OFPIT_WRITE_METADATA
+    type = 2
 
     def __init__(self, metadata=None, metadata_mask=None):
         if metadata != None:
@@ -388,12 +389,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPIT_WRITE_METADATA)
-        _len = reader.read('!H')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
         reader.skip(4)
-        obj.metadata = reader.read('!Q')[0]
-        obj.metadata_mask = reader.read('!Q')[0]
+        obj.metadata = reader.read("!Q")[0]
+        obj.metadata_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -424,11 +425,11 @@
 
 
 parsers = {
+    const.OFPIT_GOTO_TABLE : goto_table.unpack,
+    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
+    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
     const.OFPIT_APPLY_ACTIONS : apply_actions.unpack,
     const.OFPIT_CLEAR_ACTIONS : clear_actions.unpack,
-    const.OFPIT_EXPERIMENTER : experimenter.unpack,
-    const.OFPIT_GOTO_TABLE : goto_table.unpack,
     const.OFPIT_METER : meter.unpack,
-    const.OFPIT_WRITE_ACTIONS : write_actions.unpack,
-    const.OFPIT_WRITE_METADATA : write_metadata.unpack,
+    const.OFPIT_EXPERIMENTER : experimenter.unpack,
 }
diff --git a/src/python/loxi/of13/message.py b/src/python/loxi/of13/message.py
index 46376d1..543442b 100644
--- a/src/python/loxi/of13/message.py
+++ b/src/python/loxi/of13/message.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 message.py
 # Do not modify
@@ -21,8 +22,8 @@
     xid = None
 
 class aggregate_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 2
 
     def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
@@ -69,19 +70,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 2)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
-        obj.flow_count = reader.read('!L')[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
+        obj.flow_count = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -132,8 +133,8 @@
         q.text('}')
 
 class aggregate_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 2
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
@@ -178,7 +179,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -196,23 +197,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 2)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -275,8 +276,8 @@
         q.text('}')
 
 class async_get_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_ASYNC_REPLY
+    version = 4
+    type = 27
 
     def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
         self.xid = xid
@@ -329,18 +330,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_ASYNC_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.packet_in_mask_equal_master = reader.read('!L')[0]
-        obj.packet_in_mask_slave = reader.read('!L')[0]
-        obj.port_status_mask_equal_master = reader.read('!L')[0]
-        obj.port_status_mask_slave = reader.read('!L')[0]
-        obj.flow_removed_mask_equal_master = reader.read('!L')[0]
-        obj.flow_removed_mask_slave = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 27)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.packet_in_mask_equal_master = reader.read("!L")[0]
+        obj.packet_in_mask_slave = reader.read("!L")[0]
+        obj.port_status_mask_equal_master = reader.read("!L")[0]
+        obj.port_status_mask_slave = reader.read("!L")[0]
+        obj.flow_removed_mask_equal_master = reader.read("!L")[0]
+        obj.flow_removed_mask_slave = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -398,8 +399,8 @@
         q.text('}')
 
 class async_get_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_ASYNC_REQUEST
+    version = 4
+    type = 26
 
     def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
         self.xid = xid
@@ -452,18 +453,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_ASYNC_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.packet_in_mask_equal_master = reader.read('!L')[0]
-        obj.packet_in_mask_slave = reader.read('!L')[0]
-        obj.port_status_mask_equal_master = reader.read('!L')[0]
-        obj.port_status_mask_slave = reader.read('!L')[0]
-        obj.flow_removed_mask_equal_master = reader.read('!L')[0]
-        obj.flow_removed_mask_slave = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 26)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.packet_in_mask_equal_master = reader.read("!L")[0]
+        obj.packet_in_mask_slave = reader.read("!L")[0]
+        obj.port_status_mask_equal_master = reader.read("!L")[0]
+        obj.port_status_mask_slave = reader.read("!L")[0]
+        obj.flow_removed_mask_equal_master = reader.read("!L")[0]
+        obj.flow_removed_mask_slave = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -521,8 +522,8 @@
         q.text('}')
 
 class async_set(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_SET_ASYNC
+    version = 4
+    type = 28
 
     def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
         self.xid = xid
@@ -575,18 +576,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_SET_ASYNC)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.packet_in_mask_equal_master = reader.read('!L')[0]
-        obj.packet_in_mask_slave = reader.read('!L')[0]
-        obj.port_status_mask_equal_master = reader.read('!L')[0]
-        obj.port_status_mask_slave = reader.read('!L')[0]
-        obj.flow_removed_mask_equal_master = reader.read('!L')[0]
-        obj.flow_removed_mask_slave = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 28)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.packet_in_mask_equal_master = reader.read("!L")[0]
+        obj.packet_in_mask_slave = reader.read("!L")[0]
+        obj.port_status_mask_equal_master = reader.read("!L")[0]
+        obj.port_status_mask_slave = reader.read("!L")[0]
+        obj.flow_removed_mask_equal_master = reader.read("!L")[0]
+        obj.flow_removed_mask_slave = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -644,8 +645,8 @@
         q.text('}')
 
 class barrier_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REPLY
+    version = 4
+    type = 21
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -668,12 +669,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 21)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -707,8 +708,8 @@
         q.text('}')
 
 class barrier_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_BARRIER_REQUEST
+    version = 4
+    type = 20
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -731,12 +732,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_BARRIER_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 20)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -769,10 +770,486 @@
             q.breakable()
         q.text('}')
 
+class bsn_bw_clear_data_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 22
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 22)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_clear_data_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 21
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_clear_data_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 21)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_clear_data_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 20
+
+    def __init__(self, xid=None, enabled=None):
+        self.xid = xid
+        if enabled != None:
+            self.enabled = enabled
+        else:
+            self.enabled = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enabled))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 20)
+        obj.enabled = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enabled != other.enabled: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enabled = ");
+                q.text("%#x" % self.enabled)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_get_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 19
+
+    def __init__(self, xid=None):
+        self.xid = xid
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_get_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 19)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_get_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 23
+
+    def __init__(self, xid=None, enable=None, status=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 23)
+        obj.enable = reader.read("!L")[0]
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_bw_enable_set_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 18
+
+    def __init__(self, xid=None, enable=None):
+        self.xid = xid
+        if enable != None:
+            self.enable = enable
+        else:
+            self.enable = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.enable))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_bw_enable_set_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 18)
+        obj.enable = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.enable != other.enable: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_bw_enable_set_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("enable = ");
+                q.text("%#x" % self.enable)
+            q.breakable()
+        q.text('}')
+
 class bsn_get_interfaces_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 10
 
     def __init__(self, xid=None, interfaces=None):
@@ -790,7 +1267,7 @@
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.experimenter))
         packed.append(struct.pack("!L", self.subtype))
-        packed.append("".join([x.pack() for x in self.interfaces]))
+        packed.append(util.pack_list(self.interfaces))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -803,15 +1280,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 10)
         obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
         return obj
@@ -851,9 +1328,9 @@
         q.text('}')
 
 class bsn_get_interfaces_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 9
 
     def __init__(self, xid=None):
@@ -879,15 +1356,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 9)
         return obj
 
@@ -922,9 +1399,9 @@
         q.text('}')
 
 class bsn_get_mirroring_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 5
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -956,17 +1433,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 5)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1005,9 +1482,9 @@
         q.text('}')
 
 class bsn_get_mirroring_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 4
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -1039,17 +1516,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 4)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1088,9 +1565,9 @@
         q.text('}')
 
 class bsn_set_mirroring(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 3
 
     def __init__(self, xid=None, report_mirror_ports=None):
@@ -1122,17 +1599,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 3)
-        obj.report_mirror_ports = reader.read('!B')[0]
+        obj.report_mirror_ports = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -1170,10 +1647,91 @@
             q.breakable()
         q.text('}')
 
-class bsn_set_pktin_suppression(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_EXPERIMENTER
-    experimenter = 0x5c16c7
+class bsn_set_pktin_suppression_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 25
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_set_pktin_suppression_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 25)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_set_pktin_suppression_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_set_pktin_suppression_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
     subtype = 11
 
     def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
@@ -1220,27 +1778,27 @@
     @staticmethod
     def unpack(buf):
         if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
-        obj = bsn_set_pktin_suppression()
+        obj = bsn_set_pktin_suppression_request()
         if type(buf) == loxi.generic_util.OFReader:
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_EXPERIMENTER)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _experimenter = reader.read('!L')[0]
-        assert(_experimenter == 0x5c16c7)
-        _subtype = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
         assert(_subtype == 11)
-        obj.enabled = reader.read('!B')[0]
+        obj.enabled = reader.read("!B")[0]
         reader.skip(1)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.cookie = reader.read('!Q')[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.cookie = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -1266,7 +1824,7 @@
         return loxi.pp.pp(self)
 
     def pretty_print(self, q):
-        q.text("bsn_set_pktin_suppression {")
+        q.text("bsn_set_pktin_suppression_request {")
         with q.group():
             with q.indent(2):
                 q.breakable()
@@ -1293,9 +1851,343 @@
             q.breakable()
         q.text('}')
 
+class bsn_virtual_port_create_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 16
+
+    def __init__(self, xid=None, status=None, vport_no=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 16)
+        obj.status = reader.read("!L")[0]
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_create_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 15
+
+    def __init__(self, xid=None, vport=None):
+        self.xid = xid
+        if vport != None:
+            self.vport = vport
+        else:
+            self.vport = common.bsn_vport_q_in_q()
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(self.vport.pack())
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_create_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 15)
+        obj.vport = common.bsn_vport_q_in_q.unpack(reader)
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport != other.vport: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_create_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport = ");
+                q.pp(self.vport)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_reply(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 26
+
+    def __init__(self, xid=None, status=None):
+        self.xid = xid
+        if status != None:
+            self.status = status
+        else:
+            self.status = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.status))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_reply()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 26)
+        obj.status = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.status != other.status: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_reply {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("status = ");
+                q.text("%#x" % self.status)
+            q.breakable()
+        q.text('}')
+
+class bsn_virtual_port_remove_request(Message):
+    version = 4
+    type = 4
+    experimenter = 6035143
+    subtype = 17
+
+    def __init__(self, xid=None, vport_no=None):
+        self.xid = xid
+        if vport_no != None:
+            self.vport_no = vport_no
+        else:
+            self.vport_no = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!B", self.version))
+        packed.append(struct.pack("!B", self.type))
+        packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+        packed.append(struct.pack("!L", self.xid))
+        packed.append(struct.pack("!L", self.experimenter))
+        packed.append(struct.pack("!L", self.subtype))
+        packed.append(struct.pack("!L", self.vport_no))
+        length = sum([len(x) for x in packed])
+        packed[2] = struct.pack("!H", length)
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+        obj = bsn_virtual_port_remove_request()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 4)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _experimenter = reader.read("!L")[0]
+        assert(_experimenter == 6035143)
+        _subtype = reader.read("!L")[0]
+        assert(_subtype == 17)
+        obj.vport_no = reader.read("!L")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.version != other.version: return False
+        if self.type != other.type: return False
+        if self.xid != other.xid: return False
+        if self.vport_no != other.vport_no: return False
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __str__(self):
+        return self.show()
+
+    def show(self):
+        import loxi.pp
+        return loxi.pp.pp(self)
+
+    def pretty_print(self, q):
+        q.text("bsn_virtual_port_remove_request {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("xid = ");
+                if self.xid != None:
+                    q.text("%#x" % self.xid)
+                else:
+                    q.text('None')
+                q.text(","); q.breakable()
+                q.text("vport_no = ");
+                q.text("%#x" % self.vport_no)
+            q.breakable()
+        q.text('}')
+
 class desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 0
 
     def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
@@ -1351,15 +2243,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 0)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
         obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
@@ -1423,8 +2315,8 @@
         q.text('}')
 
 class desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 0
 
     def __init__(self, xid=None, flags=None):
@@ -1455,15 +2347,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 0)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -1502,15 +2394,15 @@
         q.text('}')
 
 class echo_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REPLY
+    version = 4
+    type = 3
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1531,12 +2423,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 3)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1575,15 +2467,15 @@
         q.text('}')
 
 class echo_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ECHO_REQUEST
+    version = 4
+    type = 2
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1604,12 +2496,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ECHO_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 2)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1648,8 +2540,8 @@
         q.text('}')
 
 class error_msg(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ERROR
+    version = 4
+    type = 1
 
     def __init__(self, xid=None, err_type=None, code=None, data=None):
         self.xid = xid
@@ -1664,7 +2556,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -1687,14 +2579,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ERROR)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.err_type = reader.read('!H')[0]
-        obj.code = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 1)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.err_type = reader.read("!H")[0]
+        obj.code = reader.read("!H")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -1741,8 +2633,8 @@
         q.text('}')
 
 class features_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REPLY
+    version = 4
+    type = 6
 
     def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
         self.xid = xid
@@ -1796,19 +2688,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.datapath_id = reader.read('!Q')[0]
-        obj.n_buffers = reader.read('!L')[0]
-        obj.n_tables = reader.read('!B')[0]
-        obj.auxiliary_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 6)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.datapath_id = reader.read("!Q")[0]
+        obj.n_buffers = reader.read("!L")[0]
+        obj.n_tables = reader.read("!B")[0]
+        obj.auxiliary_id = reader.read("!B")[0]
         reader.skip(2)
-        obj.capabilities = reader.read('!L')[0]
-        obj.reserved = reader.read('!L')[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.reserved = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1866,8 +2758,8 @@
         q.text('}')
 
 class features_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FEATURES_REQUEST
+    version = 4
+    type = 5
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -1890,12 +2782,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FEATURES_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 5)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1929,9 +2821,9 @@
         q.text('}')
 
 class flow_add(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_ADD
+    version = 4
+    type = 14
+    _command = 0
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -1993,17 +2885,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2016,24 +2908,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_ADD)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 0)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2118,9 +3010,9 @@
         q.text('}')
 
 class flow_delete(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE
+    version = 4
+    type = 14
+    _command = 3
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2182,17 +3074,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2205,24 +3097,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 3)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2307,9 +3199,9 @@
         q.text('}')
 
 class flow_delete_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_DELETE_STRICT
+    version = 4
+    type = 14
+    _command = 4
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2371,17 +3263,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2394,24 +3286,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_DELETE_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 4)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2496,9 +3388,9 @@
         q.text('}')
 
 class flow_modify(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY
+    version = 4
+    type = 14
+    _command = 1
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2560,17 +3452,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2583,24 +3475,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 1)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2685,9 +3577,9 @@
         q.text('}')
 
 class flow_modify_strict(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_MOD
-    _command = const.OFPFC_MODIFY_STRICT
+    version = 4
+    type = 14
+    _command = 2
 
     def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
         self.xid = xid
@@ -2749,17 +3641,17 @@
         packed.append(struct.pack("!Q", self.cookie))
         packed.append(struct.pack("!Q", self.cookie_mask))
         packed.append(struct.pack("!B", self.table_id))
-        packed.append(struct.pack("!B", self._command))
+        packed.append(util.pack_fm_cmd(self._command))
         packed.append(struct.pack("!H", self.idle_timeout))
         packed.append(struct.pack("!H", self.hard_timeout))
         packed.append(struct.pack("!H", self.priority))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 2)
         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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -2772,24 +3664,24 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
-        obj.table_id = reader.read('!B')[0]
-        __command = reader.read('!B')[0]
-        assert(__command == const.OFPFC_MODIFY_STRICT)
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 14)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
+        obj.table_id = reader.read("!B")[0]
+        __command = util.unpack_fm_cmd(reader)
+        assert(__command == 2)
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(2)
         obj.match = common.match.unpack(reader)
         obj.instructions = instruction.unpack_list(reader)
@@ -2874,8 +3766,8 @@
         q.text('}')
 
 class flow_removed(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_FLOW_REMOVED
+    version = 4
+    type = 11
 
     def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
         self.xid = xid
@@ -2953,22 +3845,22 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_FLOW_REMOVED)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.cookie = reader.read('!Q')[0]
-        obj.priority = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
-        obj.duration_sec = reader.read('!L')[0]
-        obj.duration_nsec = reader.read('!L')[0]
-        obj.idle_timeout = reader.read('!H')[0]
-        obj.hard_timeout = reader.read('!H')[0]
-        obj.packet_count = reader.read('!Q')[0]
-        obj.byte_count = reader.read('!Q')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 11)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.priority = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
+        obj.duration_sec = reader.read("!L")[0]
+        obj.duration_nsec = reader.read("!L")[0]
+        obj.idle_timeout = reader.read("!H")[0]
+        obj.hard_timeout = reader.read("!H")[0]
+        obj.packet_count = reader.read("!Q")[0]
+        obj.byte_count = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -3047,8 +3939,8 @@
         q.text('}')
 
 class flow_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 1
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -3071,7 +3963,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3084,15 +3976,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 1)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_flow_stats_entry(reader)
         return obj
@@ -3136,8 +4028,8 @@
         q.text('}')
 
 class flow_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 1
 
     def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
@@ -3182,7 +4074,7 @@
         packed.append('\x00' * 4)
         packed.append(struct.pack("!B", self.table_id))
         packed.append('\x00' * 3)
-        packed.append(struct.pack("!L", self.out_port))
+        packed.append(util.pack_port_no(self.out_port))
         packed.append(struct.pack("!L", self.out_group))
         packed.append('\x00' * 4)
         packed.append(struct.pack("!Q", self.cookie))
@@ -3200,23 +4092,23 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 1)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.table_id = reader.read('!B')[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.out_port = reader.read('!L')[0]
-        obj.out_group = reader.read('!L')[0]
+        obj.out_port = util.unpack_port_no(reader)
+        obj.out_group = reader.read("!L")[0]
         reader.skip(4)
-        obj.cookie = reader.read('!Q')[0]
-        obj.cookie_mask = reader.read('!Q')[0]
+        obj.cookie = reader.read("!Q")[0]
+        obj.cookie_mask = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         return obj
 
@@ -3279,8 +4171,8 @@
         q.text('}')
 
 class get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REPLY
+    version = 4
+    type = 8
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -3313,14 +4205,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 8)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3362,8 +4254,8 @@
         q.text('}')
 
 class get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GET_CONFIG_REQUEST
+    version = 4
+    type = 7
 
     def __init__(self, xid=None):
         self.xid = xid
@@ -3386,12 +4278,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 7)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3425,8 +4317,8 @@
         q.text('}')
 
 class group_desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 7
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -3449,7 +4341,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3462,15 +4354,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 7)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_desc_stats_entry(reader)
         return obj
@@ -3514,8 +4406,8 @@
         q.text('}')
 
 class group_desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 7
 
     def __init__(self, xid=None, flags=None):
@@ -3546,15 +4438,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 7)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -3593,8 +4485,8 @@
         q.text('}')
 
 class group_features_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 8
 
     def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
@@ -3675,26 +4567,26 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 8)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.types = reader.read('!L')[0]
-        obj.capabilities = reader.read('!L')[0]
-        obj.max_groups_all = reader.read('!L')[0]
-        obj.max_groups_select = reader.read('!L')[0]
-        obj.max_groups_indirect = reader.read('!L')[0]
-        obj.max_groups_ff = reader.read('!L')[0]
-        obj.actions_all = reader.read('!L')[0]
-        obj.actions_select = reader.read('!L')[0]
-        obj.actions_indirect = reader.read('!L')[0]
-        obj.actions_ff = reader.read('!L')[0]
+        obj.types = reader.read("!L")[0]
+        obj.capabilities = reader.read("!L")[0]
+        obj.max_groups_all = reader.read("!L")[0]
+        obj.max_groups_select = reader.read("!L")[0]
+        obj.max_groups_indirect = reader.read("!L")[0]
+        obj.max_groups_ff = reader.read("!L")[0]
+        obj.actions_all = reader.read("!L")[0]
+        obj.actions_select = reader.read("!L")[0]
+        obj.actions_indirect = reader.read("!L")[0]
+        obj.actions_ff = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -3772,8 +4664,8 @@
         q.text('}')
 
 class group_features_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 8
 
     def __init__(self, xid=None, flags=None):
@@ -3804,15 +4696,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 8)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -3851,8 +4743,8 @@
         q.text('}')
 
 class group_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_GROUP_MOD
+    version = 4
+    type = 15
 
     def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
         self.xid = xid
@@ -3883,7 +4775,7 @@
         packed.append(struct.pack("!B", self.group_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[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3896,16 +4788,16 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_GROUP_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.command = reader.read('!H')[0]
-        obj.group_type = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 15)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.command = reader.read("!H")[0]
+        obj.group_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
 
@@ -3956,8 +4848,8 @@
         q.text('}')
 
 class group_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 6
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -3980,7 +4872,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -3993,15 +4885,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 6)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_group_stats_entry(reader)
         return obj
@@ -4045,8 +4937,8 @@
         q.text('}')
 
 class group_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 6
 
     def __init__(self, xid=None, flags=None, group_id=None):
@@ -4083,17 +4975,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 6)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.group_id = reader.read('!L')[0]
+        obj.group_id = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4136,8 +5028,8 @@
         q.text('}')
 
 class hello(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_HELLO
+    version = 4
+    type = 0
 
     def __init__(self, xid=None, elements=None):
         self.xid = xid
@@ -4152,7 +5044,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append("".join([x.pack() for x in self.elements]))
+        packed.append(util.pack_list(self.elements))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4165,12 +5057,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_HELLO)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 0)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.elements = common.unpack_list_hello_elem(reader)
         return obj
 
@@ -4209,8 +5101,8 @@
         q.text('}')
 
 class meter_config_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 10
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -4233,7 +5125,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4246,15 +5138,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 10)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = meter_band.unpack_list(reader)
         return obj
@@ -4298,8 +5190,8 @@
         q.text('}')
 
 class meter_config_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 10
 
     def __init__(self, xid=None, flags=None, meter_id=None):
@@ -4336,17 +5228,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 10)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.meter_id = reader.read('!L')[0]
+        obj.meter_id = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4389,8 +5281,8 @@
         q.text('}')
 
 class meter_features_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 11
 
     def __init__(self, xid=None, flags=None, features=None):
@@ -4426,15 +5318,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 11)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.features = common.meter_features.unpack(reader)
         return obj
@@ -4478,8 +5370,8 @@
         q.text('}')
 
 class meter_features_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 11
 
     def __init__(self, xid=None, flags=None):
@@ -4510,15 +5402,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 11)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -4557,8 +5449,8 @@
         q.text('}')
 
 class meter_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_METER_MOD
+    version = 4
+    type = 29
 
     def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
         self.xid = xid
@@ -4588,7 +5480,7 @@
         packed.append(struct.pack("!H", self.command))
         packed.append(struct.pack("!H", self.flags))
         packed.append(struct.pack("!L", self.meter_id))
-        packed.append("".join([x.pack() for x in self.meters]))
+        packed.append(util.pack_list(self.meters))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4601,15 +5493,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_METER_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.command = reader.read('!H')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.meter_id = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 29)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.command = reader.read("!H")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.meter_id = reader.read("!L")[0]
         obj.meters = meter_band.unpack_list(reader)
         return obj
 
@@ -4660,8 +5552,8 @@
         q.text('}')
 
 class meter_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 9
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -4684,7 +5576,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -4697,15 +5589,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 9)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = common.unpack_list_meter_stats(reader)
         return obj
@@ -4749,8 +5641,8 @@
         q.text('}')
 
 class meter_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 9
 
     def __init__(self, xid=None, flags=None, meter_id=None):
@@ -4787,17 +5679,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 9)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.meter_id = reader.read('!L')[0]
+        obj.meter_id = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -4840,8 +5732,8 @@
         q.text('}')
 
 class packet_in(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_IN
+    version = 4
+    type = 10
 
     def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
         self.xid = xid
@@ -4872,7 +5764,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -4900,17 +5792,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_IN)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.total_len = reader.read('!H')[0]
-        obj.reason = reader.read('!B')[0]
-        obj.table_id = reader.read('!B')[0]
-        obj.cookie = reader.read('!Q')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 10)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.total_len = reader.read("!H")[0]
+        obj.reason = reader.read("!B")[0]
+        obj.table_id = reader.read("!B")[0]
+        obj.cookie = reader.read("!Q")[0]
         obj.match = common.match.unpack(reader)
         reader.skip(2)
         obj.data = str(reader.read_all())
@@ -4975,8 +5867,8 @@
         q.text('}')
 
 class packet_out(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PACKET_OUT
+    version = 4
+    type = 13
 
     def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
         self.xid = xid
@@ -4995,7 +5887,7 @@
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -5004,10 +5896,10 @@
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
         packed.append(struct.pack("!L", self.buffer_id))
-        packed.append(struct.pack("!L", self.in_port))
+        packed.append(util.pack_port_no(self.in_port))
         packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
         packed.append('\x00' * 6)
-        packed.append("".join([x.pack() for x in self.actions]))
+        packed.append(util.pack_list(self.actions))
         packed[6] = struct.pack("!H", len(packed[-1]))
         packed.append(self.data)
         length = sum([len(x) for x in packed])
@@ -5022,15 +5914,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PACKET_OUT)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.buffer_id = reader.read('!L')[0]
-        obj.in_port = reader.read('!L')[0]
-        _actions_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 13)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.buffer_id = reader.read("!L")[0]
+        obj.in_port = util.unpack_port_no(reader)
+        _actions_len = reader.read("!H")[0]
         reader.skip(6)
         obj.actions = action.unpack_list(reader.slice(_actions_len))
         obj.data = str(reader.read_all())
@@ -5083,8 +5975,8 @@
         q.text('}')
 
 class port_desc_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 13
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -5107,7 +5999,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5120,15 +6012,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 13)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
         return obj
@@ -5172,8 +6064,8 @@
         q.text('}')
 
 class port_desc_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 13
 
     def __init__(self, xid=None, flags=None):
@@ -5204,15 +6096,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 13)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -5251,8 +6143,8 @@
         q.text('}')
 
 class port_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_MOD
+    version = 4
+    type = 16
 
     def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
         self.xid = xid
@@ -5283,7 +6175,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        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)
@@ -5303,19 +6195,19 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port_no = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 16)
+        _length = reader.read("!H")[0]
+        obj.xid = 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.config = reader.read('!L')[0]
-        obj.mask = reader.read('!L')[0]
-        obj.advertise = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
+        obj.mask = reader.read("!L")[0]
+        obj.advertise = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -5370,8 +6262,8 @@
         q.text('}')
 
 class port_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 4
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -5394,7 +6286,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5407,15 +6299,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 4)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
         return obj
@@ -5459,8 +6351,8 @@
         q.text('}')
 
 class port_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 4
 
     def __init__(self, xid=None, flags=None, port_no=None):
@@ -5483,7 +6375,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append(struct.pack("!L", self.port_no))
+        packed.append(util.pack_port_no(self.port_no))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -5497,17 +6389,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 4)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -5550,8 +6442,8 @@
         q.text('}')
 
 class port_status(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_PORT_STATUS
+    version = 4
+    type = 12
 
     def __init__(self, xid=None, reason=None, desc=None):
         self.xid = xid
@@ -5585,13 +6477,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_PORT_STATUS)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.reason = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 12)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.reason = reader.read("!B")[0]
         reader.skip(7)
         obj.desc = common.port_desc.unpack(reader)
         return obj
@@ -5635,8 +6527,8 @@
         q.text('}')
 
 class queue_get_config_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REPLY
+    version = 4
+    type = 23
 
     def __init__(self, xid=None, port=None, queues=None):
         self.xid = xid
@@ -5655,9 +6547,9 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.queues]))
+        packed.append(util.pack_list(self.queues))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5670,13 +6562,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 23)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         obj.queues = common.unpack_list_packet_queue(reader)
         return obj
@@ -5720,8 +6612,8 @@
         q.text('}')
 
 class queue_get_config_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_QUEUE_GET_CONFIG_REQUEST
+    version = 4
+    type = 22
 
     def __init__(self, xid=None, port=None):
         self.xid = xid
@@ -5736,7 +6628,7 @@
         packed.append(struct.pack("!B", self.type))
         packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
         packed.append(struct.pack("!L", self.xid))
-        packed.append(struct.pack("!L", self.port))
+        packed.append(util.pack_port_no(self.port))
         packed.append('\x00' * 4)
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -5750,13 +6642,13 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_QUEUE_GET_CONFIG_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.port = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 22)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.port = util.unpack_port_no(reader)
         reader.skip(4)
         return obj
 
@@ -5795,8 +6687,8 @@
         q.text('}')
 
 class queue_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 5
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -5819,7 +6711,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -5832,15 +6724,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 5)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
         return obj
@@ -5884,8 +6776,8 @@
         q.text('}')
 
 class queue_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 5
 
     def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
@@ -5912,7 +6804,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        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))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
@@ -5926,18 +6818,18 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 5)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.port_no = reader.read('!L')[0]
-        obj.queue_id = reader.read('!L')[0]
+        obj.port_no = util.unpack_port_no(reader)
+        obj.queue_id = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -5983,15 +6875,15 @@
         q.text('}')
 
 class role_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ROLE_REPLY
+    version = 4
+    type = 25
 
     def __init__(self, xid=None, data=None):
         self.xid = xid
         if data != None:
             self.data = data
         else:
-            self.data = ""
+            self.data = ''
 
     def pack(self):
         packed = []
@@ -6012,12 +6904,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ROLE_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 25)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
         obj.data = str(reader.read_all())
         return obj
 
@@ -6056,8 +6948,8 @@
         q.text('}')
 
 class role_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_ROLE_REQUEST
+    version = 4
+    type = 24
 
     def __init__(self, xid=None, role=None, generation_id=None):
         self.xid = xid
@@ -6091,15 +6983,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_ROLE_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.role = reader.read('!L')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 24)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.role = reader.read("!L")[0]
         reader.skip(4)
-        obj.generation_id = reader.read('!Q')[0]
+        obj.generation_id = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -6141,8 +7033,8 @@
         q.text('}')
 
 class set_config(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_SET_CONFIG
+    version = 4
+    type = 9
 
     def __init__(self, xid=None, flags=None, miss_send_len=None):
         self.xid = xid
@@ -6175,14 +7067,14 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_SET_CONFIG)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.flags = reader.read('!H')[0]
-        obj.miss_send_len = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 9)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.flags = reader.read("!H")[0]
+        obj.miss_send_len = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -6224,8 +7116,8 @@
         q.text('}')
 
 class table_features_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 12
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -6248,7 +7140,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -6261,17 +7153,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 12)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.entries = loxi.unimplemented('unpack list of_list_table_features_t')
+        obj.entries = loxi.unimplemented('unpack list(of_table_features_t)')
         return obj
 
     def __eq__(self, other):
@@ -6313,8 +7205,8 @@
         q.text('}')
 
 class table_features_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 12
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -6337,7 +7229,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -6350,17 +7242,17 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 12)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
-        obj.entries = loxi.unimplemented('unpack list of_list_table_features_t')
+        obj.entries = loxi.unimplemented('unpack list(of_table_features_t)')
         return obj
 
     def __eq__(self, other):
@@ -6402,8 +7294,8 @@
         q.text('}')
 
 class table_mod(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_TABLE_MOD
+    version = 4
+    type = 17
 
     def __init__(self, xid=None, table_id=None, config=None):
         self.xid = xid
@@ -6437,15 +7329,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_TABLE_MOD)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        obj.table_id = reader.read('!B')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 17)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        obj.table_id = reader.read("!B")[0]
         reader.skip(3)
-        obj.config = reader.read('!L')[0]
+        obj.config = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -6487,8 +7379,8 @@
         q.text('}')
 
 class table_stats_reply(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REPLY
+    version = 4
+    type = 19
     stats_type = 3
 
     def __init__(self, xid=None, flags=None, entries=None):
@@ -6511,7 +7403,7 @@
         packed.append(struct.pack("!H", self.stats_type))
         packed.append(struct.pack("!H", self.flags))
         packed.append('\x00' * 4)
-        packed.append("".join([x.pack() for x in self.entries]))
+        packed.append(util.pack_list(self.entries))
         length = sum([len(x) for x in packed])
         packed[2] = struct.pack("!H", length)
         return ''.join(packed)
@@ -6524,15 +7416,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REPLY)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 19)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 3)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
         return obj
@@ -6576,8 +7468,8 @@
         q.text('}')
 
 class table_stats_request(Message):
-    version = const.OFP_VERSION
-    type = const.OFPT_MULTIPART_REQUEST
+    version = 4
+    type = 18
     stats_type = 3
 
     def __init__(self, xid=None, flags=None):
@@ -6608,15 +7500,15 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _version = reader.read('!B')[0]
-        assert(_version == const.OFP_VERSION)
-        _type = reader.read('!B')[0]
-        assert(_type == const.OFPT_MULTIPART_REQUEST)
-        _length = reader.read('!H')[0]
-        obj.xid = reader.read('!L')[0]
-        _stats_type = reader.read('!H')[0]
+        _version = reader.read("!B")[0]
+        assert(_version == 4)
+        _type = reader.read("!B")[0]
+        assert(_type == 18)
+        _length = reader.read("!H")[0]
+        obj.xid = reader.read("!L")[0]
+        _stats_type = reader.read("!H")[0]
         assert(_stats_type == 3)
-        obj.flags = reader.read('!H')[0]
+        obj.flags = reader.read("!H")[0]
         reader.skip(4)
         return obj
 
@@ -6716,36 +7608,36 @@
         raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
 
 parsers = {
-    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
-    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
-    const.OFPT_ECHO_REPLY : echo_reply.unpack,
-    const.OFPT_ECHO_REQUEST : echo_request.unpack,
-    const.OFPT_ERROR : error_msg.unpack,
-    const.OFPT_EXPERIMENTER : parse_experimenter,
-    const.OFPT_FEATURES_REPLY : features_reply.unpack,
-    const.OFPT_FEATURES_REQUEST : features_request.unpack,
-    const.OFPT_FLOW_MOD : parse_flow_mod,
-    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
-    const.OFPT_GET_ASYNC_REPLY : async_get_reply.unpack,
-    const.OFPT_GET_ASYNC_REQUEST : async_get_request.unpack,
-    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
-    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
-    const.OFPT_GROUP_MOD : group_mod.unpack,
     const.OFPT_HELLO : hello.unpack,
-    const.OFPT_METER_MOD : meter_mod.unpack,
-    const.OFPT_MULTIPART_REPLY : parse_multipart_reply,
-    const.OFPT_MULTIPART_REQUEST : parse_multipart_request,
-    const.OFPT_PACKET_IN : packet_in.unpack,
-    const.OFPT_PACKET_OUT : packet_out.unpack,
-    const.OFPT_PORT_MOD : port_mod.unpack,
-    const.OFPT_PORT_STATUS : port_status.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
-    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
-    const.OFPT_ROLE_REPLY : role_reply.unpack,
-    const.OFPT_ROLE_REQUEST : role_request.unpack,
-    const.OFPT_SET_ASYNC : async_set.unpack,
+    const.OFPT_ERROR : error_msg.unpack,
+    const.OFPT_ECHO_REQUEST : echo_request.unpack,
+    const.OFPT_ECHO_REPLY : echo_reply.unpack,
+    const.OFPT_EXPERIMENTER : parse_experimenter,
+    const.OFPT_FEATURES_REQUEST : features_request.unpack,
+    const.OFPT_FEATURES_REPLY : features_reply.unpack,
+    const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
+    const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
     const.OFPT_SET_CONFIG : set_config.unpack,
+    const.OFPT_PACKET_IN : packet_in.unpack,
+    const.OFPT_FLOW_REMOVED : flow_removed.unpack,
+    const.OFPT_PORT_STATUS : port_status.unpack,
+    const.OFPT_PACKET_OUT : packet_out.unpack,
+    const.OFPT_FLOW_MOD : parse_flow_mod,
+    const.OFPT_GROUP_MOD : group_mod.unpack,
+    const.OFPT_PORT_MOD : port_mod.unpack,
     const.OFPT_TABLE_MOD : table_mod.unpack,
+    const.OFPT_MULTIPART_REQUEST : parse_multipart_request,
+    const.OFPT_MULTIPART_REPLY : parse_multipart_reply,
+    const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
+    const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
+    const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
+    const.OFPT_ROLE_REQUEST : role_request.unpack,
+    const.OFPT_ROLE_REPLY : role_reply.unpack,
+    const.OFPT_GET_ASYNC_REQUEST : async_get_request.unpack,
+    const.OFPT_GET_ASYNC_REPLY : async_get_reply.unpack,
+    const.OFPT_SET_ASYNC : async_set.unpack,
+    const.OFPT_METER_MOD : meter_mod.unpack,
 }
 
 flow_mod_parsers = {
@@ -6759,4 +7651,23 @@
 # TODO OF 1.3 multipart messages
 
 experimenter_parsers = {
+    6035143 : {
+        22: bsn_bw_clear_data_reply.unpack,
+        21: bsn_bw_clear_data_request.unpack,
+        20: bsn_bw_enable_get_reply.unpack,
+        19: bsn_bw_enable_get_request.unpack,
+        23: bsn_bw_enable_set_reply.unpack,
+        18: bsn_bw_enable_set_request.unpack,
+        10: bsn_get_interfaces_reply.unpack,
+        9: bsn_get_interfaces_request.unpack,
+        5: bsn_get_mirroring_reply.unpack,
+        4: bsn_get_mirroring_request.unpack,
+        3: bsn_set_mirroring.unpack,
+        25: bsn_set_pktin_suppression_reply.unpack,
+        11: bsn_set_pktin_suppression_request.unpack,
+        16: bsn_virtual_port_create_reply.unpack,
+        15: bsn_virtual_port_create_request.unpack,
+        26: bsn_virtual_port_remove_reply.unpack,
+        17: bsn_virtual_port_remove_request.unpack,
+    },
 }
diff --git a/src/python/loxi/of13/meter_band.py b/src/python/loxi/of13/meter_band.py
index 814442a..5573beb 100644
--- a/src/python/loxi/of13/meter_band.py
+++ b/src/python/loxi/of13/meter_band.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 meter_band.py
 # Do not modify
@@ -23,7 +24,7 @@
     pass
 
 class drop(MeterBand):
-    type = const.OFPMBT_DROP
+    type = 1
 
     def __init__(self, rate=None, burst_size=None):
         if rate != None:
@@ -54,11 +55,11 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPMBT_DROP)
-        _len = reader.read('!H')[0]
-        obj.rate = reader.read('!L')[0]
-        obj.burst_size = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 1)
+        _len = reader.read("!H")[0]
+        obj.rate = reader.read("!L")[0]
+        obj.burst_size = reader.read("!L")[0]
         reader.skip(4)
         return obj
 
@@ -89,7 +90,7 @@
         q.text('}')
 
 class dscp_remark(MeterBand):
-    type = const.OFPMBT_DSCP_REMARK
+    type = 2
 
     def __init__(self, rate=None, burst_size=None, prec_level=None):
         if rate != None:
@@ -125,12 +126,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPMBT_DSCP_REMARK)
-        _len = reader.read('!H')[0]
-        obj.rate = reader.read('!L')[0]
-        obj.burst_size = reader.read('!L')[0]
-        obj.prec_level = reader.read('!B')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 2)
+        _len = reader.read("!H")[0]
+        obj.rate = reader.read("!L")[0]
+        obj.burst_size = reader.read("!L")[0]
+        obj.prec_level = reader.read("!B")[0]
         reader.skip(3)
         return obj
 
@@ -165,7 +166,7 @@
         q.text('}')
 
 class experimenter(MeterBand):
-    type = const.OFPMBT_EXPERIMENTER
+    type = 65535
 
     def __init__(self, rate=None, burst_size=None, experimenter=None):
         if rate != None:
@@ -200,12 +201,12 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type = reader.read('!H')[0]
-        assert(_type == const.OFPMBT_EXPERIMENTER)
-        _len = reader.read('!H')[0]
-        obj.rate = reader.read('!L')[0]
-        obj.burst_size = reader.read('!L')[0]
-        obj.experimenter = reader.read('!L')[0]
+        _type = reader.read("!H")[0]
+        assert(_type == 65535)
+        _len = reader.read("!H")[0]
+        obj.rate = reader.read("!L")[0]
+        obj.burst_size = reader.read("!L")[0]
+        obj.experimenter = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
diff --git a/src/python/loxi/of13/oxm.py b/src/python/loxi/of13/oxm.py
index d3bc046..fb1291d 100644
--- a/src/python/loxi/of13/oxm.py
+++ b/src/python/loxi/of13/oxm.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 oxm.py
 # Do not modify
@@ -26,7 +27,7 @@
     pass
 
 class arp_op(OXM):
-    type_len = 0x80002a02
+    type_len = 2147494402
 
     def __init__(self, value=None):
         if value != None:
@@ -47,9 +48,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494402)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -75,7 +76,7 @@
         q.text('}')
 
 class arp_op_masked(OXM):
-    type_len = 0x80002b04
+    type_len = 2147494660
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -101,10 +102,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494660)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -134,7 +135,7 @@
         q.text('}')
 
 class arp_sha(OXM):
-    type_len = 0x80003006
+    type_len = 2147495942
 
     def __init__(self, value=None):
         if value != None:
@@ -155,8 +156,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003006)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495942)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -183,7 +184,7 @@
         q.text('}')
 
 class arp_sha_masked(OXM):
-    type_len = 0x8000310c
+    type_len = 2147496204
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -209,8 +210,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000310c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496204)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -242,7 +243,7 @@
         q.text('}')
 
 class arp_spa(OXM):
-    type_len = 0x80002c04
+    type_len = 2147494916
 
     def __init__(self, value=None):
         if value != None:
@@ -263,9 +264,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002c04)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494916)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -291,7 +292,7 @@
         q.text('}')
 
 class arp_spa_masked(OXM):
-    type_len = 0x80002d08
+    type_len = 2147495176
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -317,10 +318,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002d08)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495176)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -350,7 +351,7 @@
         q.text('}')
 
 class arp_tha(OXM):
-    type_len = 0x80003206
+    type_len = 2147496454
 
     def __init__(self, value=None):
         if value != None:
@@ -371,8 +372,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003206)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496454)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -399,7 +400,7 @@
         q.text('}')
 
 class arp_tha_masked(OXM):
-    type_len = 0x8000330c
+    type_len = 2147496716
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -425,8 +426,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000330c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496716)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -458,7 +459,7 @@
         q.text('}')
 
 class arp_tpa(OXM):
-    type_len = 0x80002e04
+    type_len = 2147495428
 
     def __init__(self, value=None):
         if value != None:
@@ -479,9 +480,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002e04)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495428)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -507,7 +508,7 @@
         q.text('}')
 
 class arp_tpa_masked(OXM):
-    type_len = 0x80002f08
+    type_len = 2147495688
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -533,10 +534,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002f08)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147495688)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -565,8 +566,116 @@
             q.breakable()
         q.text('}')
 
+class dst_meta_id(OXM):
+    type_len = 258561
+
+    def __init__(self, value=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = dst_meta_id()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258561)
+        obj.value = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: 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("dst_meta_id {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+            q.breakable()
+        q.text('}')
+
+class dst_meta_id_masked(OXM):
+    type_len = 258818
+
+    def __init__(self, value=None, value_mask=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+        if value_mask != None:
+            self.value_mask = value_mask
+        else:
+            self.value_mask = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        packed.append(struct.pack("!B", self.value_mask))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = dst_meta_id_masked()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258818)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: return False
+        if self.value_mask != other.value_mask: 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("dst_meta_id_masked {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+                q.text(","); q.breakable()
+                q.text("value_mask = ");
+                q.text("%#x" % self.value_mask)
+            q.breakable()
+        q.text('}')
+
 class eth_dst(OXM):
-    type_len = 0x80000606
+    type_len = 2147485190
 
     def __init__(self, value=None):
         if value != None:
@@ -587,8 +696,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000606)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485190)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -615,7 +724,7 @@
         q.text('}')
 
 class eth_dst_masked(OXM):
-    type_len = 0x8000070c
+    type_len = 2147485452
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -641,8 +750,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000070c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485452)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -674,7 +783,7 @@
         q.text('}')
 
 class eth_src(OXM):
-    type_len = 0x80000806
+    type_len = 2147485702
 
     def __init__(self, value=None):
         if value != None:
@@ -695,8 +804,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000806)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485702)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -723,7 +832,7 @@
         q.text('}')
 
 class eth_src_masked(OXM):
-    type_len = 0x8000090c
+    type_len = 2147485964
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -749,8 +858,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000090c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147485964)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -782,7 +891,7 @@
         q.text('}')
 
 class eth_type(OXM):
-    type_len = 0x80000a02
+    type_len = 2147486210
 
     def __init__(self, value=None):
         if value != None:
@@ -803,9 +912,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486210)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -831,7 +940,7 @@
         q.text('}')
 
 class eth_type_masked(OXM):
-    type_len = 0x80000b04
+    type_len = 2147486468
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -857,10 +966,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486468)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -890,7 +999,7 @@
         q.text('}')
 
 class icmpv4_code(OXM):
-    type_len = 0x80002801
+    type_len = 2147493889
 
     def __init__(self, value=None):
         if value != None:
@@ -911,9 +1020,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002801)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493889)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -939,7 +1048,7 @@
         q.text('}')
 
 class icmpv4_code_masked(OXM):
-    type_len = 0x80002902
+    type_len = 2147494146
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -965,10 +1074,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002902)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147494146)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -998,7 +1107,7 @@
         q.text('}')
 
 class icmpv4_type(OXM):
-    type_len = 0x80002601
+    type_len = 2147493377
 
     def __init__(self, value=None):
         if value != None:
@@ -1019,9 +1128,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002601)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493377)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1047,7 +1156,7 @@
         q.text('}')
 
 class icmpv4_type_masked(OXM):
-    type_len = 0x80002702
+    type_len = 2147493634
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1073,10 +1182,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002702)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493634)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1106,7 +1215,7 @@
         q.text('}')
 
 class icmpv6_code(OXM):
-    type_len = 0x80003c01
+    type_len = 2147499009
 
     def __init__(self, value=None):
         if value != None:
@@ -1127,9 +1236,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003c01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499009)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1155,7 +1264,7 @@
         q.text('}')
 
 class icmpv6_code_masked(OXM):
-    type_len = 0x80003d02
+    type_len = 2147499266
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1181,10 +1290,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003d02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499266)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1214,7 +1323,7 @@
         q.text('}')
 
 class icmpv6_type(OXM):
-    type_len = 0x80003a01
+    type_len = 2147498497
 
     def __init__(self, value=None):
         if value != None:
@@ -1235,9 +1344,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003a01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498497)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1263,7 +1372,7 @@
         q.text('}')
 
 class icmpv6_type_masked(OXM):
-    type_len = 0x80003b02
+    type_len = 2147498754
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1289,10 +1398,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003b02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498754)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1322,7 +1431,7 @@
         q.text('}')
 
 class in_phy_port(OXM):
-    type_len = 0x80000204
+    type_len = 2147484164
 
     def __init__(self, value=None):
         if value != None:
@@ -1333,7 +1442,7 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
+        packed.append(util.pack_port_no(self.value))
         return ''.join(packed)
 
     @staticmethod
@@ -1343,9 +1452,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000204)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484164)
+        obj.value = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1371,7 +1480,7 @@
         q.text('}')
 
 class in_phy_port_masked(OXM):
-    type_len = 0x80000308
+    type_len = 2147484424
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1386,8 +1495,8 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
-        packed.append(struct.pack("!L", self.value_mask))
+        packed.append(util.pack_port_no(self.value))
+        packed.append(util.pack_port_no(self.value_mask))
         return ''.join(packed)
 
     @staticmethod
@@ -1397,10 +1506,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000308)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484424)
+        obj.value = util.unpack_port_no(reader)
+        obj.value_mask = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1430,7 +1539,7 @@
         q.text('}')
 
 class in_port(OXM):
-    type_len = 0x80000004
+    type_len = 2147483652
 
     def __init__(self, value=None):
         if value != None:
@@ -1441,7 +1550,7 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
+        packed.append(util.pack_port_no(self.value))
         return ''.join(packed)
 
     @staticmethod
@@ -1451,9 +1560,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000004)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147483652)
+        obj.value = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1479,7 +1588,7 @@
         q.text('}')
 
 class in_port_masked(OXM):
-    type_len = 0x80000108
+    type_len = 2147483912
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1494,8 +1603,8 @@
     def pack(self):
         packed = []
         packed.append(struct.pack("!L", self.type_len))
-        packed.append(struct.pack("!L", self.value))
-        packed.append(struct.pack("!L", self.value_mask))
+        packed.append(util.pack_port_no(self.value))
+        packed.append(util.pack_port_no(self.value_mask))
         return ''.join(packed)
 
     @staticmethod
@@ -1505,10 +1614,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000108)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147483912)
+        obj.value = util.unpack_port_no(reader)
+        obj.value_mask = util.unpack_port_no(reader)
         return obj
 
     def __eq__(self, other):
@@ -1538,7 +1647,7 @@
         q.text('}')
 
 class ip_dscp(OXM):
-    type_len = 0x80001001
+    type_len = 2147487745
 
     def __init__(self, value=None):
         if value != None:
@@ -1559,9 +1668,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001001)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487745)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1587,7 +1696,7 @@
         q.text('}')
 
 class ip_dscp_masked(OXM):
-    type_len = 0x80001102
+    type_len = 2147488002
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1613,10 +1722,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001102)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488002)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1646,7 +1755,7 @@
         q.text('}')
 
 class ip_ecn(OXM):
-    type_len = 0x80001201
+    type_len = 2147488257
 
     def __init__(self, value=None):
         if value != None:
@@ -1667,9 +1776,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001201)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488257)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1695,7 +1804,7 @@
         q.text('}')
 
 class ip_ecn_masked(OXM):
-    type_len = 0x80001302
+    type_len = 2147488514
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1721,10 +1830,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001302)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488514)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1754,7 +1863,7 @@
         q.text('}')
 
 class ip_proto(OXM):
-    type_len = 0x80001401
+    type_len = 2147488769
 
     def __init__(self, value=None):
         if value != None:
@@ -1775,9 +1884,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001401)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147488769)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1803,7 +1912,7 @@
         q.text('}')
 
 class ip_proto_masked(OXM):
-    type_len = 0x80001502
+    type_len = 2147489026
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1829,10 +1938,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001502)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489026)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -1862,7 +1971,7 @@
         q.text('}')
 
 class ipv4_dst(OXM):
-    type_len = 0x80001804
+    type_len = 2147489796
 
     def __init__(self, value=None):
         if value != None:
@@ -1883,9 +1992,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001804)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489796)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1911,7 +2020,7 @@
         q.text('}')
 
 class ipv4_dst_masked(OXM):
-    type_len = 0x80001908
+    type_len = 2147490056
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1937,10 +2046,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001908)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490056)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -1970,7 +2079,7 @@
         q.text('}')
 
 class ipv4_src(OXM):
-    type_len = 0x80001604
+    type_len = 2147489284
 
     def __init__(self, value=None):
         if value != None:
@@ -1991,9 +2100,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001604)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489284)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2019,7 +2128,7 @@
         q.text('}')
 
 class ipv4_src_masked(OXM):
-    type_len = 0x80001708
+    type_len = 2147489544
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2045,10 +2154,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001708)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147489544)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2078,7 +2187,7 @@
         q.text('}')
 
 class ipv6_dst(OXM):
-    type_len = 0x80003610
+    type_len = 2147497488
 
     def __init__(self, value=None):
         if value != None:
@@ -2099,8 +2208,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003610)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497488)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2127,7 +2236,7 @@
         q.text('}')
 
 class ipv6_dst_masked(OXM):
-    type_len = 0x80003720
+    type_len = 2147497760
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2153,8 +2262,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003720)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497760)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2186,7 +2295,7 @@
         q.text('}')
 
 class ipv6_flabel(OXM):
-    type_len = 0x80003804
+    type_len = 2147497988
 
     def __init__(self, value=None):
         if value != None:
@@ -2207,9 +2316,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003804)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497988)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2235,7 +2344,7 @@
         q.text('}')
 
 class ipv6_flabel_masked(OXM):
-    type_len = 0x80003908
+    type_len = 2147498248
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2261,10 +2370,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003908)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147498248)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2294,7 +2403,7 @@
         q.text('}')
 
 class ipv6_nd_sll(OXM):
-    type_len = 0x80004006
+    type_len = 2147500038
 
     def __init__(self, value=None):
         if value != None:
@@ -2315,8 +2424,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004006)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500038)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -2343,7 +2452,7 @@
         q.text('}')
 
 class ipv6_nd_sll_masked(OXM):
-    type_len = 0x8000410c
+    type_len = 2147500300
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2369,8 +2478,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000410c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500300)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -2402,7 +2511,7 @@
         q.text('}')
 
 class ipv6_nd_target(OXM):
-    type_len = 0x80003e10
+    type_len = 2147499536
 
     def __init__(self, value=None):
         if value != None:
@@ -2423,8 +2532,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003e10)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499536)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2451,7 +2560,7 @@
         q.text('}')
 
 class ipv6_nd_target_masked(OXM):
-    type_len = 0x80003f20
+    type_len = 2147499808
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2477,8 +2586,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003f20)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147499808)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2510,7 +2619,7 @@
         q.text('}')
 
 class ipv6_nd_tll(OXM):
-    type_len = 0x80004206
+    type_len = 2147500550
 
     def __init__(self, value=None):
         if value != None:
@@ -2531,8 +2640,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004206)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500550)
         obj.value = list(reader.read('!6B'))
         return obj
 
@@ -2559,7 +2668,7 @@
         q.text('}')
 
 class ipv6_nd_tll_masked(OXM):
-    type_len = 0x8000430c
+    type_len = 2147500812
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2585,8 +2694,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x8000430c)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147500812)
         obj.value = list(reader.read('!6B'))
         obj.value_mask = list(reader.read('!6B'))
         return obj
@@ -2618,7 +2727,7 @@
         q.text('}')
 
 class ipv6_src(OXM):
-    type_len = 0x80003410
+    type_len = 2147496976
 
     def __init__(self, value=None):
         if value != None:
@@ -2639,8 +2748,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003410)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147496976)
         obj.value = reader.read('!16s')[0]
         return obj
 
@@ -2667,7 +2776,7 @@
         q.text('}')
 
 class ipv6_src_masked(OXM):
-    type_len = 0x80003520
+    type_len = 2147497248
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2693,8 +2802,8 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80003520)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147497248)
         obj.value = reader.read('!16s')[0]
         obj.value_mask = reader.read('!16s')[0]
         return obj
@@ -2726,7 +2835,7 @@
         q.text('}')
 
 class metadata(OXM):
-    type_len = 0x80000408
+    type_len = 2147484680
 
     def __init__(self, value=None):
         if value != None:
@@ -2747,9 +2856,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000408)
-        obj.value = reader.read('!Q')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484680)
+        obj.value = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -2775,7 +2884,7 @@
         q.text('}')
 
 class metadata_masked(OXM):
-    type_len = 0x80000510
+    type_len = 2147484944
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2801,10 +2910,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000510)
-        obj.value = reader.read('!Q')[0]
-        obj.value_mask = reader.read('!Q')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147484944)
+        obj.value = reader.read("!Q")[0]
+        obj.value_mask = reader.read("!Q")[0]
         return obj
 
     def __eq__(self, other):
@@ -2834,7 +2943,7 @@
         q.text('}')
 
 class mpls_label(OXM):
-    type_len = 0x80004404
+    type_len = 2147501060
 
     def __init__(self, value=None):
         if value != None:
@@ -2855,9 +2964,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004404)
-        obj.value = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501060)
+        obj.value = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2883,7 +2992,7 @@
         q.text('}')
 
 class mpls_label_masked(OXM):
-    type_len = 0x80004508
+    type_len = 2147501320
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -2909,10 +3018,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004508)
-        obj.value = reader.read('!L')[0]
-        obj.value_mask = reader.read('!L')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501320)
+        obj.value = reader.read("!L")[0]
+        obj.value_mask = reader.read("!L")[0]
         return obj
 
     def __eq__(self, other):
@@ -2942,7 +3051,7 @@
         q.text('}')
 
 class mpls_tc(OXM):
-    type_len = 0x80004601
+    type_len = 2147501569
 
     def __init__(self, value=None):
         if value != None:
@@ -2963,9 +3072,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004601)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501569)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -2991,7 +3100,7 @@
         q.text('}')
 
 class mpls_tc_masked(OXM):
-    type_len = 0x80004702
+    type_len = 2147501826
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3017,10 +3126,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80004702)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147501826)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3050,7 +3159,7 @@
         q.text('}')
 
 class sctp_dst(OXM):
-    type_len = 0x80002402
+    type_len = 2147492866
 
     def __init__(self, value=None):
         if value != None:
@@ -3071,9 +3180,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002402)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492866)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3099,7 +3208,7 @@
         q.text('}')
 
 class sctp_dst_masked(OXM):
-    type_len = 0x80002504
+    type_len = 2147493124
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3125,10 +3234,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002504)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147493124)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3158,7 +3267,7 @@
         q.text('}')
 
 class sctp_src(OXM):
-    type_len = 0x80002202
+    type_len = 2147492354
 
     def __init__(self, value=None):
         if value != None:
@@ -3179,9 +3288,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002202)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492354)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3207,7 +3316,7 @@
         q.text('}')
 
 class sctp_src_masked(OXM):
-    type_len = 0x80002304
+    type_len = 2147492612
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3233,10 +3342,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002304)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492612)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3265,8 +3374,116 @@
             q.breakable()
         q.text('}')
 
+class src_meta_id(OXM):
+    type_len = 258049
+
+    def __init__(self, value=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = src_meta_id()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258049)
+        obj.value = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: 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("src_meta_id {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+            q.breakable()
+        q.text('}')
+
+class src_meta_id_masked(OXM):
+    type_len = 258306
+
+    def __init__(self, value=None, value_mask=None):
+        if value != None:
+            self.value = value
+        else:
+            self.value = 0
+        if value_mask != None:
+            self.value_mask = value_mask
+        else:
+            self.value_mask = 0
+
+    def pack(self):
+        packed = []
+        packed.append(struct.pack("!L", self.type_len))
+        packed.append(struct.pack("!B", self.value))
+        packed.append(struct.pack("!B", self.value_mask))
+        return ''.join(packed)
+
+    @staticmethod
+    def unpack(buf):
+        obj = src_meta_id_masked()
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 258306)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
+        return obj
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.value != other.value: return False
+        if self.value_mask != other.value_mask: 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("src_meta_id_masked {")
+        with q.group():
+            with q.indent(2):
+                q.breakable()
+                q.text("value = ");
+                q.text("%#x" % self.value)
+                q.text(","); q.breakable()
+                q.text("value_mask = ");
+                q.text("%#x" % self.value_mask)
+            q.breakable()
+        q.text('}')
+
 class tcp_dst(OXM):
-    type_len = 0x80001c02
+    type_len = 2147490818
 
     def __init__(self, value=None):
         if value != None:
@@ -3287,9 +3504,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001c02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490818)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3315,7 +3532,7 @@
         q.text('}')
 
 class tcp_dst_masked(OXM):
-    type_len = 0x80001d04
+    type_len = 2147491076
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3341,10 +3558,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001d04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491076)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3374,7 +3591,7 @@
         q.text('}')
 
 class tcp_src(OXM):
-    type_len = 0x80001a02
+    type_len = 2147490306
 
     def __init__(self, value=None):
         if value != None:
@@ -3395,9 +3612,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001a02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490306)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3423,7 +3640,7 @@
         q.text('}')
 
 class tcp_src_masked(OXM):
-    type_len = 0x80001b04
+    type_len = 2147490564
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3449,10 +3666,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001b04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147490564)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3482,7 +3699,7 @@
         q.text('}')
 
 class udp_dst(OXM):
-    type_len = 0x80002002
+    type_len = 2147491842
 
     def __init__(self, value=None):
         if value != None:
@@ -3503,9 +3720,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002002)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491842)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3531,7 +3748,7 @@
         q.text('}')
 
 class udp_dst_masked(OXM):
-    type_len = 0x80002104
+    type_len = 2147492100
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3557,10 +3774,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80002104)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147492100)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3590,7 +3807,7 @@
         q.text('}')
 
 class udp_src(OXM):
-    type_len = 0x80001e02
+    type_len = 2147491330
 
     def __init__(self, value=None):
         if value != None:
@@ -3611,9 +3828,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001e02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491330)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3639,7 +3856,7 @@
         q.text('}')
 
 class udp_src_masked(OXM):
-    type_len = 0x80001f04
+    type_len = 2147491588
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3665,10 +3882,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80001f04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147491588)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3698,7 +3915,7 @@
         q.text('}')
 
 class vlan_pcp(OXM):
-    type_len = 0x80000e01
+    type_len = 2147487233
 
     def __init__(self, value=None):
         if value != None:
@@ -3719,9 +3936,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000e01)
-        obj.value = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487233)
+        obj.value = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3747,7 +3964,7 @@
         q.text('}')
 
 class vlan_pcp_masked(OXM):
-    type_len = 0x80000f02
+    type_len = 2147487490
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3773,10 +3990,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000f02)
-        obj.value = reader.read('!B')[0]
-        obj.value_mask = reader.read('!B')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147487490)
+        obj.value = reader.read("!B")[0]
+        obj.value_mask = reader.read("!B")[0]
         return obj
 
     def __eq__(self, other):
@@ -3806,7 +4023,7 @@
         q.text('}')
 
 class vlan_vid(OXM):
-    type_len = 0x80000c02
+    type_len = 2147486722
 
     def __init__(self, value=None):
         if value != None:
@@ -3827,9 +4044,9 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000c02)
-        obj.value = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486722)
+        obj.value = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3855,7 +4072,7 @@
         q.text('}')
 
 class vlan_vid_masked(OXM):
-    type_len = 0x80000d04
+    type_len = 2147486980
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -3881,10 +4098,10 @@
             reader = buf
         else:
             reader = loxi.generic_util.OFReader(buf)
-        _type_len = reader.read('!L')[0]
-        assert(_type_len == 0x80000d04)
-        obj.value = reader.read('!H')[0]
-        obj.value_mask = reader.read('!H')[0]
+        _type_len = reader.read("!L")[0]
+        assert(_type_len == 2147486980)
+        obj.value = reader.read("!H")[0]
+        obj.value_mask = reader.read("!H")[0]
         return obj
 
     def __eq__(self, other):
@@ -3915,6 +4132,10 @@
 
 
 parsers = {
+    258049 : src_meta_id.unpack,
+    258306 : src_meta_id_masked.unpack,
+    258561 : dst_meta_id.unpack,
+    258818 : dst_meta_id_masked.unpack,
     2147483652 : in_port.unpack,
     2147483912 : in_port_masked.unpack,
     2147484164 : in_phy_port.unpack,
diff --git a/src/python/loxi/of13/util.py b/src/python/loxi/of13/util.py
index d431d4c..56b5729 100644
--- a/src/python/loxi/of13/util.py
+++ b/src/python/loxi/of13/util.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 util.py
 # Do not modify
@@ -35,3 +36,36 @@
         if v == v2:
             return k
     return v
+
+def pack_port_no(value):
+    return struct.pack("!L", value)
+
+def unpack_port_no(reader):
+    return reader.read("!L")[0]
+
+def pack_fm_cmd(value):
+    return struct.pack("!B", value)
+
+def unpack_fm_cmd(reader):
+    return reader.read("!B")[0]
+
+def init_wc_bmap():
+    return 0
+
+def pack_wc_bmap(value):
+    return struct.pack("!Q", value)
+
+def unpack_wc_bmap(reader):
+    return reader.read("!Q")[0]
+
+def init_match_bmap():
+    return 0
+
+def pack_match_bmap(value):
+    return struct.pack("!Q", value)
+
+def unpack_match_bmap(reader):
+    return reader.read("!Q")[0]
+
+def pack_list(values):
+    return "".join([x.pack() for x in values])
