diff --git a/src/python/loxi/of13/oxm.py b/src/python/loxi/of13/oxm.py
index de53112..2abee43 100644
--- a/src/python/loxi/of13/oxm.py
+++ b/src/python/loxi/of13/oxm.py
@@ -3,31 +3,36 @@
 # Copyright (c) 2012, 2013 Big Switch Networks, Inc.
 # See the file LICENSE.pyloxi which should have been included in the source distribution
 
-# Automatically generated by LOXI from template oxm.py
+# Automatically generated by LOXI from template module.py
 # Do not modify
 
 import struct
+import loxi
 import const
+import common
+import action
+import instruction
+import oxm
+import action_id
+import instruction_id
+import meter_band
 import util
 import loxi.generic_util
-import loxi
 
-def unpack(reader):
-    type_len, = reader.peek('!L')
-    if type_len in parsers:
-        return parsers[type_len](reader)
-    else:
-        raise loxi.ProtocolError("unknown OXM cls=%#x type=%#x masked=%d len=%d (%#x)" % \
-            ((type_len >> 16) & 0xffff, (type_len >> 9) & 0x7f, (type_len >> 8) & 1, type_len & 0xff, type_len))
+class oxm(loxi.OFObject):
+    subtypes = {}
 
-def unpack_list(reader):
-    return loxi.generic_util.unpack_list(reader, unpack)
+    @staticmethod
+    def unpack(reader):
+        subtype, = reader.peek('!L', 0)
+        try:
+            subclass = oxm.subtypes[subtype]
+        except KeyError:
+            raise loxi.ProtocolError("unknown oxm subtype %#x" % subtype)
+        return subclass.unpack(reader)
 
-class OXM(object):
-    type_len = None # override in subclass
-    pass
 
-class arp_op(OXM):
+class arp_op(oxm):
     type_len = 2147494402
 
     def __init__(self, value=None):
@@ -35,6 +40,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -43,12 +49,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_op()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147494402)
         obj.value = reader.read("!H")[0]
@@ -59,13 +61,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_op {")
         with q.group():
@@ -76,7 +71,9 @@
             q.breakable()
         q.text('}')
 
-class arp_op_masked(OXM):
+oxm.subtypes[2147494402] = arp_op
+
+class arp_op_masked(oxm):
     type_len = 2147494660
 
     def __init__(self, value=None, value_mask=None):
@@ -88,6 +85,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -97,12 +95,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_op_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147494660)
         obj.value = reader.read("!H")[0]
@@ -115,13 +109,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_op_masked {")
         with q.group():
@@ -135,7 +122,9 @@
             q.breakable()
         q.text('}')
 
-class arp_sha(OXM):
+oxm.subtypes[2147494660] = arp_op_masked
+
+class arp_sha(oxm):
     type_len = 2147495942
 
     def __init__(self, value=None):
@@ -143,6 +132,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -151,12 +141,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_sha()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147495942)
         obj.value = list(reader.read('!6B'))
@@ -167,13 +153,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_sha {")
         with q.group():
@@ -184,7 +163,9 @@
             q.breakable()
         q.text('}')
 
-class arp_sha_masked(OXM):
+oxm.subtypes[2147495942] = arp_sha
+
+class arp_sha_masked(oxm):
     type_len = 2147496204
 
     def __init__(self, value=None, value_mask=None):
@@ -196,6 +177,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -205,12 +187,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_sha_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147496204)
         obj.value = list(reader.read('!6B'))
@@ -223,13 +201,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_sha_masked {")
         with q.group():
@@ -243,7 +214,9 @@
             q.breakable()
         q.text('}')
 
-class arp_spa(OXM):
+oxm.subtypes[2147496204] = arp_sha_masked
+
+class arp_spa(oxm):
     type_len = 2147494916
 
     def __init__(self, value=None):
@@ -251,6 +224,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -259,12 +233,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_spa()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147494916)
         obj.value = reader.read("!L")[0]
@@ -275,13 +245,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_spa {")
         with q.group():
@@ -292,7 +255,9 @@
             q.breakable()
         q.text('}')
 
-class arp_spa_masked(OXM):
+oxm.subtypes[2147494916] = arp_spa
+
+class arp_spa_masked(oxm):
     type_len = 2147495176
 
     def __init__(self, value=None, value_mask=None):
@@ -304,6 +269,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -313,12 +279,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_spa_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147495176)
         obj.value = reader.read("!L")[0]
@@ -331,13 +293,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_spa_masked {")
         with q.group():
@@ -351,7 +306,9 @@
             q.breakable()
         q.text('}')
 
-class arp_tha(OXM):
+oxm.subtypes[2147495176] = arp_spa_masked
+
+class arp_tha(oxm):
     type_len = 2147496454
 
     def __init__(self, value=None):
@@ -359,6 +316,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -367,12 +325,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_tha()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147496454)
         obj.value = list(reader.read('!6B'))
@@ -383,13 +337,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_tha {")
         with q.group():
@@ -400,7 +347,9 @@
             q.breakable()
         q.text('}')
 
-class arp_tha_masked(OXM):
+oxm.subtypes[2147496454] = arp_tha
+
+class arp_tha_masked(oxm):
     type_len = 2147496716
 
     def __init__(self, value=None, value_mask=None):
@@ -412,6 +361,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -421,12 +371,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_tha_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147496716)
         obj.value = list(reader.read('!6B'))
@@ -439,13 +385,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_tha_masked {")
         with q.group():
@@ -459,7 +398,9 @@
             q.breakable()
         q.text('}')
 
-class arp_tpa(OXM):
+oxm.subtypes[2147496716] = arp_tha_masked
+
+class arp_tpa(oxm):
     type_len = 2147495428
 
     def __init__(self, value=None):
@@ -467,6 +408,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -475,12 +417,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_tpa()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147495428)
         obj.value = reader.read("!L")[0]
@@ -491,13 +429,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_tpa {")
         with q.group():
@@ -508,7 +439,9 @@
             q.breakable()
         q.text('}')
 
-class arp_tpa_masked(OXM):
+oxm.subtypes[2147495428] = arp_tpa
+
+class arp_tpa_masked(oxm):
     type_len = 2147495688
 
     def __init__(self, value=None, value_mask=None):
@@ -520,6 +453,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -529,12 +463,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = arp_tpa_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147495688)
         obj.value = reader.read("!L")[0]
