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])