@@ -547,13 +477,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("arp_tpa_masked {")
         with q.group():
@@ -567,7 +490,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_global_vrf_allowed(OXM):
+oxm.subtypes[2147495688] = arp_tpa_masked
+
+class bsn_global_vrf_allowed(oxm):
     type_len = 198145
 
     def __init__(self, value=None):
@@ -575,6 +500,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -583,12 +509,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_global_vrf_allowed()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 198145)
         obj.value = reader.read("!B")[0]
@@ -599,13 +521,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_global_vrf_allowed {")
         with q.group():
@@ -616,8 +531,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_global_vrf_allowed_masked(OXM):
-    type_len = 198401
+oxm.subtypes[198145] = bsn_global_vrf_allowed
+
+class bsn_global_vrf_allowed_masked(oxm):
+    type_len = 198402
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -628,6 +545,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -637,14 +555,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_global_vrf_allowed_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 198401)
+        assert(_type_len == 198402)
         obj.value = reader.read("!B")[0]
         obj.value_mask = reader.read("!B")[0]
         return obj
@@ -655,13 +569,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_global_vrf_allowed_masked {")
         with q.group():
@@ -675,14 +582,17 @@
             q.breakable()
         q.text('}')
 
-class bsn_in_ports_128(OXM):
-    type_len = 196640
+oxm.subtypes[198402] = bsn_global_vrf_allowed_masked
+
+class bsn_in_ports_128(oxm):
+    type_len = 196624
 
     def __init__(self, value=None):
         if value != None:
             self.value = value
         else:
             self.value = set()
+        return
 
     def pack(self):
         packed = []
@@ -691,14 +601,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_in_ports_128()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 196640)
+        assert(_type_len == 196624)
         obj.value = util.unpack_bitmap_128(reader)
         return obj
 
@@ -707,13 +613,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_in_ports_128 {")
         with q.group():
@@ -724,7 +623,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_in_ports_128_masked(OXM):
+oxm.subtypes[196624] = bsn_in_ports_128
+
+class bsn_in_ports_128_masked(oxm):
     type_len = 196896
 
     def __init__(self, value=None, value_mask=None):
@@ -736,6 +637,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = set()
+        return
 
     def pack(self):
         packed = []
@@ -745,12 +647,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_in_ports_128_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 196896)
         obj.value = util.unpack_bitmap_128(reader)
@@ -763,13 +661,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_in_ports_128_masked {")
         with q.group():
@@ -783,7 +674,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_dst_class_id(OXM):
+oxm.subtypes[196896] = bsn_in_ports_128_masked
+
+class bsn_l3_dst_class_id(oxm):
     type_len = 199684
 
     def __init__(self, value=None):
@@ -791,6 +684,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -799,12 +693,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_dst_class_id()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 199684)
         obj.value = reader.read("!L")[0]
@@ -815,13 +705,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_dst_class_id {")
         with q.group():
@@ -832,8 +715,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_dst_class_id_masked(OXM):
-    type_len = 199940
+oxm.subtypes[199684] = bsn_l3_dst_class_id
+
+class bsn_l3_dst_class_id_masked(oxm):
+    type_len = 199944
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -844,6 +729,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -853,14 +739,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_dst_class_id_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 199940)
+        assert(_type_len == 199944)
         obj.value = reader.read("!L")[0]
         obj.value_mask = reader.read("!L")[0]
         return obj
@@ -871,13 +753,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_dst_class_id_masked {")
         with q.group():
@@ -891,7 +766,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_interface_class_id(OXM):
+oxm.subtypes[199944] = bsn_l3_dst_class_id_masked
+
+class bsn_l3_interface_class_id(oxm):
     type_len = 198660
 
     def __init__(self, value=None):
@@ -899,6 +776,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -907,12 +785,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_interface_class_id()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 198660)
         obj.value = reader.read("!L")[0]
@@ -923,13 +797,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_interface_class_id {")
         with q.group():
@@ -940,8 +807,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_interface_class_id_masked(OXM):
-    type_len = 198916
+oxm.subtypes[198660] = bsn_l3_interface_class_id
+
+class bsn_l3_interface_class_id_masked(oxm):
+    type_len = 198920
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -952,6 +821,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -961,14 +831,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_interface_class_id_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 198916)
+        assert(_type_len == 198920)
         obj.value = reader.read("!L")[0]
         obj.value_mask = reader.read("!L")[0]
         return obj
@@ -979,13 +845,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_interface_class_id_masked {")
         with q.group():
@@ -999,7 +858,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_src_class_id(OXM):
+oxm.subtypes[198920] = bsn_l3_interface_class_id_masked
+
+class bsn_l3_src_class_id(oxm):
     type_len = 199172
 
     def __init__(self, value=None):
@@ -1007,6 +868,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1015,12 +877,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_src_class_id()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 199172)
         obj.value = reader.read("!L")[0]
@@ -1031,13 +889,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_src_class_id {")
         with q.group():
@@ -1048,8 +899,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_l3_src_class_id_masked(OXM):
-    type_len = 199428
+oxm.subtypes[199172] = bsn_l3_src_class_id
+
+class bsn_l3_src_class_id_masked(oxm):
+    type_len = 199432
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1060,6 +913,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1069,14 +923,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_l3_src_class_id_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 199428)
+        assert(_type_len == 199432)
         obj.value = reader.read("!L")[0]
         obj.value_mask = reader.read("!L")[0]
         return obj
@@ -1087,13 +937,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_l3_src_class_id_masked {")
         with q.group():
@@ -1107,7 +950,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_lag_id(OXM):
+oxm.subtypes[199432] = bsn_l3_src_class_id_masked
+
+class bsn_lag_id(oxm):
     type_len = 197124
 
     def __init__(self, value=None):
@@ -1115,6 +960,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1123,12 +969,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_lag_id()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 197124)
         obj.value = reader.read("!L")[0]
@@ -1139,13 +981,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_lag_id {")
         with q.group():
@@ -1156,8 +991,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_lag_id_masked(OXM):
-    type_len = 197380
+oxm.subtypes[197124] = bsn_lag_id
+
+class bsn_lag_id_masked(oxm):
+    type_len = 197384
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1168,6 +1005,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1177,14 +1015,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_lag_id_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 197380)
+        assert(_type_len == 197384)
         obj.value = reader.read("!L")[0]
         obj.value_mask = reader.read("!L")[0]
         return obj
@@ -1195,13 +1029,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_lag_id_masked {")
         with q.group():
@@ -1215,7 +1042,9 @@
             q.breakable()
         q.text('}')
 
-class bsn_vrf(OXM):
+oxm.subtypes[197384] = bsn_lag_id_masked
+
+class bsn_vrf(oxm):
     type_len = 197636
 
     def __init__(self, value=None):
@@ -1223,6 +1052,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1231,12 +1061,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_vrf()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 197636)
         obj.value = reader.read("!L")[0]
@@ -1247,13 +1073,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_vrf {")
         with q.group():
@@ -1264,8 +1083,10 @@
             q.breakable()
         q.text('}')
 
-class bsn_vrf_masked(OXM):
-    type_len = 197892
+oxm.subtypes[197636] = bsn_vrf
+
+class bsn_vrf_masked(oxm):
+    type_len = 197896
 
     def __init__(self, value=None, value_mask=None):
         if value != None:
@@ -1276,6 +1097,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1285,14 +1107,10 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = bsn_vrf_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
-        assert(_type_len == 197892)
+        assert(_type_len == 197896)
         obj.value = reader.read("!L")[0]
         obj.value_mask = reader.read("!L")[0]
         return obj
@@ -1303,13 +1121,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("bsn_vrf_masked {")
         with q.group():
@@ -1323,7 +1134,9 @@
             q.breakable()
         q.text('}')
 
-class eth_dst(OXM):
+oxm.subtypes[197896] = bsn_vrf_masked
+
+class eth_dst(oxm):
     type_len = 2147485190
 
     def __init__(self, value=None):
@@ -1331,6 +1144,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -1339,12 +1153,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147485190)
         obj.value = list(reader.read('!6B'))
@@ -1355,13 +1165,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_dst {")
         with q.group():
@@ -1372,7 +1175,9 @@
             q.breakable()
         q.text('}')
 
-class eth_dst_masked(OXM):
+oxm.subtypes[2147485190] = eth_dst
+
+class eth_dst_masked(oxm):
     type_len = 2147485452
 
     def __init__(self, value=None, value_mask=None):
@@ -1384,6 +1189,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -1393,12 +1199,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147485452)
         obj.value = list(reader.read('!6B'))
@@ -1411,13 +1213,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_dst_masked {")
         with q.group():
@@ -1431,7 +1226,9 @@
             q.breakable()
         q.text('}')
 
-class eth_src(OXM):
+oxm.subtypes[2147485452] = eth_dst_masked
+
+class eth_src(oxm):
     type_len = 2147485702
 
     def __init__(self, value=None):
@@ -1439,6 +1236,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -1447,12 +1245,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147485702)
         obj.value = list(reader.read('!6B'))
@@ -1463,13 +1257,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_src {")
         with q.group():
@@ -1480,7 +1267,9 @@
             q.breakable()
         q.text('}')
 
-class eth_src_masked(OXM):
+oxm.subtypes[2147485702] = eth_src
+
+class eth_src_masked(oxm):
     type_len = 2147485964
 
     def __init__(self, value=None, value_mask=None):
@@ -1492,6 +1281,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -1501,12 +1291,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147485964)
         obj.value = list(reader.read('!6B'))
@@ -1519,13 +1305,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_src_masked {")
         with q.group():
@@ -1539,7 +1318,9 @@
             q.breakable()
         q.text('}')
 
-class eth_type(OXM):
+oxm.subtypes[2147485964] = eth_src_masked
+
+class eth_type(oxm):
     type_len = 2147486210
 
     def __init__(self, value=None):
@@ -1547,6 +1328,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1555,12 +1337,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_type()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147486210)
         obj.value = reader.read("!H")[0]
@@ -1571,13 +1349,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_type {")
         with q.group():
@@ -1588,7 +1359,9 @@
             q.breakable()
         q.text('}')
 
-class eth_type_masked(OXM):
+oxm.subtypes[2147486210] = eth_type
+
+class eth_type_masked(oxm):
     type_len = 2147486468
 
     def __init__(self, value=None, value_mask=None):
@@ -1600,6 +1373,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1609,12 +1383,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = eth_type_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147486468)
         obj.value = reader.read("!H")[0]
@@ -1627,13 +1397,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("eth_type_masked {")
         with q.group():
@@ -1647,7 +1410,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv4_code(OXM):
+oxm.subtypes[2147486468] = eth_type_masked
+
+class icmpv4_code(oxm):
     type_len = 2147493889
 
     def __init__(self, value=None):
@@ -1655,6 +1420,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1663,12 +1429,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv4_code()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147493889)
         obj.value = reader.read("!B")[0]
@@ -1679,13 +1441,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv4_code {")
         with q.group():
@@ -1696,7 +1451,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv4_code_masked(OXM):
+oxm.subtypes[2147493889] = icmpv4_code
+
+class icmpv4_code_masked(oxm):
     type_len = 2147494146
 
     def __init__(self, value=None, value_mask=None):
@@ -1708,6 +1465,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1717,12 +1475,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv4_code_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147494146)
         obj.value = reader.read("!B")[0]
@@ -1735,13 +1489,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv4_code_masked {")
         with q.group():
@@ -1755,7 +1502,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv4_type(OXM):
+oxm.subtypes[2147494146] = icmpv4_code_masked
+
+class icmpv4_type(oxm):
     type_len = 2147493377
 
     def __init__(self, value=None):
@@ -1763,6 +1512,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1771,12 +1521,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv4_type()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147493377)
         obj.value = reader.read("!B")[0]
@@ -1787,13 +1533,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv4_type {")
         with q.group():
@@ -1804,7 +1543,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv4_type_masked(OXM):
+oxm.subtypes[2147493377] = icmpv4_type
+
+class icmpv4_type_masked(oxm):
     type_len = 2147493634
 
     def __init__(self, value=None, value_mask=None):
@@ -1816,6 +1557,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1825,12 +1567,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv4_type_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147493634)
         obj.value = reader.read("!B")[0]
@@ -1843,13 +1581,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv4_type_masked {")
         with q.group():
@@ -1863,7 +1594,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv6_code(OXM):
+oxm.subtypes[2147493634] = icmpv4_type_masked
+
+class icmpv6_code(oxm):
     type_len = 2147499009
 
     def __init__(self, value=None):
@@ -1871,6 +1604,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1879,12 +1613,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv6_code()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147499009)
         obj.value = reader.read("!B")[0]
@@ -1895,13 +1625,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv6_code {")
         with q.group():
@@ -1912,7 +1635,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv6_code_masked(OXM):
+oxm.subtypes[2147499009] = icmpv6_code
+
+class icmpv6_code_masked(oxm):
     type_len = 2147499266
 
     def __init__(self, value=None, value_mask=None):
@@ -1924,6 +1649,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -1933,12 +1659,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv6_code_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147499266)
         obj.value = reader.read("!B")[0]
@@ -1951,13 +1673,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv6_code_masked {")
         with q.group():
@@ -1971,7 +1686,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv6_type(OXM):
+oxm.subtypes[2147499266] = icmpv6_code_masked
+
+class icmpv6_type(oxm):
     type_len = 2147498497
 
     def __init__(self, value=None):
@@ -1979,6 +1696,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -1987,12 +1705,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv6_type()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147498497)
         obj.value = reader.read("!B")[0]
@@ -2003,13 +1717,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv6_type {")
         with q.group():
@@ -2020,7 +1727,9 @@
             q.breakable()
         q.text('}')
 
-class icmpv6_type_masked(OXM):
+oxm.subtypes[2147498497] = icmpv6_type
+
+class icmpv6_type_masked(oxm):
     type_len = 2147498754
 
     def __init__(self, value=None, value_mask=None):
@@ -2032,6 +1741,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2041,12 +1751,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = icmpv6_type_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147498754)
         obj.value = reader.read("!B")[0]
@@ -2059,13 +1765,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("icmpv6_type_masked {")
         with q.group():
@@ -2079,7 +1778,9 @@
             q.breakable()
         q.text('}')
 
-class in_phy_port(OXM):
+oxm.subtypes[2147498754] = icmpv6_type_masked
+
+class in_phy_port(oxm):
     type_len = 2147484164
 
     def __init__(self, value=None):
@@ -2087,6 +1788,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2095,12 +1797,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = in_phy_port()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147484164)
         obj.value = util.unpack_port_no(reader)
@@ -2111,13 +1809,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("in_phy_port {")
         with q.group():
@@ -2128,7 +1819,9 @@
             q.breakable()
         q.text('}')
 
-class in_phy_port_masked(OXM):
+oxm.subtypes[2147484164] = in_phy_port
+
+class in_phy_port_masked(oxm):
     type_len = 2147484424
 
     def __init__(self, value=None, value_mask=None):
@@ -2140,6 +1833,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2149,12 +1843,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = in_phy_port_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147484424)
         obj.value = util.unpack_port_no(reader)
@@ -2167,13 +1857,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("in_phy_port_masked {")
         with q.group():
@@ -2187,7 +1870,9 @@
             q.breakable()
         q.text('}')
 
-class in_port(OXM):
+oxm.subtypes[2147484424] = in_phy_port_masked
+
+class in_port(oxm):
     type_len = 2147483652
 
     def __init__(self, value=None):
@@ -2195,6 +1880,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2203,12 +1889,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = in_port()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147483652)
         obj.value = util.unpack_port_no(reader)
@@ -2219,13 +1901,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("in_port {")
         with q.group():
@@ -2236,7 +1911,9 @@
             q.breakable()
         q.text('}')
 
-class in_port_masked(OXM):
+oxm.subtypes[2147483652] = in_port
+
+class in_port_masked(oxm):
     type_len = 2147483912
 
     def __init__(self, value=None, value_mask=None):
@@ -2248,6 +1925,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2257,12 +1935,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = in_port_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147483912)
         obj.value = util.unpack_port_no(reader)
@@ -2275,13 +1949,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("in_port_masked {")
         with q.group():
@@ -2295,7 +1962,9 @@
             q.breakable()
         q.text('}')
 
-class ip_dscp(OXM):
+oxm.subtypes[2147483912] = in_port_masked
+
+class ip_dscp(oxm):
     type_len = 2147487745
 
     def __init__(self, value=None):
@@ -2303,6 +1972,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2311,12 +1981,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_dscp()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147487745)
         obj.value = reader.read("!B")[0]
@@ -2327,13 +1993,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_dscp {")
         with q.group():
@@ -2344,7 +2003,9 @@
             q.breakable()
         q.text('}')
 
-class ip_dscp_masked(OXM):
+oxm.subtypes[2147487745] = ip_dscp
+
+class ip_dscp_masked(oxm):
     type_len = 2147488002
 
     def __init__(self, value=None, value_mask=None):
@@ -2356,6 +2017,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2365,12 +2027,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_dscp_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147488002)
         obj.value = reader.read("!B")[0]
@@ -2383,13 +2041,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_dscp_masked {")
         with q.group():
@@ -2403,7 +2054,9 @@
             q.breakable()
         q.text('}')
 
-class ip_ecn(OXM):
+oxm.subtypes[2147488002] = ip_dscp_masked
+
+class ip_ecn(oxm):
     type_len = 2147488257
 
     def __init__(self, value=None):
@@ -2411,6 +2064,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2419,12 +2073,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_ecn()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147488257)
         obj.value = reader.read("!B")[0]
@@ -2435,13 +2085,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_ecn {")
         with q.group():
@@ -2452,7 +2095,9 @@
             q.breakable()
         q.text('}')
 
-class ip_ecn_masked(OXM):
+oxm.subtypes[2147488257] = ip_ecn
+
+class ip_ecn_masked(oxm):
     type_len = 2147488514
 
     def __init__(self, value=None, value_mask=None):
@@ -2464,6 +2109,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2473,12 +2119,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_ecn_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147488514)
         obj.value = reader.read("!B")[0]
@@ -2491,13 +2133,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_ecn_masked {")
         with q.group():
@@ -2511,7 +2146,9 @@
             q.breakable()
         q.text('}')
 
-class ip_proto(OXM):
+oxm.subtypes[2147488514] = ip_ecn_masked
+
+class ip_proto(oxm):
     type_len = 2147488769
 
     def __init__(self, value=None):
@@ -2519,6 +2156,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2527,12 +2165,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_proto()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147488769)
         obj.value = reader.read("!B")[0]
@@ -2543,13 +2177,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_proto {")
         with q.group():
@@ -2560,7 +2187,9 @@
             q.breakable()
         q.text('}')
 
-class ip_proto_masked(OXM):
+oxm.subtypes[2147488769] = ip_proto
+
+class ip_proto_masked(oxm):
     type_len = 2147489026
 
     def __init__(self, value=None, value_mask=None):
@@ -2572,6 +2201,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2581,12 +2211,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ip_proto_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147489026)
         obj.value = reader.read("!B")[0]
@@ -2599,13 +2225,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ip_proto_masked {")
         with q.group():
@@ -2619,7 +2238,9 @@
             q.breakable()
         q.text('}')
 
-class ipv4_dst(OXM):
+oxm.subtypes[2147489026] = ip_proto_masked
+
+class ipv4_dst(oxm):
     type_len = 2147489796
 
     def __init__(self, value=None):
@@ -2627,6 +2248,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2635,12 +2257,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv4_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147489796)
         obj.value = reader.read("!L")[0]
@@ -2651,13 +2269,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv4_dst {")
         with q.group():
@@ -2668,7 +2279,9 @@
             q.breakable()
         q.text('}')
 
-class ipv4_dst_masked(OXM):
+oxm.subtypes[2147489796] = ipv4_dst
+
+class ipv4_dst_masked(oxm):
     type_len = 2147490056
 
     def __init__(self, value=None, value_mask=None):
@@ -2680,6 +2293,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2689,12 +2303,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv4_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147490056)
         obj.value = reader.read("!L")[0]
@@ -2707,13 +2317,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv4_dst_masked {")
         with q.group():
@@ -2727,7 +2330,9 @@
             q.breakable()
         q.text('}')
 
-class ipv4_src(OXM):
+oxm.subtypes[2147490056] = ipv4_dst_masked
+
+class ipv4_src(oxm):
     type_len = 2147489284
 
     def __init__(self, value=None):
@@ -2735,6 +2340,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2743,12 +2349,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv4_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147489284)
         obj.value = reader.read("!L")[0]
@@ -2759,13 +2361,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv4_src {")
         with q.group():
@@ -2776,7 +2371,9 @@
             q.breakable()
         q.text('}')
 
-class ipv4_src_masked(OXM):
+oxm.subtypes[2147489284] = ipv4_src
+
+class ipv4_src_masked(oxm):
     type_len = 2147489544
 
     def __init__(self, value=None, value_mask=None):
@@ -2788,6 +2385,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -2797,12 +2395,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv4_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147489544)
         obj.value = reader.read("!L")[0]
@@ -2815,13 +2409,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv4_src_masked {")
         with q.group():
@@ -2835,7 +2422,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_dst(OXM):
+oxm.subtypes[2147489544] = ipv4_src_masked
+
+class ipv6_dst(oxm):
     type_len = 2147497488
 
     def __init__(self, value=None):
@@ -2843,6 +2432,7 @@
             self.value = value
         else:
             self.value = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -2851,12 +2441,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147497488)
         obj.value = reader.read('!16s')[0]
@@ -2867,13 +2453,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_dst {")
         with q.group():
@@ -2884,7 +2463,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_dst_masked(OXM):
+oxm.subtypes[2147497488] = ipv6_dst
+
+class ipv6_dst_masked(oxm):
     type_len = 2147497760
 
     def __init__(self, value=None, value_mask=None):
@@ -2896,6 +2477,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -2905,12 +2487,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147497760)
         obj.value = reader.read('!16s')[0]
@@ -2923,13 +2501,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_dst_masked {")
         with q.group():
@@ -2943,7 +2514,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_flabel(OXM):
+oxm.subtypes[2147497760] = ipv6_dst_masked
+
+class ipv6_flabel(oxm):
     type_len = 2147497988
 
     def __init__(self, value=None):
@@ -2951,6 +2524,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -2959,12 +2533,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_flabel()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147497988)
         obj.value = reader.read("!L")[0]
@@ -2975,13 +2545,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_flabel {")
         with q.group():
@@ -2992,7 +2555,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_flabel_masked(OXM):
+oxm.subtypes[2147497988] = ipv6_flabel
+
+class ipv6_flabel_masked(oxm):
     type_len = 2147498248
 
     def __init__(self, value=None, value_mask=None):
@@ -3004,6 +2569,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3013,12 +2579,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_flabel_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147498248)
         obj.value = reader.read("!L")[0]
@@ -3031,13 +2593,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_flabel_masked {")
         with q.group():
@@ -3051,7 +2606,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_sll(OXM):
+oxm.subtypes[2147498248] = ipv6_flabel_masked
+
+class ipv6_nd_sll(oxm):
     type_len = 2147500038
 
     def __init__(self, value=None):
@@ -3059,6 +2616,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -3067,12 +2625,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_sll()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147500038)
         obj.value = list(reader.read('!6B'))
@@ -3083,13 +2637,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_sll {")
         with q.group():
@@ -3100,7 +2647,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_sll_masked(OXM):
+oxm.subtypes[2147500038] = ipv6_nd_sll
+
+class ipv6_nd_sll_masked(oxm):
     type_len = 2147500300
 
     def __init__(self, value=None, value_mask=None):
@@ -3112,6 +2661,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -3121,12 +2671,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_sll_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147500300)
         obj.value = list(reader.read('!6B'))
@@ -3139,13 +2685,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_sll_masked {")
         with q.group():
@@ -3159,7 +2698,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_target(OXM):
+oxm.subtypes[2147500300] = ipv6_nd_sll_masked
+
+class ipv6_nd_target(oxm):
     type_len = 2147499536
 
     def __init__(self, value=None):
@@ -3167,6 +2708,7 @@
             self.value = value
         else:
             self.value = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -3175,12 +2717,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_target()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147499536)
         obj.value = reader.read('!16s')[0]
@@ -3191,13 +2729,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_target {")
         with q.group():
@@ -3208,7 +2739,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_target_masked(OXM):
+oxm.subtypes[2147499536] = ipv6_nd_target
+
+class ipv6_nd_target_masked(oxm):
     type_len = 2147499808
 
     def __init__(self, value=None, value_mask=None):
@@ -3220,6 +2753,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -3229,12 +2763,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_target_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147499808)
         obj.value = reader.read('!16s')[0]
@@ -3247,13 +2777,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_target_masked {")
         with q.group():
@@ -3267,7 +2790,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_tll(OXM):
+oxm.subtypes[2147499808] = ipv6_nd_target_masked
+
+class ipv6_nd_tll(oxm):
     type_len = 2147500550
 
     def __init__(self, value=None):
@@ -3275,6 +2800,7 @@
             self.value = value
         else:
             self.value = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -3283,12 +2809,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_tll()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147500550)
         obj.value = list(reader.read('!6B'))
@@ -3299,13 +2821,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_tll {")
         with q.group():
@@ -3316,7 +2831,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_nd_tll_masked(OXM):
+oxm.subtypes[2147500550] = ipv6_nd_tll
+
+class ipv6_nd_tll_masked(oxm):
     type_len = 2147500812
 
     def __init__(self, value=None, value_mask=None):
@@ -3328,6 +2845,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = [0,0,0,0,0,0]
+        return
 
     def pack(self):
         packed = []
@@ -3337,12 +2855,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_nd_tll_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147500812)
         obj.value = list(reader.read('!6B'))
@@ -3355,13 +2869,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_nd_tll_masked {")
         with q.group():
@@ -3375,7 +2882,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_src(OXM):
+oxm.subtypes[2147500812] = ipv6_nd_tll_masked
+
+class ipv6_src(oxm):
     type_len = 2147496976
 
     def __init__(self, value=None):
@@ -3383,6 +2892,7 @@
             self.value = value
         else:
             self.value = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -3391,12 +2901,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147496976)
         obj.value = reader.read('!16s')[0]
@@ -3407,13 +2913,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_src {")
         with q.group():
@@ -3424,7 +2923,9 @@
             q.breakable()
         q.text('}')
 
-class ipv6_src_masked(OXM):
+oxm.subtypes[2147496976] = ipv6_src
+
+class ipv6_src_masked(oxm):
     type_len = 2147497248
 
     def __init__(self, value=None, value_mask=None):
@@ -3436,6 +2937,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+        return
 
     def pack(self):
         packed = []
@@ -3445,12 +2947,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = ipv6_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147497248)
         obj.value = reader.read('!16s')[0]
@@ -3463,13 +2961,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("ipv6_src_masked {")
         with q.group():
@@ -3483,7 +2974,9 @@
             q.breakable()
         q.text('}')
 
-class metadata(OXM):
+oxm.subtypes[2147497248] = ipv6_src_masked
+
+class metadata(oxm):
     type_len = 2147484680
 
     def __init__(self, value=None):
@@ -3491,6 +2984,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -3499,12 +2993,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = metadata()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147484680)
         obj.value = reader.read("!Q")[0]
@@ -3515,13 +3005,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("metadata {")
         with q.group():
@@ -3532,7 +3015,9 @@
             q.breakable()
         q.text('}')
 
-class metadata_masked(OXM):
+oxm.subtypes[2147484680] = metadata
+
+class metadata_masked(oxm):
     type_len = 2147484944
 
     def __init__(self, value=None, value_mask=None):
@@ -3544,6 +3029,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3553,12 +3039,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = metadata_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147484944)
         obj.value = reader.read("!Q")[0]
@@ -3571,13 +3053,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("metadata_masked {")
         with q.group():
@@ -3591,7 +3066,9 @@
             q.breakable()
         q.text('}')
 
-class mpls_label(OXM):
+oxm.subtypes[2147484944] = metadata_masked
+
+class mpls_label(oxm):
     type_len = 2147501060
 
     def __init__(self, value=None):
@@ -3599,6 +3076,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -3607,12 +3085,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = mpls_label()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147501060)
         obj.value = reader.read("!L")[0]
@@ -3623,13 +3097,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("mpls_label {")
         with q.group():
@@ -3640,7 +3107,9 @@
             q.breakable()
         q.text('}')
 
-class mpls_label_masked(OXM):
+oxm.subtypes[2147501060] = mpls_label
+
+class mpls_label_masked(oxm):
     type_len = 2147501320
 
     def __init__(self, value=None, value_mask=None):
@@ -3652,6 +3121,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3661,12 +3131,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = mpls_label_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147501320)
         obj.value = reader.read("!L")[0]
@@ -3679,13 +3145,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("mpls_label_masked {")
         with q.group():
@@ -3699,7 +3158,9 @@
             q.breakable()
         q.text('}')
 
-class mpls_tc(OXM):
+oxm.subtypes[2147501320] = mpls_label_masked
+
+class mpls_tc(oxm):
     type_len = 2147501569
 
     def __init__(self, value=None):
@@ -3707,6 +3168,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -3715,12 +3177,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = mpls_tc()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147501569)
         obj.value = reader.read("!B")[0]
@@ -3731,13 +3189,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("mpls_tc {")
         with q.group():
@@ -3748,7 +3199,9 @@
             q.breakable()
         q.text('}')
 
-class mpls_tc_masked(OXM):
+oxm.subtypes[2147501569] = mpls_tc
+
+class mpls_tc_masked(oxm):
     type_len = 2147501826
 
     def __init__(self, value=None, value_mask=None):
@@ -3760,6 +3213,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3769,12 +3223,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = mpls_tc_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147501826)
         obj.value = reader.read("!B")[0]
@@ -3787,13 +3237,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("mpls_tc_masked {")
         with q.group():
@@ -3807,7 +3250,9 @@
             q.breakable()
         q.text('}')
 
-class sctp_dst(OXM):
+oxm.subtypes[2147501826] = mpls_tc_masked
+
+class sctp_dst(oxm):
     type_len = 2147492866
 
     def __init__(self, value=None):
@@ -3815,6 +3260,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -3823,12 +3269,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = sctp_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147492866)
         obj.value = reader.read("!H")[0]
@@ -3839,13 +3281,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("sctp_dst {")
         with q.group():
@@ -3856,7 +3291,9 @@
             q.breakable()
         q.text('}')
 
-class sctp_dst_masked(OXM):
+oxm.subtypes[2147492866] = sctp_dst
+
+class sctp_dst_masked(oxm):
     type_len = 2147493124
 
     def __init__(self, value=None, value_mask=None):
@@ -3868,6 +3305,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3877,12 +3315,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = sctp_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147493124)
         obj.value = reader.read("!H")[0]
@@ -3895,13 +3329,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("sctp_dst_masked {")
         with q.group():
@@ -3915,7 +3342,9 @@
             q.breakable()
         q.text('}')
 
-class sctp_src(OXM):
+oxm.subtypes[2147493124] = sctp_dst_masked
+
+class sctp_src(oxm):
     type_len = 2147492354
 
     def __init__(self, value=None):
@@ -3923,6 +3352,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -3931,12 +3361,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = sctp_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147492354)
         obj.value = reader.read("!H")[0]
@@ -3947,13 +3373,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("sctp_src {")
         with q.group():
@@ -3964,7 +3383,9 @@
             q.breakable()
         q.text('}')
 
-class sctp_src_masked(OXM):
+oxm.subtypes[2147492354] = sctp_src
+
+class sctp_src_masked(oxm):
     type_len = 2147492612
 
     def __init__(self, value=None, value_mask=None):
@@ -3976,6 +3397,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -3985,12 +3407,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = sctp_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147492612)
         obj.value = reader.read("!H")[0]
@@ -4003,13 +3421,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("sctp_src_masked {")
         with q.group():
@@ -4023,7 +3434,9 @@
             q.breakable()
         q.text('}')
 
-class tcp_dst(OXM):
+oxm.subtypes[2147492612] = sctp_src_masked
+
+class tcp_dst(oxm):
     type_len = 2147490818
 
     def __init__(self, value=None):
@@ -4031,6 +3444,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4039,12 +3453,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = tcp_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147490818)
         obj.value = reader.read("!H")[0]
@@ -4055,13 +3465,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("tcp_dst {")
         with q.group():
@@ -4072,7 +3475,9 @@
             q.breakable()
         q.text('}')
 
-class tcp_dst_masked(OXM):
+oxm.subtypes[2147490818] = tcp_dst
+
+class tcp_dst_masked(oxm):
     type_len = 2147491076
 
     def __init__(self, value=None, value_mask=None):
@@ -4084,6 +3489,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4093,12 +3499,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = tcp_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147491076)
         obj.value = reader.read("!H")[0]
@@ -4111,13 +3513,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("tcp_dst_masked {")
         with q.group():
@@ -4131,7 +3526,9 @@
             q.breakable()
         q.text('}')
 
-class tcp_src(OXM):
+oxm.subtypes[2147491076] = tcp_dst_masked
+
+class tcp_src(oxm):
     type_len = 2147490306
 
     def __init__(self, value=None):
@@ -4139,6 +3536,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4147,12 +3545,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = tcp_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147490306)
         obj.value = reader.read("!H")[0]
@@ -4163,13 +3557,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("tcp_src {")
         with q.group():
@@ -4180,7 +3567,9 @@
             q.breakable()
         q.text('}')
 
-class tcp_src_masked(OXM):
+oxm.subtypes[2147490306] = tcp_src
+
+class tcp_src_masked(oxm):
     type_len = 2147490564
 
     def __init__(self, value=None, value_mask=None):
@@ -4192,6 +3581,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4201,12 +3591,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = tcp_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147490564)
         obj.value = reader.read("!H")[0]
@@ -4219,13 +3605,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("tcp_src_masked {")
         with q.group():
@@ -4239,7 +3618,9 @@
             q.breakable()
         q.text('}')
 
-class udp_dst(OXM):
+oxm.subtypes[2147490564] = tcp_src_masked
+
+class udp_dst(oxm):
     type_len = 2147491842
 
     def __init__(self, value=None):
@@ -4247,6 +3628,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4255,12 +3637,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = udp_dst()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147491842)
         obj.value = reader.read("!H")[0]
@@ -4271,13 +3649,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("udp_dst {")
         with q.group():
@@ -4288,7 +3659,9 @@
             q.breakable()
         q.text('}')
 
-class udp_dst_masked(OXM):
+oxm.subtypes[2147491842] = udp_dst
+
+class udp_dst_masked(oxm):
     type_len = 2147492100
 
     def __init__(self, value=None, value_mask=None):
@@ -4300,6 +3673,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4309,12 +3683,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = udp_dst_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147492100)
         obj.value = reader.read("!H")[0]
@@ -4327,13 +3697,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("udp_dst_masked {")
         with q.group():
@@ -4347,7 +3710,9 @@
             q.breakable()
         q.text('}')
 
-class udp_src(OXM):
+oxm.subtypes[2147492100] = udp_dst_masked
+
+class udp_src(oxm):
     type_len = 2147491330
 
     def __init__(self, value=None):
@@ -4355,6 +3720,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4363,12 +3729,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = udp_src()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147491330)
         obj.value = reader.read("!H")[0]
@@ -4379,13 +3741,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("udp_src {")
         with q.group():
@@ -4396,7 +3751,9 @@
             q.breakable()
         q.text('}')
 
-class udp_src_masked(OXM):
+oxm.subtypes[2147491330] = udp_src
+
+class udp_src_masked(oxm):
     type_len = 2147491588
 
     def __init__(self, value=None, value_mask=None):
@@ -4408,6 +3765,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4417,12 +3775,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = udp_src_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147491588)
         obj.value = reader.read("!H")[0]
@@ -4435,13 +3789,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("udp_src_masked {")
         with q.group():
@@ -4455,7 +3802,9 @@
             q.breakable()
         q.text('}')
 
-class vlan_pcp(OXM):
+oxm.subtypes[2147491588] = udp_src_masked
+
+class vlan_pcp(oxm):
     type_len = 2147487233
 
     def __init__(self, value=None):
@@ -4463,6 +3812,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4471,12 +3821,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = vlan_pcp()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147487233)
         obj.value = reader.read("!B")[0]
@@ -4487,13 +3833,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("vlan_pcp {")
         with q.group():
@@ -4504,7 +3843,9 @@
             q.breakable()
         q.text('}')
 
-class vlan_pcp_masked(OXM):
+oxm.subtypes[2147487233] = vlan_pcp
+
+class vlan_pcp_masked(oxm):
     type_len = 2147487490
 
     def __init__(self, value=None, value_mask=None):
@@ -4516,6 +3857,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4525,12 +3867,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = vlan_pcp_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147487490)
         obj.value = reader.read("!B")[0]
@@ -4543,13 +3881,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("vlan_pcp_masked {")
         with q.group():
@@ -4563,7 +3894,9 @@
             q.breakable()
         q.text('}')
 
-class vlan_vid(OXM):
+oxm.subtypes[2147487490] = vlan_pcp_masked
+
+class vlan_vid(oxm):
     type_len = 2147486722
 
     def __init__(self, value=None):
@@ -4571,6 +3904,7 @@
             self.value = value
         else:
             self.value = 0
+        return
 
     def pack(self):
         packed = []
@@ -4579,12 +3913,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = vlan_vid()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147486722)
         obj.value = reader.read("!H")[0]
@@ -4595,13 +3925,6 @@
         if self.value != other.value: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("vlan_vid {")
         with q.group():
@@ -4612,7 +3935,9 @@
             q.breakable()
         q.text('}')
 
-class vlan_vid_masked(OXM):
+oxm.subtypes[2147486722] = vlan_vid
+
+class vlan_vid_masked(oxm):
     type_len = 2147486980
 
     def __init__(self, value=None, value_mask=None):
@@ -4624,6 +3949,7 @@
             self.value_mask = value_mask
         else:
             self.value_mask = 0
+        return
 
     def pack(self):
         packed = []
@@ -4633,12 +3959,8 @@
         return ''.join(packed)
 
     @staticmethod
-    def unpack(buf):
+    def unpack(reader):
         obj = vlan_vid_masked()
-        if type(buf) == loxi.generic_util.OFReader:
-            reader = buf
-        else:
-            reader = loxi.generic_util.OFReader(buf)
         _type_len = reader.read("!L")[0]
         assert(_type_len == 2147486980)
         obj.value = reader.read("!H")[0]
@@ -4651,13 +3973,6 @@
         if self.value_mask != other.value_mask: return False
         return True
 
-    def __ne__(self, other):
-        return not self.__eq__(other)
-
-    def show(self):
-        import loxi.pp
-        return loxi.pp.pp(self)
-
     def pretty_print(self, q):
         q.text("vlan_vid_masked {")
         with q.group():
@@ -4671,92 +3986,6 @@
             q.breakable()
         q.text('}')
 
+oxm.subtypes[2147486980] = vlan_vid_masked
 
-parsers = {
-    196640 : bsn_in_ports_128.unpack,
-    196896 : bsn_in_ports_128_masked.unpack,
-    197124 : bsn_lag_id.unpack,
-    197380 : bsn_lag_id_masked.unpack,
-    197636 : bsn_vrf.unpack,
-    197892 : bsn_vrf_masked.unpack,
-    198145 : bsn_global_vrf_allowed.unpack,
-    198401 : bsn_global_vrf_allowed_masked.unpack,
-    198660 : bsn_l3_interface_class_id.unpack,
-    198916 : bsn_l3_interface_class_id_masked.unpack,
-    199172 : bsn_l3_src_class_id.unpack,
-    199428 : bsn_l3_src_class_id_masked.unpack,
-    199684 : bsn_l3_dst_class_id.unpack,
-    199940 : bsn_l3_dst_class_id_masked.unpack,
-    2147483652 : in_port.unpack,
-    2147483912 : in_port_masked.unpack,
-    2147484164 : in_phy_port.unpack,
-    2147484424 : in_phy_port_masked.unpack,
-    2147484680 : metadata.unpack,
-    2147484944 : metadata_masked.unpack,
-    2147485190 : eth_dst.unpack,
-    2147485452 : eth_dst_masked.unpack,
-    2147485702 : eth_src.unpack,
-    2147485964 : eth_src_masked.unpack,
-    2147486210 : eth_type.unpack,
-    2147486468 : eth_type_masked.unpack,
-    2147486722 : vlan_vid.unpack,
-    2147486980 : vlan_vid_masked.unpack,
-    2147487233 : vlan_pcp.unpack,
-    2147487490 : vlan_pcp_masked.unpack,
-    2147487745 : ip_dscp.unpack,
-    2147488002 : ip_dscp_masked.unpack,
-    2147488257 : ip_ecn.unpack,
-    2147488514 : ip_ecn_masked.unpack,
-    2147488769 : ip_proto.unpack,
-    2147489026 : ip_proto_masked.unpack,
-    2147489284 : ipv4_src.unpack,
-    2147489544 : ipv4_src_masked.unpack,
-    2147489796 : ipv4_dst.unpack,
-    2147490056 : ipv4_dst_masked.unpack,
-    2147490306 : tcp_src.unpack,
-    2147490564 : tcp_src_masked.unpack,
-    2147490818 : tcp_dst.unpack,
-    2147491076 : tcp_dst_masked.unpack,
-    2147491330 : udp_src.unpack,
-    2147491588 : udp_src_masked.unpack,
-    2147491842 : udp_dst.unpack,
-    2147492100 : udp_dst_masked.unpack,
-    2147492354 : sctp_src.unpack,
-    2147492612 : sctp_src_masked.unpack,
-    2147492866 : sctp_dst.unpack,
-    2147493124 : sctp_dst_masked.unpack,
-    2147493377 : icmpv4_type.unpack,
-    2147493634 : icmpv4_type_masked.unpack,
-    2147493889 : icmpv4_code.unpack,
-    2147494146 : icmpv4_code_masked.unpack,
-    2147494402 : arp_op.unpack,
-    2147494660 : arp_op_masked.unpack,
-    2147494916 : arp_spa.unpack,
-    2147495176 : arp_spa_masked.unpack,
-    2147495428 : arp_tpa.unpack,
-    2147495688 : arp_tpa_masked.unpack,
-    2147495942 : arp_sha.unpack,
-    2147496204 : arp_sha_masked.unpack,
-    2147496454 : arp_tha.unpack,
-    2147496716 : arp_tha_masked.unpack,
-    2147496976 : ipv6_src.unpack,
-    2147497248 : ipv6_src_masked.unpack,
-    2147497488 : ipv6_dst.unpack,
-    2147497760 : ipv6_dst_masked.unpack,
-    2147497988 : ipv6_flabel.unpack,
-    2147498248 : ipv6_flabel_masked.unpack,
-    2147498497 : icmpv6_type.unpack,
-    2147498754 : icmpv6_type_masked.unpack,
-    2147499009 : icmpv6_code.unpack,
-    2147499266 : icmpv6_code_masked.unpack,
-    2147499536 : ipv6_nd_target.unpack,
-    2147499808 : ipv6_nd_target_masked.unpack,
-    2147500038 : ipv6_nd_sll.unpack,
-    2147500300 : ipv6_nd_sll_masked.unpack,
-    2147500550 : ipv6_nd_tll.unpack,
-    2147500812 : ipv6_nd_tll_masked.unpack,
-    2147501060 : mpls_label.unpack,
-    2147501320 : mpls_label_masked.unpack,
-    2147501569 : mpls_tc.unpack,
-    2147501826 : mpls_tc_masked.unpack,
-}
+
