diff --git a/src/python/of10/__init__.py b/src/python/of10/__init__.py
new file mode 100644
index 0000000..c4407ee
--- /dev/null
+++ b/src/python/of10/__init__.py
@@ -0,0 +1,8 @@
+"""
+Python OpenFlow 1.0 library
+
+Most of the files in this package are automatically generated by tools/munger.
+They are checked in to simplify running OFTest.
+"""
+
+__all__ = ["action_list", "action", "cstruct", "error", "message", "parse"]
diff --git a/src/python/of10/action.py b/src/python/of10/action.py
new file mode 100644
index 0000000..c478c62
--- /dev/null
+++ b/src/python/of10/action.py
@@ -0,0 +1,372 @@
+
+# Python OpenFlow action wrapper classes
+
+from cstruct import *
+
+
+
+class vendor(ofp_action_vendor_header):
+    """
+    Wrapper class for vendor action object
+
+    Data members inherited from ofp_action_vendor_header:
+    @arg type
+    @arg len
+    @arg vendor
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_vendor_header.__init__(self)
+        self.type = OFPAT_VENDOR
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_vendor\n"
+        outstr += ofp_action_vendor_header.show(self, prefix)
+        return outstr
+
+action_vendor = vendor # for backwards compatibility
+
+
+class set_tp_dst(ofp_action_tp_port):
+    """
+    Wrapper class for set_tp_dst action object
+
+    Data members inherited from ofp_action_tp_port:
+    @arg type
+    @arg len
+    @arg tp_port
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_tp_port.__init__(self)
+        self.type = OFPAT_SET_TP_DST
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_tp_dst\n"
+        outstr += ofp_action_tp_port.show(self, prefix)
+        return outstr
+
+action_set_tp_dst = set_tp_dst # for backwards compatibility
+
+
+class set_vlan_pcp(ofp_action_vlan_pcp):
+    """
+    Wrapper class for set_vlan_pcp action object
+
+    Data members inherited from ofp_action_vlan_pcp:
+    @arg type
+    @arg len
+    @arg vlan_pcp
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_vlan_pcp.__init__(self)
+        self.type = OFPAT_SET_VLAN_PCP
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_vlan_pcp\n"
+        outstr += ofp_action_vlan_pcp.show(self, prefix)
+        return outstr
+
+action_set_vlan_pcp = set_vlan_pcp # for backwards compatibility
+
+
+class enqueue(ofp_action_enqueue):
+    """
+    Wrapper class for enqueue action object
+
+    Data members inherited from ofp_action_enqueue:
+    @arg type
+    @arg len
+    @arg port
+    @arg queue_id
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_enqueue.__init__(self)
+        self.type = OFPAT_ENQUEUE
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_enqueue\n"
+        outstr += ofp_action_enqueue.show(self, prefix)
+        return outstr
+
+action_enqueue = enqueue # for backwards compatibility
+
+
+class set_tp_src(ofp_action_tp_port):
+    """
+    Wrapper class for set_tp_src action object
+
+    Data members inherited from ofp_action_tp_port:
+    @arg type
+    @arg len
+    @arg tp_port
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_tp_port.__init__(self)
+        self.type = OFPAT_SET_TP_SRC
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_tp_src\n"
+        outstr += ofp_action_tp_port.show(self, prefix)
+        return outstr
+
+action_set_tp_src = set_tp_src # for backwards compatibility
+
+
+class set_nw_tos(ofp_action_nw_tos):
+    """
+    Wrapper class for set_nw_tos action object
+
+    Data members inherited from ofp_action_nw_tos:
+    @arg type
+    @arg len
+    @arg nw_tos
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_nw_tos.__init__(self)
+        self.type = OFPAT_SET_NW_TOS
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_nw_tos\n"
+        outstr += ofp_action_nw_tos.show(self, prefix)
+        return outstr
+
+action_set_nw_tos = set_nw_tos # for backwards compatibility
+
+
+class set_nw_dst(ofp_action_nw_addr):
+    """
+    Wrapper class for set_nw_dst action object
+
+    Data members inherited from ofp_action_nw_addr:
+    @arg type
+    @arg len
+    @arg nw_addr
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_nw_addr.__init__(self)
+        self.type = OFPAT_SET_NW_DST
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_nw_dst\n"
+        outstr += ofp_action_nw_addr.show(self, prefix)
+        return outstr
+
+action_set_nw_dst = set_nw_dst # for backwards compatibility
+
+
+class strip_vlan(ofp_action_header):
+    """
+    Wrapper class for strip_vlan action object
+
+    Data members inherited from ofp_action_header:
+    @arg type
+    @arg len
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_header.__init__(self)
+        self.type = OFPAT_STRIP_VLAN
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_strip_vlan\n"
+        outstr += ofp_action_header.show(self, prefix)
+        return outstr
+
+action_strip_vlan = strip_vlan # for backwards compatibility
+
+
+class set_dl_dst(ofp_action_dl_addr):
+    """
+    Wrapper class for set_dl_dst action object
+
+    Data members inherited from ofp_action_dl_addr:
+    @arg type
+    @arg len
+    @arg dl_addr
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_dl_addr.__init__(self)
+        self.type = OFPAT_SET_DL_DST
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_dl_dst\n"
+        outstr += ofp_action_dl_addr.show(self, prefix)
+        return outstr
+
+action_set_dl_dst = set_dl_dst # for backwards compatibility
+
+
+class set_nw_src(ofp_action_nw_addr):
+    """
+    Wrapper class for set_nw_src action object
+
+    Data members inherited from ofp_action_nw_addr:
+    @arg type
+    @arg len
+    @arg nw_addr
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_nw_addr.__init__(self)
+        self.type = OFPAT_SET_NW_SRC
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_nw_src\n"
+        outstr += ofp_action_nw_addr.show(self, prefix)
+        return outstr
+
+action_set_nw_src = set_nw_src # for backwards compatibility
+
+
+class set_vlan_vid(ofp_action_vlan_vid):
+    """
+    Wrapper class for set_vlan_vid action object
+
+    Data members inherited from ofp_action_vlan_vid:
+    @arg type
+    @arg len
+    @arg vlan_vid
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_vlan_vid.__init__(self)
+        self.type = OFPAT_SET_VLAN_VID
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_vlan_vid\n"
+        outstr += ofp_action_vlan_vid.show(self, prefix)
+        return outstr
+
+action_set_vlan_vid = set_vlan_vid # for backwards compatibility
+
+
+class set_dl_src(ofp_action_dl_addr):
+    """
+    Wrapper class for set_dl_src action object
+
+    Data members inherited from ofp_action_dl_addr:
+    @arg type
+    @arg len
+    @arg dl_addr
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_dl_addr.__init__(self)
+        self.type = OFPAT_SET_DL_SRC
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_set_dl_src\n"
+        outstr += ofp_action_dl_addr.show(self, prefix)
+        return outstr
+
+action_set_dl_src = set_dl_src # for backwards compatibility
+
+
+class output(ofp_action_output):
+    """
+    Wrapper class for output action object
+
+    Data members inherited from ofp_action_output:
+    @arg type
+    @arg len
+    @arg port
+    @arg max_len
+
+    """
+    def __init__(self, **kwargs):
+        ofp_action_output.__init__(self)
+        self.type = OFPAT_OUTPUT
+        self.len = self.__len__()
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+    def show(self, prefix=''):
+        outstr = prefix + "action_output\n"
+        outstr += ofp_action_output.show(self, prefix)
+        return outstr
+
+action_output = output # for backwards compatibility
+
+action_class_list = (
+    action_vendor,
+    action_set_tp_dst,
+    action_set_vlan_pcp,
+    action_enqueue,
+    action_set_tp_src,
+    action_set_nw_tos,
+    action_set_nw_dst,
+    action_strip_vlan,
+    action_set_dl_dst,
+    action_set_nw_src,
+    action_set_vlan_vid,
+    action_set_dl_src,
+    action_output)
diff --git a/src/python/of10/action_list.py b/src/python/of10/action_list.py
new file mode 100644
index 0000000..fbbddea
--- /dev/null
+++ b/src/python/of10/action_list.py
@@ -0,0 +1,189 @@
+"""
+OpenFlow actions list class
+"""
+
+from action import *
+from cstruct import ofp_header
+import copy
+
+# # Map OFP action identifiers to the actual structures used on the wire
+# action_object_map = {
+#     OFPAT_OUTPUT                        : ofp_action_output,
+#     OFPAT_SET_VLAN_VID                  : ofp_action_vlan_vid,
+#     OFPAT_SET_VLAN_PCP                  : ofp_action_vlan_pcp,
+#     OFPAT_STRIP_VLAN                    : ofp_action_header,
+#     OFPAT_SET_DL_SRC                    : ofp_action_dl_addr,
+#     OFPAT_SET_DL_DST                    : ofp_action_dl_addr,
+#     OFPAT_SET_NW_SRC                    : ofp_action_nw_addr,
+#     OFPAT_SET_NW_DST                    : ofp_action_nw_addr,
+#     OFPAT_SET_NW_TOS                    : ofp_action_nw_tos,
+#     OFPAT_SET_TP_SRC                    : ofp_action_tp_port,
+#     OFPAT_SET_TP_DST                    : ofp_action_tp_port,
+#     OFPAT_ENQUEUE                       : ofp_action_enqueue
+# }
+
+action_object_map = {
+    OFPAT_OUTPUT                        : action_output,
+    OFPAT_SET_VLAN_VID                  : action_set_vlan_vid,
+    OFPAT_SET_VLAN_PCP                  : action_set_vlan_pcp,
+    OFPAT_STRIP_VLAN                    : action_strip_vlan,
+    OFPAT_SET_DL_SRC                    : action_set_dl_src,
+    OFPAT_SET_DL_DST                    : action_set_dl_dst,
+    OFPAT_SET_NW_SRC                    : action_set_nw_src,
+    OFPAT_SET_NW_DST                    : action_set_nw_dst,
+    OFPAT_SET_NW_TOS                    : action_set_nw_tos,
+    OFPAT_SET_TP_SRC                    : action_set_tp_src,
+    OFPAT_SET_TP_DST                    : action_set_tp_dst,
+    OFPAT_ENQUEUE                       : action_enqueue,
+    OFPAT_VENDOR                        : action_vendor
+}
+
+class action_list(object):
+    """
+    Maintain a list of actions
+
+    Data members:
+    @arg actions: An array of action objects such as action_output, etc.
+
+    Methods:
+    @arg pack: Pack the structure into a string
+    @arg unpack: Unpack a string to objects, with proper typing
+    @arg add: Add an action to the list; you can directly access
+    the action member, but add will validate that the added object 
+    is an action.
+
+    """
+
+    def __init__(self, actions=None):
+        if actions == None:
+            actions = []
+        self.actions = actions
+
+    def pack(self):
+        """
+        Pack a list of actions
+
+        Returns the packed string
+        """
+
+        packed = ""
+        for act in self.actions:
+            packed += act.pack()
+        return packed
+
+    def unpack(self, binary_string, bytes=None):
+        """
+        Unpack a list of actions
+        
+        Unpack actions from a binary string, creating an array
+        of objects of the appropriate type
+
+        @param binary_string The string to be unpacked
+
+        @param bytes The total length of the action list in bytes.  
+        Ignored if decode is True.  If None and decode is false, the
+        list is assumed to extend through the entire string.
+
+        @return The remainder of binary_string that was not parsed
+
+        """
+        if bytes == None:
+            bytes = len(binary_string)
+        bytes_done = 0
+        count = 0
+        cur_string = binary_string
+        while bytes_done < bytes:
+            hdr = ofp_action_header()
+            hdr.unpack(cur_string)
+            if hdr.len < OFP_ACTION_HEADER_BYTES:
+                print "ERROR: Action too short"
+                break
+            if not hdr.type in action_object_map.keys():
+                print "WARNING: Skipping unknown action ", hdr.type, hdr.len
+            else:
+                self.actions.append(action_object_map[hdr.type]())
+                self.actions[count].unpack(cur_string)
+                count += 1
+            cur_string = cur_string[hdr.len:]
+            bytes_done += hdr.len
+        return cur_string
+
+    def add(self, action):
+        """
+        Add an action to an action list
+
+        @param action The action to add
+
+        """
+        if not isinstance(action, action_class_list):
+            raise ValueError("%s is not an action" % type(action))
+        self.actions.append(copy.deepcopy(action))
+        return True # for backwards compatibility
+
+    def remove_type(self, type):
+        """
+        Remove the first action on the list of the given type
+
+        @param type The type of action to search
+
+        @return The object removed, if any; otherwise None
+
+        """
+        for index in xrange(len(self.actions)):
+            if self.actions[index].type == type:
+                return self.actions.pop(index)
+        return None
+
+    def find_type(self, type):
+        """
+        Find the first action on the list of the given type
+
+        @param type The type of action to search
+
+        @return The object with the matching type if any; otherwise None
+
+        """
+        for index in xrange(len(self.actions)):
+            if self.actions[index].type == type:
+                return self.actions[index]
+        return None
+
+    def extend(self, other):
+        """
+        Add the actions in other to this list
+
+        @param other An object of type action_list whose
+        entries are to be merged into this list
+
+        @return True if successful.  If not successful, the list
+        may have been modified.
+
+        @todo Check if this is proper deep copy or not
+
+        """
+        for act in other.actions:
+            self.add(act)
+        return True # for backwards compatibility
+        
+    def __len__(self):
+        length = 0
+        for act in self.actions:
+            length += act.__len__()
+        return length
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        if self.actions != other.actions: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+        
+    def show(self, prefix=''):
+        outstr = prefix + "Action List with " + str(len(self.actions)) + \
+            " actions\n"
+        count = 0
+        for obj in self.actions:
+            count += 1
+            outstr += prefix + "  Action " + str(count) + ": \n"
+            outstr += obj.show(prefix + '    ')
+        return outstr
diff --git a/src/python/of10/class_maps.py b/src/python/of10/class_maps.py
new file mode 100644
index 0000000..19600e6
--- /dev/null
+++ b/src/python/of10/class_maps.py
@@ -0,0 +1,249 @@
+
+# Class to array member map
+class_to_members_map = {
+    'ofp_phy_port'                  : [
+                                       'port_no',
+                                       'hw_addr',
+                                       'name',
+                                       'config',
+                                       'state',
+                                       'curr',
+                                       'advertised',
+                                       'supported',
+                                       'peer'
+                                      ],
+    'ofp_aggregate_stats_reply'     : [
+                                       'packet_count',
+                                       'byte_count',
+                                       'flow_count'
+                                      ],
+    'ofp_table_stats'               : [
+                                       'table_id',
+                                       'name',
+                                       'wildcards',
+                                       'max_entries',
+                                       'active_count',
+                                       'lookup_count',
+                                       'matched_count'
+                                      ],
+    'ofp_flow_removed'              : [
+                                       'match',
+                                       'cookie',
+                                       'priority',
+                                       'reason',
+                                       'duration_sec',
+                                       'duration_nsec',
+                                       'idle_timeout',
+                                       'packet_count',
+                                       'byte_count'
+                                      ],
+    'ofp_port_stats'                : [
+                                       'port_no',
+                                       'rx_packets',
+                                       'tx_packets',
+                                       'rx_bytes',
+                                       'tx_bytes',
+                                       'rx_dropped',
+                                       'tx_dropped',
+                                       'rx_errors',
+                                       'tx_errors',
+                                       'rx_frame_err',
+                                       'rx_over_err',
+                                       'rx_crc_err',
+                                       'collisions'
+                                      ],
+    'ofp_queue_stats'               : [
+                                       'port_no',
+                                       'queue_id',
+                                       'tx_bytes',
+                                       'tx_packets',
+                                       'tx_errors'
+                                      ],
+    'ofp_action_tp_port'            : [
+                                       'type',
+                                       'len',
+                                       'tp_port'
+                                      ],
+    'ofp_port_stats_request'        : [
+                                       'port_no'
+                                      ],
+    'ofp_stats_request'             : [
+                                       'type',
+                                       'flags'
+                                      ],
+    'ofp_aggregate_stats_request'   : [
+                                       'match',
+                                       'table_id',
+                                       'out_port'
+                                      ],
+    'ofp_port_status'               : [
+                                       'reason',
+                                       'desc'
+                                      ],
+    'ofp_action_header'             : [
+                                       'type',
+                                       'len'
+                                      ],
+    'ofp_port_mod'                  : [
+                                       'port_no',
+                                       'hw_addr',
+                                       'config',
+                                       'mask',
+                                       'advertise'
+                                      ],
+    'ofp_action_vlan_vid'           : [
+                                       'type',
+                                       'len',
+                                       'vlan_vid'
+                                      ],
+    'ofp_action_output'             : [
+                                       'type',
+                                       'len',
+                                       'port',
+                                       'max_len'
+                                      ],
+    'ofp_switch_config'             : [
+                                       'flags',
+                                       'miss_send_len'
+                                      ],
+    'ofp_action_nw_tos'             : [
+                                       'type',
+                                       'len',
+                                       'nw_tos'
+                                      ],
+    'ofp_queue_get_config_reply'    : [
+                                       'port'
+                                      ],
+    'ofp_packet_in'                 : [
+                                       'buffer_id',
+                                       'total_len',
+                                       'in_port',
+                                       'reason'
+                                      ],
+    'ofp_flow_stats'                : [
+                                       'length',
+                                       'table_id',
+                                       'match',
+                                       'duration_sec',
+                                       'duration_nsec',
+                                       'priority',
+                                       'idle_timeout',
+                                       'hard_timeout',
+                                       'cookie',
+                                       'packet_count',
+                                       'byte_count'
+                                      ],
+    'ofp_flow_stats_request'        : [
+                                       'match',
+                                       'table_id',
+                                       'out_port'
+                                      ],
+    'ofp_action_vendor_header'      : [
+                                       'type',
+                                       'len',
+                                       'vendor'
+                                      ],
+    'ofp_stats_reply'               : [
+                                       'type',
+                                       'flags'
+                                      ],
+    'ofp_queue_stats_request'       : [
+                                       'port_no',
+                                       'queue_id'
+                                      ],
+    'ofp_desc_stats'                : [
+                                       'mfr_desc',
+                                       'hw_desc',
+                                       'sw_desc',
+                                       'serial_num',
+                                       'dp_desc'
+                                      ],
+    'ofp_queue_get_config_request'  : [
+                                       'port'
+                                      ],
+    'ofp_packet_queue'              : [
+                                       'queue_id',
+                                       'len'
+                                      ],
+    'ofp_action_dl_addr'            : [
+                                       'type',
+                                       'len',
+                                       'dl_addr'
+                                      ],
+    'ofp_queue_prop_header'         : [
+                                       'property',
+                                       'len'
+                                      ],
+    'ofp_queue_prop_min_rate'       : [
+                                       'prop_header',
+                                       'rate'
+                                      ],
+    'ofp_action_enqueue'            : [
+                                       'type',
+                                       'len',
+                                       'port',
+                                       'queue_id'
+                                      ],
+    'ofp_switch_features'           : [
+                                       'datapath_id',
+                                       'n_buffers',
+                                       'n_tables',
+                                       'capabilities',
+                                       'actions'
+                                      ],
+    'ofp_match'                     : [
+                                       'wildcards',
+                                       'in_port',
+                                       'dl_src',
+                                       'dl_dst',
+                                       'dl_vlan',
+                                       'dl_vlan_pcp',
+                                       'dl_type',
+                                       'nw_tos',
+                                       'nw_proto',
+                                       'nw_src',
+                                       'nw_dst',
+                                       'tp_src',
+                                       'tp_dst'
+                                      ],
+    'ofp_header'                    : [
+                                       'version',
+                                       'type',
+                                       'length',
+                                       'xid'
+                                      ],
+    'ofp_vendor_header'             : [
+                                       'vendor'
+                                      ],
+    'ofp_packet_out'                : [
+                                       'buffer_id',
+                                       'in_port',
+                                       'actions_len'
+                                      ],
+    'ofp_action_nw_addr'            : [
+                                       'type',
+                                       'len',
+                                       'nw_addr'
+                                      ],
+    'ofp_action_vlan_pcp'           : [
+                                       'type',
+                                       'len',
+                                       'vlan_pcp'
+                                      ],
+    'ofp_flow_mod'                  : [
+                                       'match',
+                                       'cookie',
+                                       'command',
+                                       'idle_timeout',
+                                       'hard_timeout',
+                                       'priority',
+                                       'buffer_id',
+                                       'out_port',
+                                       'flags'
+                                      ],
+    'ofp_error_msg'                 : [
+                                       'type',
+                                       'code'
+                                      ],
+    '_ignore' : []
+}
diff --git a/src/python/of10/cstruct.py b/src/python/of10/cstruct.py
new file mode 100644
index 0000000..a41e115
--- /dev/null
+++ b/src/python/of10/cstruct.py
@@ -0,0 +1,4021 @@
+import struct
+
+# Structure definitions
+class ofp_phy_port:
+    """Automatically generated Python class for ofp_phy_port
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.hw_addr= [0,0,0,0,0,0]
+        self.name= ""
+        self.config = 0
+        self.state = 0
+        self.curr = 0
+        self.advertised = 0
+        self.supported = 0
+        self.peer = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.hw_addr, list)):
+            return (False, "self.hw_addr is not list as expected.")
+        if(len(self.hw_addr) != 6):
+            return (False, "self.hw_addr is not of size 6 as expected.")
+        if(not isinstance(self.name, str)):
+            return (False, "self.name is not string as expected.")
+        if(len(self.name) > 16):
+            return (False, "self.name is not of size 16 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
+        packed += self.name.ljust(16,'\0')
+        packed += struct.pack("!LLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 48):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
+        self.name = binaryString[8:24].replace("\0","")
+        fmt = '!LLLLLL'
+        start = 24
+        end = start + struct.calcsize(fmt)
+        (self.config, self.state, self.curr, self.advertised, self.supported, self.peer) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[48:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 48
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.hw_addr !=  other.hw_addr: return False
+        if self.name !=  other.name: return False
+        if self.config !=  other.config: return False
+        if self.state !=  other.state: return False
+        if self.curr !=  other.curr: return False
+        if self.advertised !=  other.advertised: return False
+        if self.supported !=  other.supported: return False
+        if self.peer !=  other.peer: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
+        outstr += prefix + 'name: ' + str(self.name) + '\n'
+        outstr += prefix + 'config: ' + str(self.config) + '\n'
+        outstr += prefix + 'state: ' + str(self.state) + '\n'
+        outstr += prefix + 'curr: ' + str(self.curr) + '\n'
+        outstr += prefix + 'advertised: ' + str(self.advertised) + '\n'
+        outstr += prefix + 'supported: ' + str(self.supported) + '\n'
+        outstr += prefix + 'peer: ' + str(self.peer) + '\n'
+        return outstr
+
+
+class ofp_aggregate_stats_reply:
+    """Automatically generated Python class for ofp_aggregate_stats_reply
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.packet_count = 0
+        self.byte_count = 0
+        self.flow_count = 0
+        self.pad= [0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 4):
+            return (False, "self.pad is not of size 4 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count)
+        packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 24):
+            return binaryString
+        fmt = '!QQL'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBB'
+        start = 20
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[24:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 24
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.packet_count !=  other.packet_count: return False
+        if self.byte_count !=  other.byte_count: return False
+        if self.flow_count !=  other.flow_count: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
+        outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
+        outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n'
+        return outstr
+
+
+class ofp_table_stats:
+    """Automatically generated Python class for ofp_table_stats
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.table_id = 0
+        self.pad= [0,0,0]
+        self.name= ""
+        self.wildcards = 0
+        self.max_entries = 0
+        self.active_count = 0
+        self.lookup_count = 0
+        self.matched_count = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 3):
+            return (False, "self.pad is not of size 3 as expected.")
+        if(not isinstance(self.name, str)):
+            return (False, "self.name is not string as expected.")
+        if(len(self.name) > 32):
+            return (False, "self.name is not of size 32 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!B", self.table_id)
+        packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
+        packed += self.name.ljust(32,'\0')
+        packed += struct.pack("!LLLQQ", self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 64):
+            return binaryString
+        fmt = '!B'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.table_id,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBB'
+        start = 1
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
+        self.name = binaryString[4:36].replace("\0","")
+        fmt = '!LLLQQ'
+        start = 36
+        end = start + struct.calcsize(fmt)
+        (self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[64:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 64
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.table_id !=  other.table_id: return False
+        if self.pad !=  other.pad: return False
+        if self.name !=  other.name: return False
+        if self.wildcards !=  other.wildcards: return False
+        if self.max_entries !=  other.max_entries: return False
+        if self.active_count !=  other.active_count: return False
+        if self.lookup_count !=  other.lookup_count: return False
+        if self.matched_count !=  other.matched_count: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
+        outstr += prefix + 'name: ' + str(self.name) + '\n'
+        outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
+        outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n'
+        outstr += prefix + 'active_count: ' + str(self.active_count) + '\n'
+        outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n'
+        outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n'
+        return outstr
+
+
+class ofp_flow_removed:
+    """Automatically generated Python class for ofp_flow_removed
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.match = ofp_match()
+        self.cookie = 0
+        self.priority = 0
+        self.reason = 0
+        self.pad = 0
+        self.duration_sec = 0
+        self.duration_nsec = 0
+        self.idle_timeout = 0
+        self.pad2= [0,0]
+        self.packet_count = 0
+        self.byte_count = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.match, ofp_match)):
+            return (False, "self.match is not class ofp_match as expected.")
+        if(not isinstance(self.pad2, list)):
+            return (False, "self.pad2 is not list as expected.")
+        if(len(self.pad2) != 2):
+            return (False, "self.pad2 is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.match.pack()
+        packed += struct.pack("!QHBBLLH", self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout)
+        packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
+        packed += struct.pack("!QQ", self.packet_count, self.byte_count)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 80):
+            return binaryString
+        self.match.unpack(binaryString[0:])
+        fmt = '!QHBBLLH'
+        start = 40
+        end = start + struct.calcsize(fmt)
+        (self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BB'
+        start = 62
+        end = start + struct.calcsize(fmt)
+        (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!QQ'
+        start = 64
+        end = start + struct.calcsize(fmt)
+        (self.packet_count, self.byte_count) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[80:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 80
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.match !=  other.match: return False
+        if self.cookie !=  other.cookie: return False
+        if self.priority !=  other.priority: return False
+        if self.reason !=  other.reason: return False
+        if self.pad !=  other.pad: return False
+        if self.duration_sec !=  other.duration_sec: return False
+        if self.duration_nsec !=  other.duration_nsec: return False
+        if self.idle_timeout !=  other.idle_timeout: return False
+        if self.pad2 !=  other.pad2: return False
+        if self.packet_count !=  other.packet_count: return False
+        if self.byte_count !=  other.byte_count: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'match: \n' 
+        outstr += self.match.show(prefix + '  ')
+        outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
+        outstr += prefix + 'priority: ' + str(self.priority) + '\n'
+        outstr += prefix + 'reason: ' + str(self.reason) + '\n'
+        outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
+        outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
+        outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
+        outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
+        outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
+        return outstr
+
+
+class ofp_port_stats:
+    """Automatically generated Python class for ofp_port_stats
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.pad= [0,0,0,0,0,0]
+        self.rx_packets = 0
+        self.tx_packets = 0
+        self.rx_bytes = 0
+        self.tx_bytes = 0
+        self.rx_dropped = 0
+        self.tx_dropped = 0
+        self.rx_errors = 0
+        self.tx_errors = 0
+        self.rx_frame_err = 0
+        self.rx_over_err = 0
+        self.rx_crc_err = 0
+        self.collisions = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        packed += struct.pack("!QQQQQQQQQQQQ", self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 104):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!QQQQQQQQQQQQ'
+        start = 8
+        end = start + struct.calcsize(fmt)
+        (self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[104:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 104
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.pad !=  other.pad: return False
+        if self.rx_packets !=  other.rx_packets: return False
+        if self.tx_packets !=  other.tx_packets: return False
+        if self.rx_bytes !=  other.rx_bytes: return False
+        if self.tx_bytes !=  other.tx_bytes: return False
+        if self.rx_dropped !=  other.rx_dropped: return False
+        if self.tx_dropped !=  other.tx_dropped: return False
+        if self.rx_errors !=  other.rx_errors: return False
+        if self.tx_errors !=  other.tx_errors: return False
+        if self.rx_frame_err !=  other.rx_frame_err: return False
+        if self.rx_over_err !=  other.rx_over_err: return False
+        if self.rx_crc_err !=  other.rx_crc_err: return False
+        if self.collisions !=  other.collisions: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n'
+        outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
+        outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n'
+        outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
+        outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n'
+        outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n'
+        outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n'
+        outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
+        outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n'
+        outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n'
+        outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n'
+        outstr += prefix + 'collisions: ' + str(self.collisions) + '\n'
+        return outstr
+
+
+class ofp_queue_stats:
+    """Automatically generated Python class for ofp_queue_stats
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.pad= [0,0]
+        self.queue_id = 0
+        self.tx_bytes = 0
+        self.tx_packets = 0
+        self.tx_errors = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        packed += struct.pack("!LQQQ", self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 32):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!LQQQ'
+        start = 4
+        end = start + struct.calcsize(fmt)
+        (self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[32:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 32
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.pad !=  other.pad: return False
+        if self.queue_id !=  other.queue_id: return False
+        if self.tx_bytes !=  other.tx_bytes: return False
+        if self.tx_packets !=  other.tx_packets: return False
+        if self.tx_errors !=  other.tx_errors: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
+        outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n'
+        outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n'
+        outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n'
+        return outstr
+
+
+class ofp_action_tp_port:
+    """Automatically generated Python class for ofp_action_tp_port
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.tp_port = 0
+        self.pad= [0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHH", self.type, self.len, self.tp_port)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.tp_port) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BB'
+        start = 6
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.tp_port !=  other.tp_port: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'tp_port: ' + str(self.tp_port) + '\n'
+        return outstr
+
+
+class ofp_port_stats_request:
+    """Automatically generated Python class for ofp_port_stats_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.pad= [0,0,0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        return outstr
+
+
+class ofp_stats_request:
+    """Automatically generated Python class for ofp_stats_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.flags = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.type, self.flags)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.flags) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.flags !=  other.flags: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'flags: ' + str(self.flags) + '\n'
+        return outstr
+
+
+class ofp_hello:
+    """Automatically generated Python class for ofp_hello
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 0):
+            return binaryString
+        return binaryString[0:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 0
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        return outstr
+
+
+class ofp_aggregate_stats_request:
+    """Automatically generated Python class for ofp_aggregate_stats_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.match = ofp_match()
+        self.table_id = 0
+        self.pad = 0
+        self.out_port = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.match, ofp_match)):
+            return (False, "self.match is not class ofp_match as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.match.pack()
+        packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 44):
+            return binaryString
+        self.match.unpack(binaryString[0:])
+        fmt = '!BBH'
+        start = 40
+        end = start + struct.calcsize(fmt)
+        (self.table_id, self.pad, self.out_port) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[44:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 44
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.match !=  other.match: return False
+        if self.table_id !=  other.table_id: return False
+        if self.pad !=  other.pad: return False
+        if self.out_port !=  other.out_port: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'match: \n' 
+        outstr += self.match.show(prefix + '  ')
+        outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
+        outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
+        return outstr
+
+
+class ofp_port_status:
+    """Automatically generated Python class for ofp_port_status
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.reason = 0
+        self.pad= [0,0,0,0,0,0,0]
+        self.desc = ofp_phy_port()
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 7):
+            return (False, "self.pad is not of size 7 as expected.")
+        if(not isinstance(self.desc, ofp_phy_port)):
+            return (False, "self.desc is not class ofp_phy_port as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!B", self.reason)
+        packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
+        packed += self.desc.pack()
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 56):
+            return binaryString
+        fmt = '!B'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.reason,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBBB'
+        start = 1
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
+        self.desc.unpack(binaryString[8:])
+        return binaryString[56:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 56
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.reason !=  other.reason: return False
+        if self.pad !=  other.pad: return False
+        if self.desc !=  other.desc: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'reason: ' + str(self.reason) + '\n'
+        outstr += prefix + 'desc: \n' 
+        outstr += self.desc.show(prefix + '  ')
+        return outstr
+
+
+class ofp_action_header:
+    """Automatically generated Python class for ofp_action_header
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.pad= [0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 4):
+            return (False, "self.pad is not of size 4 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.type, self.len)
+        packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBB'
+        start = 4
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        return outstr
+
+
+class ofp_port_mod:
+    """Automatically generated Python class for ofp_port_mod
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.hw_addr= [0,0,0,0,0,0]
+        self.config = 0
+        self.mask = 0
+        self.advertise = 0
+        self.pad= [0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.hw_addr, list)):
+            return (False, "self.hw_addr is not list as expected.")
+        if(len(self.hw_addr) != 6):
+            return (False, "self.hw_addr is not of size 6 as expected.")
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 4):
+            return (False, "self.pad is not of size 4 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
+        packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
+        packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 24):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!LLL'
+        start = 8
+        end = start + struct.calcsize(fmt)
+        (self.config, self.mask, self.advertise) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBB'
+        start = 20
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[24:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 24
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.hw_addr !=  other.hw_addr: return False
+        if self.config !=  other.config: return False
+        if self.mask !=  other.mask: return False
+        if self.advertise !=  other.advertise: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
+        outstr += prefix + 'config: ' + str(self.config) + '\n'
+        outstr += prefix + 'mask: ' + str(self.mask) + '\n'
+        outstr += prefix + 'advertise: ' + str(self.advertise) + '\n'
+        return outstr
+
+
+class ofp_action_vlan_vid:
+    """Automatically generated Python class for ofp_action_vlan_vid
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.vlan_vid = 0
+        self.pad= [0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHH", self.type, self.len, self.vlan_vid)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.vlan_vid) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BB'
+        start = 6
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.vlan_vid !=  other.vlan_vid: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n'
+        return outstr
+
+
+class ofp_action_output:
+    """Automatically generated Python class for ofp_action_output
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.port = 0
+        self.max_len = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHHH", self.type, self.len, self.port, self.max_len)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHHH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.port !=  other.port: return False
+        if self.max_len !=  other.max_len: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'port: ' + str(self.port) + '\n'
+        outstr += prefix + 'max_len: ' + str(self.max_len) + '\n'
+        return outstr
+
+
+class ofp_switch_config:
+    """Automatically generated Python class for ofp_switch_config
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.flags = 0
+        self.miss_send_len = 128
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.flags, self.miss_send_len)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.flags, self.miss_send_len) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.flags !=  other.flags: return False
+        if self.miss_send_len !=  other.miss_send_len: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'flags: ' + str(self.flags) + '\n'
+        outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
+        return outstr
+
+
+class ofp_action_nw_tos:
+    """Automatically generated Python class for ofp_action_nw_tos
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.nw_tos = 0
+        self.pad= [0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 3):
+            return (False, "self.pad is not of size 3 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHB", self.type, self.len, self.nw_tos)
+        packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHB'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.nw_tos) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBB'
+        start = 5
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.nw_tos !=  other.nw_tos: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n'
+        return outstr
+
+
+class ofp_queue_get_config_reply:
+    """Automatically generated Python class for ofp_queue_get_config_reply
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port = 0
+        self.pad= [0,0,0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port)
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port !=  other.port: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port: ' + str(self.port) + '\n'
+        return outstr
+
+
+class ofp_packet_in:
+    """Automatically generated Python class for ofp_packet_in
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.buffer_id = 0
+        self.total_len = 0
+        self.in_port = 0
+        self.reason = 0
+        self.pad = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!LHHBB", self.buffer_id, self.total_len, self.in_port, self.reason, self.pad)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 10):
+            return binaryString
+        fmt = '!LHHBB'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.buffer_id, self.total_len, self.in_port, self.reason, self.pad) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[10:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 10
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.buffer_id !=  other.buffer_id: return False
+        if self.total_len !=  other.total_len: return False
+        if self.in_port !=  other.in_port: return False
+        if self.reason !=  other.reason: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
+        outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
+        outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
+        outstr += prefix + 'reason: ' + str(self.reason) + '\n'
+        return outstr
+
+
+class ofp_flow_stats:
+    """Automatically generated Python class for ofp_flow_stats
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.length = 0
+        self.table_id = 0
+        self.pad = 0
+        self.match = ofp_match()
+        self.duration_sec = 0
+        self.duration_nsec = 0
+        self.priority = 0x8000
+        self.idle_timeout = 0
+        self.hard_timeout = 0
+        self.pad2= [0,0,0,0,0,0]
+        self.cookie = 0
+        self.packet_count = 0
+        self.byte_count = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.match, ofp_match)):
+            return (False, "self.match is not class ofp_match as expected.")
+        if(not isinstance(self.pad2, list)):
+            return (False, "self.pad2 is not list as expected.")
+        if(len(self.pad2) != 6):
+            return (False, "self.pad2 is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HBB", self.length, self.table_id, self.pad)
+        packed += self.match.pack()
+        packed += struct.pack("!LLHHH", self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout)
+        packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5])
+        packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 88):
+            return binaryString
+        fmt = '!HBB'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.length, self.table_id, self.pad) = struct.unpack(fmt,  binaryString[start:end])
+        self.match.unpack(binaryString[4:])
+        fmt = '!LLHHH'
+        start = 44
+        end = start + struct.calcsize(fmt)
+        (self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 58
+        end = start + struct.calcsize(fmt)
+        (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!QQQ'
+        start = 64
+        end = start + struct.calcsize(fmt)
+        (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[88:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 88
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.length !=  other.length: return False
+        if self.table_id !=  other.table_id: return False
+        if self.pad !=  other.pad: return False
+        if self.match !=  other.match: return False
+        if self.duration_sec !=  other.duration_sec: return False
+        if self.duration_nsec !=  other.duration_nsec: return False
+        if self.priority !=  other.priority: return False
+        if self.idle_timeout !=  other.idle_timeout: return False
+        if self.hard_timeout !=  other.hard_timeout: return False
+        if self.pad2 !=  other.pad2: return False
+        if self.cookie !=  other.cookie: return False
+        if self.packet_count !=  other.packet_count: return False
+        if self.byte_count !=  other.byte_count: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'length: ' + str(self.length) + '\n'
+        outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
+        outstr += prefix + 'match: \n' 
+        outstr += self.match.show(prefix + '  ')
+        outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n'
+        outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n'
+        outstr += prefix + 'priority: ' + str(self.priority) + '\n'
+        outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
+        outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
+        outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
+        outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n'
+        outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n'
+        return outstr
+
+
+class ofp_flow_stats_request:
+    """Automatically generated Python class for ofp_flow_stats_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.match = ofp_match()
+        self.table_id = 0
+        self.pad = 0
+        self.out_port = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.match, ofp_match)):
+            return (False, "self.match is not class ofp_match as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.match.pack()
+        packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 44):
+            return binaryString
+        self.match.unpack(binaryString[0:])
+        fmt = '!BBH'
+        start = 40
+        end = start + struct.calcsize(fmt)
+        (self.table_id, self.pad, self.out_port) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[44:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 44
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.match !=  other.match: return False
+        if self.table_id !=  other.table_id: return False
+        if self.pad !=  other.pad: return False
+        if self.out_port !=  other.out_port: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'match: \n' 
+        outstr += self.match.show(prefix + '  ')
+        outstr += prefix + 'table_id: ' + str(self.table_id) + '\n'
+        outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
+        return outstr
+
+
+class ofp_action_vendor_header:
+    """Automatically generated Python class for ofp_action_vendor_header
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.vendor = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHL", self.type, self.len, self.vendor)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHL'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.vendor) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.vendor !=  other.vendor: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'vendor: ' + str(self.vendor) + '\n'
+        return outstr
+
+
+class ofp_stats_reply:
+    """Automatically generated Python class for ofp_stats_reply
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.flags = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.type, self.flags)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.flags) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.flags !=  other.flags: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'flags: ' + str(self.flags) + '\n'
+        return outstr
+
+
+class ofp_queue_stats_request:
+    """Automatically generated Python class for ofp_queue_stats_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port_no = 0
+        self.pad= [0,0]
+        self.queue_id = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port_no)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        packed += struct.pack("!L", self.queue_id)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!L'
+        start = 4
+        end = start + struct.calcsize(fmt)
+        (self.queue_id,) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port_no !=  other.port_no: return False
+        if self.pad !=  other.pad: return False
+        if self.queue_id !=  other.queue_id: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
+        outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
+        return outstr
+
+
+class ofp_desc_stats:
+    """Automatically generated Python class for ofp_desc_stats
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.mfr_desc= ""
+        self.hw_desc= ""
+        self.sw_desc= ""
+        self.serial_num= ""
+        self.dp_desc= ""
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.mfr_desc, str)):
+            return (False, "self.mfr_desc is not string as expected.")
+        if(len(self.mfr_desc) > 256):
+            return (False, "self.mfr_desc is not of size 256 as expected.")
+        if(not isinstance(self.hw_desc, str)):
+            return (False, "self.hw_desc is not string as expected.")
+        if(len(self.hw_desc) > 256):
+            return (False, "self.hw_desc is not of size 256 as expected.")
+        if(not isinstance(self.sw_desc, str)):
+            return (False, "self.sw_desc is not string as expected.")
+        if(len(self.sw_desc) > 256):
+            return (False, "self.sw_desc is not of size 256 as expected.")
+        if(not isinstance(self.serial_num, str)):
+            return (False, "self.serial_num is not string as expected.")
+        if(len(self.serial_num) > 32):
+            return (False, "self.serial_num is not of size 32 as expected.")
+        if(not isinstance(self.dp_desc, str)):
+            return (False, "self.dp_desc is not string as expected.")
+        if(len(self.dp_desc) > 256):
+            return (False, "self.dp_desc is not of size 256 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.mfr_desc.ljust(256,'\0')
+        packed += self.hw_desc.ljust(256,'\0')
+        packed += self.sw_desc.ljust(256,'\0')
+        packed += self.serial_num.ljust(32,'\0')
+        packed += self.dp_desc.ljust(256,'\0')
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 1056):
+            return binaryString
+        self.mfr_desc = binaryString[0:256].replace("\0","")
+        self.hw_desc = binaryString[256:512].replace("\0","")
+        self.sw_desc = binaryString[512:768].replace("\0","")
+        self.serial_num = binaryString[768:800].replace("\0","")
+        self.dp_desc = binaryString[800:1056].replace("\0","")
+        return binaryString[1056:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 1056
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.mfr_desc !=  other.mfr_desc: return False
+        if self.hw_desc !=  other.hw_desc: return False
+        if self.sw_desc !=  other.sw_desc: return False
+        if self.serial_num !=  other.serial_num: return False
+        if self.dp_desc !=  other.dp_desc: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n'
+        outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n'
+        outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n'
+        outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n'
+        outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n'
+        return outstr
+
+
+class ofp_queue_get_config_request:
+    """Automatically generated Python class for ofp_queue_get_config_request
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.port = 0
+        self.pad= [0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!H", self.port)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!H'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.port,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BB'
+        start = 2
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.port !=  other.port: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'port: ' + str(self.port) + '\n'
+        return outstr
+
+
+class ofp_packet_queue:
+    """Automatically generated Python class for ofp_packet_queue
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.queue_id = 0
+        self.len = 0
+        self.pad= [0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 2):
+            return (False, "self.pad is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!LH", self.queue_id, self.len)
+        packed += struct.pack("!BB", self.pad[0], self.pad[1])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!LH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.queue_id, self.len) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BB'
+        start = 6
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.queue_id !=  other.queue_id: return False
+        if self.len !=  other.len: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        return outstr
+
+
+class ofp_action_dl_addr:
+    """Automatically generated Python class for ofp_action_dl_addr
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.dl_addr= [0,0,0,0,0,0]
+        self.pad= [0,0,0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.dl_addr, list)):
+            return (False, "self.dl_addr is not list as expected.")
+        if(len(self.dl_addr) != 6):
+            return (False, "self.dl_addr is not of size 6 as expected.")
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.type, self.len)
+        packed += struct.pack("!BBBBBB", self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5])
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 16):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 4
+        end = start + struct.calcsize(fmt)
+        (self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 10
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[16:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 16
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.dl_addr !=  other.dl_addr: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'dl_addr: ' + str(self.dl_addr) + '\n'
+        return outstr
+
+
+class ofp_queue_prop_header:
+    """Automatically generated Python class for ofp_queue_prop_header
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.property = 0
+        self.len = 0
+        self.pad= [0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 4):
+            return (False, "self.pad is not of size 4 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.property, self.len)
+        packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.property, self.len) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBB'
+        start = 4
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.property !=  other.property: return False
+        if self.len !=  other.len: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'property: ' + str(self.property) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        return outstr
+
+
+class ofp_queue_prop_min_rate:
+    """Automatically generated Python class for ofp_queue_prop_min_rate
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.prop_header = ofp_queue_prop_header()
+        self.rate = 0
+        self.pad= [0,0,0,0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.prop_header, ofp_queue_prop_header)):
+            return (False, "self.prop_header is not class ofp_queue_prop_header as expected.")
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.prop_header.pack()
+        packed += struct.pack("!H", self.rate)
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 16):
+            return binaryString
+        self.prop_header.unpack(binaryString[0:])
+        fmt = '!H'
+        start = 8
+        end = start + struct.calcsize(fmt)
+        (self.rate,) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 10
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[16:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 16
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.prop_header !=  other.prop_header: return False
+        if self.rate !=  other.rate: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'prop_header: \n' 
+        outstr += self.prop_header.show(prefix + '  ')
+        outstr += prefix + 'rate: ' + str(self.rate) + '\n'
+        return outstr
+
+
+class ofp_action_enqueue:
+    """Automatically generated Python class for ofp_action_enqueue
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.port = 0
+        self.pad= [0,0,0,0,0,0]
+        self.queue_id = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 6):
+            return (False, "self.pad is not of size 6 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHH", self.type, self.len, self.port)
+        packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
+        packed += struct.pack("!L", self.queue_id)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 16):
+            return binaryString
+        fmt = '!HHH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.port) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 6
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!L'
+        start = 12
+        end = start + struct.calcsize(fmt)
+        (self.queue_id,) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[16:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 16
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.port !=  other.port: return False
+        if self.pad !=  other.pad: return False
+        if self.queue_id !=  other.queue_id: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'port: ' + str(self.port) + '\n'
+        outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n'
+        return outstr
+
+
+class ofp_switch_features:
+    """Automatically generated Python class for ofp_switch_features
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.datapath_id = 0
+        self.n_buffers = 0
+        self.n_tables = 0
+        self.pad= [0,0,0]
+        self.capabilities = 0
+        self.actions = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 3):
+            return (False, "self.pad is not of size 3 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
+        packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
+        packed += struct.pack("!LL", self.capabilities, self.actions)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 24):
+            return binaryString
+        fmt = '!QLB'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBB'
+        start = 13
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!LL'
+        start = 16
+        end = start + struct.calcsize(fmt)
+        (self.capabilities, self.actions) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[24:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 24
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.datapath_id !=  other.datapath_id: return False
+        if self.n_buffers !=  other.n_buffers: return False
+        if self.n_tables !=  other.n_tables: return False
+        if self.pad !=  other.pad: return False
+        if self.capabilities !=  other.capabilities: return False
+        if self.actions !=  other.actions: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
+        outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
+        outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
+        outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n'
+        outstr += prefix + 'actions: ' + str(self.actions) + '\n'
+        return outstr
+
+
+class ofp_match:
+    """Automatically generated Python class for ofp_match
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.wildcards = 0
+        self.in_port = 0
+        self.dl_src= [0,0,0,0,0,0]
+        self.dl_dst= [0,0,0,0,0,0]
+        self.dl_vlan = 0
+        self.dl_vlan_pcp = 0
+        self.pad1 = 0
+        self.dl_type = 0
+        self.nw_tos = 0
+        self.nw_proto = 0
+        self.pad2= [0,0]
+        self.nw_src = 0
+        self.nw_dst = 0
+        self.tp_src = 0
+        self.tp_dst = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.dl_src, list)):
+            return (False, "self.dl_src is not list as expected.")
+        if(len(self.dl_src) != 6):
+            return (False, "self.dl_src is not of size 6 as expected.")
+        if(not isinstance(self.dl_dst, list)):
+            return (False, "self.dl_dst is not list as expected.")
+        if(len(self.dl_dst) != 6):
+            return (False, "self.dl_dst is not of size 6 as expected.")
+        if(not isinstance(self.pad2, list)):
+            return (False, "self.pad2 is not list as expected.")
+        if(len(self.pad2) != 2):
+            return (False, "self.pad2 is not of size 2 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!LH", self.wildcards, self.in_port)
+        packed += struct.pack("!BBBBBB", self.dl_src[0], self.dl_src[1], self.dl_src[2], self.dl_src[3], self.dl_src[4], self.dl_src[5])
+        packed += struct.pack("!BBBBBB", self.dl_dst[0], self.dl_dst[1], self.dl_dst[2], self.dl_dst[3], self.dl_dst[4], self.dl_dst[5])
+        packed += struct.pack("!HBBHBB", self.dl_vlan, self.dl_vlan_pcp, self.pad1, self.dl_type, self.nw_tos, self.nw_proto)
+        packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
+        packed += struct.pack("!LLHH", self.nw_src, self.nw_dst, self.tp_src, self.tp_dst)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 40):
+            return binaryString
+        fmt = '!LH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.wildcards, self.in_port) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 6
+        end = start + struct.calcsize(fmt)
+        (self.dl_src[0], self.dl_src[1], self.dl_src[2], self.dl_src[3], self.dl_src[4], self.dl_src[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!BBBBBB'
+        start = 12
+        end = start + struct.calcsize(fmt)
+        (self.dl_dst[0], self.dl_dst[1], self.dl_dst[2], self.dl_dst[3], self.dl_dst[4], self.dl_dst[5]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!HBBHBB'
+        start = 18
+        end = start + struct.calcsize(fmt)
+        (self.dl_vlan, self.dl_vlan_pcp, self.pad1, self.dl_type, self.nw_tos, self.nw_proto) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BB'
+        start = 26
+        end = start + struct.calcsize(fmt)
+        (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
+        fmt = '!LLHH'
+        start = 28
+        end = start + struct.calcsize(fmt)
+        (self.nw_src, self.nw_dst, self.tp_src, self.tp_dst) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[40:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 40
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.wildcards !=  other.wildcards: return False
+        if self.in_port !=  other.in_port: return False
+        if self.dl_src !=  other.dl_src: return False
+        if self.dl_dst !=  other.dl_dst: return False
+        if self.dl_vlan !=  other.dl_vlan: return False
+        if self.dl_vlan_pcp !=  other.dl_vlan_pcp: return False
+        if self.pad1 !=  other.pad1: return False
+        if self.dl_type !=  other.dl_type: return False
+        if self.nw_tos !=  other.nw_tos: return False
+        if self.nw_proto !=  other.nw_proto: return False
+        if self.pad2 !=  other.pad2: return False
+        if self.nw_src !=  other.nw_src: return False
+        if self.nw_dst !=  other.nw_dst: return False
+        if self.tp_src !=  other.tp_src: return False
+        if self.tp_dst !=  other.tp_dst: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n'
+        outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
+        outstr += prefix + 'dl_src: ' + str(self.dl_src) + '\n'
+        outstr += prefix + 'dl_dst: ' + str(self.dl_dst) + '\n'
+        outstr += prefix + 'dl_vlan: ' + str(self.dl_vlan) + '\n'
+        outstr += prefix + 'dl_vlan_pcp: ' + str(self.dl_vlan_pcp) + '\n'
+        outstr += prefix + 'dl_type: ' + str(self.dl_type) + '\n'
+        outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n'
+        outstr += prefix + 'nw_proto: ' + str(self.nw_proto) + '\n'
+        outstr += prefix + 'nw_src: ' + str(self.nw_src) + '\n'
+        outstr += prefix + 'nw_dst: ' + str(self.nw_dst) + '\n'
+        outstr += prefix + 'tp_src: ' + str(self.tp_src) + '\n'
+        outstr += prefix + 'tp_dst: ' + str(self.tp_dst) + '\n'
+        return outstr
+
+
+class ofp_header:
+    """Automatically generated Python class for ofp_header
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.version = 0x01
+        self.type = 0
+        self.length = 0
+        self.xid = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if (not (self.type in ofp_type_map.keys())):
+            return (False, "type must have values from ofp_type_map.keys()")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!BBHL'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.version, self.type, self.length, self.xid) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.version !=  other.version: return False
+        if self.type !=  other.type: return False
+        if self.length !=  other.length: return False
+        if self.xid !=  other.xid: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'version: ' + str(self.version) + '\n'
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'length: ' + str(self.length) + '\n'
+        outstr += prefix + 'xid: ' + str(self.xid) + '\n'
+        return outstr
+
+
+class ofp_vendor_header:
+    """Automatically generated Python class for ofp_vendor_header
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.vendor = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!L", self.vendor)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!L'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.vendor,) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.vendor !=  other.vendor: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'vendor: ' + str(self.vendor) + '\n'
+        return outstr
+
+
+class ofp_packet_out:
+    """Automatically generated Python class for ofp_packet_out
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.buffer_id = 4294967295
+        self.in_port = 0
+        self.actions_len = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!LHH", self.buffer_id, self.in_port, self.actions_len)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!LHH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.buffer_id !=  other.buffer_id: return False
+        if self.in_port !=  other.in_port: return False
+        if self.actions_len !=  other.actions_len: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
+        outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
+        outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
+        return outstr
+
+
+class ofp_action_nw_addr:
+    """Automatically generated Python class for ofp_action_nw_addr
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.nw_addr = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHL", self.type, self.len, self.nw_addr)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHL'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.nw_addr) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.nw_addr !=  other.nw_addr: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'nw_addr: ' + str(self.nw_addr) + '\n'
+        return outstr
+
+
+class ofp_action_vlan_pcp:
+    """Automatically generated Python class for ofp_action_vlan_pcp
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.len = 0
+        self.vlan_pcp = 0
+        self.pad= [0,0,0]
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.pad, list)):
+            return (False, "self.pad is not list as expected.")
+        if(len(self.pad) != 3):
+            return (False, "self.pad is not of size 3 as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HHB", self.type, self.len, self.vlan_pcp)
+        packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 8):
+            return binaryString
+        fmt = '!HHB'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.len, self.vlan_pcp) = struct.unpack(fmt,  binaryString[start:end])
+        fmt = '!BBB'
+        start = 5
+        end = start + struct.calcsize(fmt)
+        (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
+        return binaryString[8:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 8
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.len !=  other.len: return False
+        if self.vlan_pcp !=  other.vlan_pcp: return False
+        if self.pad !=  other.pad: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'len: ' + str(self.len) + '\n'
+        outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n'
+        return outstr
+
+
+class ofp_flow_mod:
+    """Automatically generated Python class for ofp_flow_mod
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.match = ofp_match()
+        self.cookie = 0
+        self.command = 0
+        self.idle_timeout = 0
+        self.hard_timeout = 0
+        self.priority = 0x8000
+        self.buffer_id = 0
+        self.out_port = 0
+        self.flags = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        if(not isinstance(self.match, ofp_match)):
+            return (False, "self.match is not class ofp_match as expected.")
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += self.match.pack()
+        packed += struct.pack("!QHHHHLHH", self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 64):
+            return binaryString
+        self.match.unpack(binaryString[0:])
+        fmt = '!QHHHHLHH'
+        start = 40
+        end = start + struct.calcsize(fmt)
+        (self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[64:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 64
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.match !=  other.match: return False
+        if self.cookie !=  other.cookie: return False
+        if self.command !=  other.command: return False
+        if self.idle_timeout !=  other.idle_timeout: return False
+        if self.hard_timeout !=  other.hard_timeout: return False
+        if self.priority !=  other.priority: return False
+        if self.buffer_id !=  other.buffer_id: return False
+        if self.out_port !=  other.out_port: return False
+        if self.flags !=  other.flags: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'match: \n' 
+        outstr += self.match.show(prefix + '  ')
+        outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
+        outstr += prefix + 'command: ' + str(self.command) + '\n'
+        outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n'
+        outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n'
+        outstr += prefix + 'priority: ' + str(self.priority) + '\n'
+        outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
+        outstr += prefix + 'out_port: ' + str(self.out_port) + '\n'
+        outstr += prefix + 'flags: ' + str(self.flags) + '\n'
+        return outstr
+
+
+class ofp_error_msg:
+    """Automatically generated Python class for ofp_error_msg
+
+    Date 2013-01-06
+    Created by of.pythonize.pythonizer
+    Core structure: Messages do not include ofp_header
+    Does not include var-length arrays
+    """
+    def __init__(self):
+        """Initialize
+        Declare members and default values
+        """
+        self.type = 0
+        self.code = 0
+
+    def __assert(self):
+        """Sanity check
+        """
+        return (True, None)
+
+    def pack(self, assertstruct=True):
+        """Pack message
+        Packs empty array used as placeholder
+        """
+        if(assertstruct):
+            if(not self.__assert()[0]):
+                return None
+        packed = ""
+        packed += struct.pack("!HH", self.type, self.code)
+        return packed
+
+    def unpack(self, binaryString):
+        """Unpack message
+        Do not unpack empty array used as placeholder
+        since they can contain heterogeneous type
+        """
+        if (len(binaryString) < 4):
+            return binaryString
+        fmt = '!HH'
+        start = 0
+        end = start + struct.calcsize(fmt)
+        (self.type, self.code) = struct.unpack(fmt,  binaryString[start:end])
+        return binaryString[4:]
+
+    def __len__(self):
+        """Return length of message
+        """
+        l = 4
+        return l
+
+    def __eq__(self, other):
+        """Return True if self and other have same values
+        """
+        if type(self) != type(other): return False
+        if self.type !=  other.type: return False
+        if self.code !=  other.code: return False
+        return True
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+    def show(self, prefix=''):
+        """Generate string showing basic members of structure
+        """
+        outstr = ''
+        outstr += prefix + 'type: ' + str(self.type) + '\n'
+        outstr += prefix + 'code: ' + str(self.code) + '\n'
+        return outstr
+
+
+# Enumerated type definitions
+ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_FLOW_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED']
+OFPET_HELLO_FAILED                  = 0
+OFPET_BAD_REQUEST                   = 1
+OFPET_BAD_ACTION                    = 2
+OFPET_FLOW_MOD_FAILED               = 3
+OFPET_PORT_MOD_FAILED               = 4
+OFPET_QUEUE_OP_FAILED               = 5
+ofp_error_type_map = {
+    0                               : 'OFPET_HELLO_FAILED',
+    1                               : 'OFPET_BAD_REQUEST',
+    2                               : 'OFPET_BAD_ACTION',
+    3                               : 'OFPET_FLOW_MOD_FAILED',
+    4                               : 'OFPET_PORT_MOD_FAILED',
+    5                               : 'OFPET_QUEUE_OP_FAILED'
+}
+
+ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP', 'OFPFF_EMERG']
+OFPFF_SEND_FLOW_REM                 = 1
+OFPFF_CHECK_OVERLAP                 = 2
+OFPFF_EMERG                         = 4
+ofp_flow_mod_flags_map = {
+    1                               : 'OFPFF_SEND_FLOW_REM',
+    2                               : 'OFPFF_CHECK_OVERLAP',
+    4                               : 'OFPFF_EMERG'
+}
+
+ofp_stats_reply_flags = ['OFPSF_REPLY_MORE']
+OFPSF_REPLY_MORE                    = 1
+ofp_stats_reply_flags_map = {
+    1                               : 'OFPSF_REPLY_MORE'
+}
+
+ofp_flow_mod_failed_code = ['OFPFMFC_ALL_TABLES_FULL', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_EMERG_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_UNSUPPORTED']
+OFPFMFC_ALL_TABLES_FULL             = 0
+OFPFMFC_OVERLAP                     = 1
+OFPFMFC_EPERM                       = 2
+OFPFMFC_BAD_EMERG_TIMEOUT           = 3
+OFPFMFC_BAD_COMMAND                 = 4
+OFPFMFC_UNSUPPORTED                 = 5
+ofp_flow_mod_failed_code_map = {
+    0                               : 'OFPFMFC_ALL_TABLES_FULL',
+    1                               : 'OFPFMFC_OVERLAP',
+    2                               : 'OFPFMFC_EPERM',
+    3                               : 'OFPFMFC_BAD_EMERG_TIMEOUT',
+    4                               : 'OFPFMFC_BAD_COMMAND',
+    5                               : 'OFPFMFC_UNSUPPORTED'
+}
+
+ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_STP', 'OFPPC_NO_RECV', 'OFPPC_NO_RECV_STP', 'OFPPC_NO_FLOOD', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN']
+OFPPC_PORT_DOWN                     = 1
+OFPPC_NO_STP                        = 2
+OFPPC_NO_RECV                       = 4
+OFPPC_NO_RECV_STP                   = 8
+OFPPC_NO_FLOOD                      = 16
+OFPPC_NO_FWD                        = 32
+OFPPC_NO_PACKET_IN                  = 64
+ofp_port_config_map = {
+    1                               : 'OFPPC_PORT_DOWN',
+    2                               : 'OFPPC_NO_STP',
+    4                               : 'OFPPC_NO_RECV',
+    8                               : 'OFPPC_NO_RECV_STP',
+    16                              : 'OFPPC_NO_FLOOD',
+    32                              : 'OFPPC_NO_FWD',
+    64                              : 'OFPPC_NO_PACKET_IN'
+}
+
+ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_STP_LISTEN', 'OFPPS_STP_LEARN', 'OFPPS_STP_FORWARD', 'OFPPS_STP_BLOCK', 'OFPPS_STP_MASK']
+OFPPS_LINK_DOWN                     = 1
+OFPPS_STP_LISTEN                    = 0
+OFPPS_STP_LEARN                     = 256
+OFPPS_STP_FORWARD                   = 512
+OFPPS_STP_BLOCK                     = 768
+OFPPS_STP_MASK                      = 768
+ofp_port_state_map = {
+    1                               : 'OFPPS_LINK_DOWN',
+    0                               : 'OFPPS_STP_LISTEN',
+    256                             : 'OFPPS_STP_LEARN',
+    512                             : 'OFPPS_STP_FORWARD',
+    768                             : 'OFPPS_STP_BLOCK',
+    768                             : 'OFPPS_STP_MASK'
+}
+
+ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK']
+OFPC_FRAG_NORMAL                    = 0
+OFPC_FRAG_DROP                      = 1
+OFPC_FRAG_REASM                     = 2
+OFPC_FRAG_MASK                      = 3
+ofp_config_flags_map = {
+    0                               : 'OFPC_FRAG_NORMAL',
+    1                               : 'OFPC_FRAG_DROP',
+    2                               : 'OFPC_FRAG_REASM',
+    3                               : 'OFPC_FRAG_MASK'
+}
+
+ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM']
+OFPHFC_INCOMPATIBLE                 = 0
+OFPHFC_EPERM                        = 1
+ofp_hello_failed_code_map = {
+    0                               : 'OFPHFC_INCOMPATIBLE',
+    1                               : 'OFPHFC_EPERM'
+}
+
+ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_STP', 'OFPC_RESERVED', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_ARP_MATCH_IP']
+OFPC_FLOW_STATS                     = 1
+OFPC_TABLE_STATS                    = 2
+OFPC_PORT_STATS                     = 4
+OFPC_STP                            = 8
+OFPC_RESERVED                       = 16
+OFPC_IP_REASM                       = 32
+OFPC_QUEUE_STATS                    = 64
+OFPC_ARP_MATCH_IP                   = 128
+ofp_capabilities_map = {
+    1                               : 'OFPC_FLOW_STATS',
+    2                               : 'OFPC_TABLE_STATS',
+    4                               : 'OFPC_PORT_STATS',
+    8                               : 'OFPC_STP',
+    16                              : 'OFPC_RESERVED',
+    32                              : 'OFPC_IP_REASM',
+    64                              : 'OFPC_QUEUE_STATS',
+    128                             : 'OFPC_ARP_MATCH_IP'
+}
+
+ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE']
+OFPRR_IDLE_TIMEOUT                  = 0
+OFPRR_HARD_TIMEOUT                  = 1
+OFPRR_DELETE                        = 2
+ofp_flow_removed_reason_map = {
+    0                               : 'OFPRR_IDLE_TIMEOUT',
+    1                               : 'OFPRR_HARD_TIMEOUT',
+    2                               : 'OFPRR_DELETE'
+}
+
+ofp_queue_properties = ['OFPQT_NONE', 'OFPQT_MIN_RATE']
+OFPQT_NONE                          = 0
+OFPQT_MIN_RATE                      = 0
+ofp_queue_properties_map = {
+    0                               : 'OFPQT_NONE',
+    0                               : 'OFPQT_MIN_RATE'
+}
+
+ofp_flow_wildcards = ['OFPFW_IN_PORT', 'OFPFW_DL_VLAN', 'OFPFW_DL_SRC', 'OFPFW_DL_DST', 'OFPFW_DL_TYPE', 'OFPFW_NW_PROTO', 'OFPFW_TP_SRC', 'OFPFW_TP_DST', 'OFPFW_NW_SRC_SHIFT', 'OFPFW_NW_SRC_BITS', 'OFPFW_NW_SRC_MASK', 'OFPFW_NW_SRC_ALL', 'OFPFW_NW_DST_SHIFT', 'OFPFW_NW_DST_BITS', 'OFPFW_NW_DST_MASK', 'OFPFW_NW_DST_ALL', 'OFPFW_DL_VLAN_PCP', 'OFPFW_NW_TOS', 'OFPFW_ALL']
+OFPFW_IN_PORT                       = 1
+OFPFW_DL_VLAN                       = 2
+OFPFW_DL_SRC                        = 4
+OFPFW_DL_DST                        = 8
+OFPFW_DL_TYPE                       = 16
+OFPFW_NW_PROTO                      = 32
+OFPFW_TP_SRC                        = 64
+OFPFW_TP_DST                        = 128
+OFPFW_NW_SRC_SHIFT                  = 8
+OFPFW_NW_SRC_BITS                   = 6
+OFPFW_NW_SRC_MASK                   = 16128
+OFPFW_NW_SRC_ALL                    = 8192
+OFPFW_NW_DST_SHIFT                  = 14
+OFPFW_NW_DST_BITS                   = 6
+OFPFW_NW_DST_MASK                   = 1032192
+OFPFW_NW_DST_ALL                    = 524288
+OFPFW_DL_VLAN_PCP                   = 1048576
+OFPFW_NW_TOS                        = 2097152
+OFPFW_ALL                           = 4194303
+ofp_flow_wildcards_map = {
+    1                               : 'OFPFW_IN_PORT',
+    2                               : 'OFPFW_DL_VLAN',
+    4                               : 'OFPFW_DL_SRC',
+    8                               : 'OFPFW_DL_DST',
+    16                              : 'OFPFW_DL_TYPE',
+    32                              : 'OFPFW_NW_PROTO',
+    64                              : 'OFPFW_TP_SRC',
+    128                             : 'OFPFW_TP_DST',
+    8                               : 'OFPFW_NW_SRC_SHIFT',
+    6                               : 'OFPFW_NW_SRC_BITS',
+    16128                           : 'OFPFW_NW_SRC_MASK',
+    8192                            : 'OFPFW_NW_SRC_ALL',
+    14                              : 'OFPFW_NW_DST_SHIFT',
+    6                               : 'OFPFW_NW_DST_BITS',
+    1032192                         : 'OFPFW_NW_DST_MASK',
+    524288                          : 'OFPFW_NW_DST_ALL',
+    1048576                         : 'OFPFW_DL_VLAN_PCP',
+    2097152                         : 'OFPFW_NW_TOS',
+    4194303                         : 'OFPFW_ALL'
+}
+
+ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY']
+OFPPR_ADD                           = 0
+OFPPR_DELETE                        = 1
+OFPPR_MODIFY                        = 2
+ofp_port_reason_map = {
+    0                               : 'OFPPR_ADD',
+    1                               : 'OFPPR_DELETE',
+    2                               : 'OFPPR_MODIFY'
+}
+
+ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_SET_VLAN_VID', 'OFPAT_SET_VLAN_PCP', 'OFPAT_STRIP_VLAN', 'OFPAT_SET_DL_SRC', 'OFPAT_SET_DL_DST', 'OFPAT_SET_NW_SRC', 'OFPAT_SET_NW_DST', 'OFPAT_SET_NW_TOS', 'OFPAT_SET_TP_SRC', 'OFPAT_SET_TP_DST', 'OFPAT_ENQUEUE', 'OFPAT_VENDOR']
+OFPAT_OUTPUT                        = 0
+OFPAT_SET_VLAN_VID                  = 1
+OFPAT_SET_VLAN_PCP                  = 2
+OFPAT_STRIP_VLAN                    = 3
+OFPAT_SET_DL_SRC                    = 4
+OFPAT_SET_DL_DST                    = 5
+OFPAT_SET_NW_SRC                    = 6
+OFPAT_SET_NW_DST                    = 7
+OFPAT_SET_NW_TOS                    = 8
+OFPAT_SET_TP_SRC                    = 9
+OFPAT_SET_TP_DST                    = 10
+OFPAT_ENQUEUE                       = 11
+OFPAT_VENDOR                        = 65535
+ofp_action_type_map = {
+    0                               : 'OFPAT_OUTPUT',
+    1                               : 'OFPAT_SET_VLAN_VID',
+    2                               : 'OFPAT_SET_VLAN_PCP',
+    3                               : 'OFPAT_STRIP_VLAN',
+    4                               : 'OFPAT_SET_DL_SRC',
+    5                               : 'OFPAT_SET_DL_DST',
+    6                               : 'OFPAT_SET_NW_SRC',
+    7                               : 'OFPAT_SET_NW_DST',
+    8                               : 'OFPAT_SET_NW_TOS',
+    9                               : 'OFPAT_SET_TP_SRC',
+    10                              : 'OFPAT_SET_TP_DST',
+    11                              : 'OFPAT_ENQUEUE',
+    65535                           : 'OFPAT_VENDOR'
+}
+
+ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT']
+OFPFC_ADD                           = 0
+OFPFC_MODIFY                        = 1
+OFPFC_MODIFY_STRICT                 = 2
+OFPFC_DELETE                        = 3
+OFPFC_DELETE_STRICT                 = 4
+ofp_flow_mod_command_map = {
+    0                               : 'OFPFC_ADD',
+    1                               : 'OFPFC_MODIFY',
+    2                               : 'OFPFC_MODIFY_STRICT',
+    3                               : 'OFPFC_DELETE',
+    4                               : 'OFPFC_DELETE_STRICT'
+}
+
+ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM']
+OFPQOFC_BAD_PORT                    = 0
+OFPQOFC_BAD_QUEUE                   = 1
+OFPQOFC_EPERM                       = 2
+ofp_queue_op_failed_code_map = {
+    0                               : 'OFPQOFC_BAD_PORT',
+    1                               : 'OFPQOFC_BAD_QUEUE',
+    2                               : 'OFPQOFC_EPERM'
+}
+
+ofp_port = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_NONE']
+OFPP_MAX                            = 65280
+OFPP_IN_PORT                        = 65528
+OFPP_TABLE                          = 65529
+OFPP_NORMAL                         = 65530
+OFPP_FLOOD                          = 65531
+OFPP_ALL                            = 65532
+OFPP_CONTROLLER                     = 65533
+OFPP_LOCAL                          = 65534
+OFPP_NONE                           = 65535
+ofp_port_map = {
+    65280                           : 'OFPP_MAX',
+    65528                           : 'OFPP_IN_PORT',
+    65529                           : 'OFPP_TABLE',
+    65530                           : 'OFPP_NORMAL',
+    65531                           : 'OFPP_FLOOD',
+    65532                           : 'OFPP_ALL',
+    65533                           : 'OFPP_CONTROLLER',
+    65534                           : 'OFPP_LOCAL',
+    65535                           : 'OFPP_NONE'
+}
+
+ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_VENDOR', 'OFPBAC_BAD_VENDOR_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE']
+OFPBAC_BAD_TYPE                     = 0
+OFPBAC_BAD_LEN                      = 1
+OFPBAC_BAD_VENDOR                   = 2
+OFPBAC_BAD_VENDOR_TYPE              = 3
+OFPBAC_BAD_OUT_PORT                 = 4
+OFPBAC_BAD_ARGUMENT                 = 5
+OFPBAC_EPERM                        = 6
+OFPBAC_TOO_MANY                     = 7
+OFPBAC_BAD_QUEUE                    = 8
+ofp_bad_action_code_map = {
+    0                               : 'OFPBAC_BAD_TYPE',
+    1                               : 'OFPBAC_BAD_LEN',
+    2                               : 'OFPBAC_BAD_VENDOR',
+    3                               : 'OFPBAC_BAD_VENDOR_TYPE',
+    4                               : 'OFPBAC_BAD_OUT_PORT',
+    5                               : 'OFPBAC_BAD_ARGUMENT',
+    6                               : 'OFPBAC_EPERM',
+    7                               : 'OFPBAC_TOO_MANY',
+    8                               : 'OFPBAC_BAD_QUEUE'
+}
+
+ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_VENDOR', 'OFPBRC_BAD_SUBTYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN']
+OFPBRC_BAD_VERSION                  = 0
+OFPBRC_BAD_TYPE                     = 1
+OFPBRC_BAD_STAT                     = 2
+OFPBRC_BAD_VENDOR                   = 3
+OFPBRC_BAD_SUBTYPE                  = 4
+OFPBRC_EPERM                        = 5
+OFPBRC_BAD_LEN                      = 6
+OFPBRC_BUFFER_EMPTY                 = 7
+OFPBRC_BUFFER_UNKNOWN               = 8
+ofp_bad_request_code_map = {
+    0                               : 'OFPBRC_BAD_VERSION',
+    1                               : 'OFPBRC_BAD_TYPE',
+    2                               : 'OFPBRC_BAD_STAT',
+    3                               : 'OFPBRC_BAD_VENDOR',
+    4                               : 'OFPBRC_BAD_SUBTYPE',
+    5                               : 'OFPBRC_EPERM',
+    6                               : 'OFPBRC_BAD_LEN',
+    7                               : 'OFPBRC_BUFFER_EMPTY',
+    8                               : 'OFPBRC_BUFFER_UNKNOWN'
+}
+
+ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM']
+OFPPF_10MB_HD                       = 1
+OFPPF_10MB_FD                       = 2
+OFPPF_100MB_HD                      = 4
+OFPPF_100MB_FD                      = 8
+OFPPF_1GB_HD                        = 16
+OFPPF_1GB_FD                        = 32
+OFPPF_10GB_FD                       = 64
+OFPPF_COPPER                        = 128
+OFPPF_FIBER                         = 256
+OFPPF_AUTONEG                       = 512
+OFPPF_PAUSE                         = 1024
+OFPPF_PAUSE_ASYM                    = 2048
+ofp_port_features_map = {
+    1                               : 'OFPPF_10MB_HD',
+    2                               : 'OFPPF_10MB_FD',
+    4                               : 'OFPPF_100MB_HD',
+    8                               : 'OFPPF_100MB_FD',
+    16                              : 'OFPPF_1GB_HD',
+    32                              : 'OFPPF_1GB_FD',
+    64                              : 'OFPPF_10GB_FD',
+    128                             : 'OFPPF_COPPER',
+    256                             : 'OFPPF_FIBER',
+    512                             : 'OFPPF_AUTONEG',
+    1024                            : 'OFPPF_PAUSE',
+    2048                            : 'OFPPF_PAUSE_ASYM'
+}
+
+ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_VENDOR', 'OFPT_FEATURES_REQUEST', 'OFPT_FEATURES_REPLY', 'OFPT_GET_CONFIG_REQUEST', 'OFPT_GET_CONFIG_REPLY', 'OFPT_SET_CONFIG', 'OFPT_PACKET_IN', 'OFPT_FLOW_REMOVED', 'OFPT_PORT_STATUS', 'OFPT_PACKET_OUT', 'OFPT_FLOW_MOD', 'OFPT_PORT_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY']
+OFPT_HELLO                          = 0
+OFPT_ERROR                          = 1
+OFPT_ECHO_REQUEST                   = 2
+OFPT_ECHO_REPLY                     = 3
+OFPT_VENDOR                         = 4
+OFPT_FEATURES_REQUEST               = 5
+OFPT_FEATURES_REPLY                 = 6
+OFPT_GET_CONFIG_REQUEST             = 7
+OFPT_GET_CONFIG_REPLY               = 8
+OFPT_SET_CONFIG                     = 9
+OFPT_PACKET_IN                      = 10
+OFPT_FLOW_REMOVED                   = 11
+OFPT_PORT_STATUS                    = 12
+OFPT_PACKET_OUT                     = 13
+OFPT_FLOW_MOD                       = 14
+OFPT_PORT_MOD                       = 15
+OFPT_STATS_REQUEST                  = 16
+OFPT_STATS_REPLY                    = 17
+OFPT_BARRIER_REQUEST                = 18
+OFPT_BARRIER_REPLY                  = 19
+OFPT_QUEUE_GET_CONFIG_REQUEST       = 20
+OFPT_QUEUE_GET_CONFIG_REPLY         = 21
+ofp_type_map = {
+    0                               : 'OFPT_HELLO',
+    1                               : 'OFPT_ERROR',
+    2                               : 'OFPT_ECHO_REQUEST',
+    3                               : 'OFPT_ECHO_REPLY',
+    4                               : 'OFPT_VENDOR',
+    5                               : 'OFPT_FEATURES_REQUEST',
+    6                               : 'OFPT_FEATURES_REPLY',
+    7                               : 'OFPT_GET_CONFIG_REQUEST',
+    8                               : 'OFPT_GET_CONFIG_REPLY',
+    9                               : 'OFPT_SET_CONFIG',
+    10                              : 'OFPT_PACKET_IN',
+    11                              : 'OFPT_FLOW_REMOVED',
+    12                              : 'OFPT_PORT_STATUS',
+    13                              : 'OFPT_PACKET_OUT',
+    14                              : 'OFPT_FLOW_MOD',
+    15                              : 'OFPT_PORT_MOD',
+    16                              : 'OFPT_STATS_REQUEST',
+    17                              : 'OFPT_STATS_REPLY',
+    18                              : 'OFPT_BARRIER_REQUEST',
+    19                              : 'OFPT_BARRIER_REPLY',
+    20                              : 'OFPT_QUEUE_GET_CONFIG_REQUEST',
+    21                              : 'OFPT_QUEUE_GET_CONFIG_REPLY'
+}
+
+ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION']
+OFPR_NO_MATCH                       = 0
+OFPR_ACTION                         = 1
+ofp_packet_in_reason_map = {
+    0                               : 'OFPR_NO_MATCH',
+    1                               : 'OFPR_ACTION'
+}
+
+ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_VENDOR']
+OFPST_DESC                          = 0
+OFPST_FLOW                          = 1
+OFPST_AGGREGATE                     = 2
+OFPST_TABLE                         = 3
+OFPST_PORT                          = 4
+OFPST_QUEUE                         = 5
+OFPST_VENDOR                        = 65535
+ofp_stats_types_map = {
+    0                               : 'OFPST_DESC',
+    1                               : 'OFPST_FLOW',
+    2                               : 'OFPST_AGGREGATE',
+    3                               : 'OFPST_TABLE',
+    4                               : 'OFPST_PORT',
+    5                               : 'OFPST_QUEUE',
+    65535                           : 'OFPST_VENDOR'
+}
+
+ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR']
+OFPPMFC_BAD_PORT                    = 0
+OFPPMFC_BAD_HW_ADDR                 = 1
+ofp_port_mod_failed_code_map = {
+    0                               : 'OFPPMFC_BAD_PORT',
+    1                               : 'OFPPMFC_BAD_HW_ADDR'
+}
+
+# Values from macro definitions
+OFP_FLOW_PERMANENT = 0
+OFP_DL_TYPE_ETH2_CUTOFF = 0x0600
+DESC_STR_LEN = 256
+OFPFW_ICMP_CODE = OFPFW_TP_DST
+OFPQ_MIN_RATE_UNCFG = 0xffff
+OFP_VERSION = 0x01
+OFP_MAX_TABLE_NAME_LEN = 32
+OFP_DL_TYPE_NOT_ETH_TYPE = 0x05ff
+OFP_DEFAULT_MISS_SEND_LEN = 128
+OFP_MAX_PORT_NAME_LEN = 16
+OFP_SSL_PORT = 6633
+OFPFW_ICMP_TYPE = OFPFW_TP_SRC
+OFP_TCP_PORT = 6633
+SERIAL_NUM_LEN = 32
+OFP_DEFAULT_PRIORITY = 0x8000
+OFP_ETH_ALEN = 6
+OFP_VLAN_NONE = 0xffff
+OFPQ_ALL = 0xffffffff
+
+# Basic structure size definitions.
+# Does not include ofp_header members.
+# Does not include variable length arrays.
+OFP_ACTION_DL_ADDR_BYTES = 16
+OFP_ACTION_ENQUEUE_BYTES = 16
+OFP_ACTION_HEADER_BYTES = 8
+OFP_ACTION_NW_ADDR_BYTES = 8
+OFP_ACTION_NW_TOS_BYTES = 8
+OFP_ACTION_OUTPUT_BYTES = 8
+OFP_ACTION_TP_PORT_BYTES = 8
+OFP_ACTION_VENDOR_HEADER_BYTES = 8
+OFP_ACTION_VLAN_PCP_BYTES = 8
+OFP_ACTION_VLAN_VID_BYTES = 8
+OFP_AGGREGATE_STATS_REPLY_BYTES = 24
+OFP_AGGREGATE_STATS_REQUEST_BYTES = 44
+OFP_DESC_STATS_BYTES = 1056
+OFP_ERROR_MSG_BYTES = 4
+OFP_FLOW_MOD_BYTES = 64
+OFP_FLOW_REMOVED_BYTES = 80
+OFP_FLOW_STATS_BYTES = 88
+OFP_FLOW_STATS_REQUEST_BYTES = 44
+OFP_HEADER_BYTES = 8
+OFP_HELLO_BYTES = 0
+OFP_MATCH_BYTES = 40
+OFP_PACKET_IN_BYTES = 10
+OFP_PACKET_OUT_BYTES = 8
+OFP_PACKET_QUEUE_BYTES = 8
+OFP_PHY_PORT_BYTES = 48
+OFP_PORT_MOD_BYTES = 24
+OFP_PORT_STATS_BYTES = 104
+OFP_PORT_STATS_REQUEST_BYTES = 8
+OFP_PORT_STATUS_BYTES = 56
+OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
+OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 4
+OFP_QUEUE_PROP_HEADER_BYTES = 8
+OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
+OFP_QUEUE_STATS_BYTES = 32
+OFP_QUEUE_STATS_REQUEST_BYTES = 8
+OFP_STATS_REPLY_BYTES = 4
+OFP_STATS_REQUEST_BYTES = 4
+OFP_SWITCH_CONFIG_BYTES = 4
+OFP_SWITCH_FEATURES_BYTES = 24
+OFP_TABLE_STATS_BYTES = 64
+OFP_VENDOR_HEADER_BYTES = 4
+
diff --git a/src/python/of10/error.py b/src/python/of10/error.py
new file mode 100644
index 0000000..c69b70d
--- /dev/null
+++ b/src/python/of10/error.py
@@ -0,0 +1,306 @@
+
+# Python OpenFlow error wrapper classes
+
+from cstruct import *
+
+
+
+class hello_failed_error_msg(ofp_error_msg):
+    """
+    Wrapper class for hello_failed error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_HELLO_FAILED
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "hello_failed_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class bad_request_error_msg(ofp_error_msg):
+    """
+    Wrapper class for bad_request error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_BAD_REQUEST
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "bad_request_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class bad_action_error_msg(ofp_error_msg):
+    """
+    Wrapper class for bad_action error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_BAD_ACTION
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "bad_action_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class flow_mod_failed_error_msg(ofp_error_msg):
+    """
+    Wrapper class for flow_mod_failed error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_FLOW_MOD_FAILED
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "flow_mod_failed_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class port_mod_failed_error_msg(ofp_error_msg):
+    """
+    Wrapper class for port_mod_failed error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_PORT_MOD_FAILED
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "port_mod_failed_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class queue_op_failed_error_msg(ofp_error_msg):
+    """
+    Wrapper class for queue_op_failed error message class
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+    
+    """
+    def __init__(self):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.type = OFPET_QUEUE_OP_FAILED
+        self.data = ""
+
+    def pack(self, assertstruct=True):
+        self.header.length = self.__len__()
+        packed = self.header.pack()
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        return ""
+
+    def __len__(self):
+        return OFP_HEADER_BYTES + OFP_ERROR_MSG_BYTES + len(self.data)
+
+    def show(self, prefix=''):
+        outstr = prefix + "queue_op_failed_error_msg\m"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix + '  ')
+        outstr += prefix + "data is of length " + str(len(self.data)) + '\n'
+        ##@todo Consider trying to parse the string
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_error_msg.__eq__(self, other) and
+                self.data == other.data)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
diff --git a/src/python/of10/message.py b/src/python/of10/message.py
new file mode 100644
index 0000000..bf0064e
--- /dev/null
+++ b/src/python/of10/message.py
@@ -0,0 +1,3373 @@
+
+# Python OpenFlow message wrapper classes
+
+from cstruct import *
+from action_list import action_list
+from error import *
+
+# Define templates for documentation
+class ofp_template_msg:
+    """
+    Sample base class for template_msg; normally auto generated
+    This class should live in the of_header name space and provides the
+    base class for this type of message.  It will be wrapped for the
+    high level API.
+
+    """
+    def __init__(self):
+        """
+        Constructor for base class
+
+        """
+        self.header = ofp_header()
+        # Additional base data members declared here
+
+    # Normally will define pack, unpack, __len__ functions
+
+class template_msg(ofp_template_msg):
+    """
+    Sample class wrapper for template_msg
+    This class should live in the of_message name space and provides the
+    high level API for an OpenFlow message object.  These objects must
+    implement the functions indicated in this template.
+
+    """
+    def __init__(self):
+        """
+        Constructor
+        Must set the header type value appropriately for the message
+
+        """
+
+        ##@var header
+        # OpenFlow message header: length, version, xid, type
+        ofp_template_msg.__init__(self)
+        self.header = ofp_header()
+        # For a real message, will be set to an integer
+        self.header.type = "TEMPLATE_MSG_VALUE"
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        pass
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+
+        @return Typically returns the remainder of binary_string that
+        was not parsed.  May give a warning if that string is non-empty
+
+        """
+        pass
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        pass
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+        pass
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        pass
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        pass
+
+
+################################################################
+#
+# OpenFlow Message Definitions
+#
+################################################################
+
+class barrier_reply:
+    """
+    Wrapper class for barrier_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_BARRIER_REPLY=19)
+
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_BARRIER_REPLY
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'barrier_reply (OFPT_BARRIER_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class barrier_request:
+    """
+    Wrapper class for barrier_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_BARRIER_REQUEST=18)
+
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_BARRIER_REQUEST
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'barrier_request (OFPT_BARRIER_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class echo_reply:
+    """
+    Wrapper class for echo_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_ECHO_REPLY=3)
+
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_ECHO_REPLY
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'echo_reply (OFPT_ECHO_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class echo_request:
+    """
+    Wrapper class for echo_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_ECHO_REQUEST=2)
+
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_ECHO_REQUEST
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'echo_request (OFPT_ECHO_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class error(ofp_error_msg):
+    """
+    Wrapper class for error
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_ERROR=1)
+
+    Data members inherited from ofp_error_msg:
+    @arg type
+    @arg code
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_error_msg.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_ERROR
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_error_msg.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_error_msg.unpack(self, binary_string)
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_error_msg.__len__(self)
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'error (OFPT_ERROR)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_error_msg.show(self, prefix)
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_error_msg.__eq__(self, other): return False
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class features_reply(ofp_switch_features):
+    """
+    Wrapper class for features_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_FEATURES_REPLY=6)
+
+    Data members inherited from ofp_switch_features:
+    @arg datapath_id
+    @arg n_buffers
+    @arg n_tables
+    @arg capabilities
+    @arg actions
+    @arg ports: Variable length array of TBD
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_switch_features.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_FEATURES_REPLY
+        self.ports = []
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_switch_features.pack(self)
+        for obj in self.ports:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_switch_features.unpack(self, binary_string)
+        while len(binary_string) >= OFP_PHY_PORT_BYTES:
+            new_port = ofp_phy_port()
+            binary_string = new_port.unpack(binary_string)
+            self.ports.append(new_port)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_switch_features.__len__(self)
+        for obj in self.ports:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'features_reply (OFPT_FEATURES_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_switch_features.show(self, prefix)
+        outstr += prefix + "Array ports\n"
+        for obj in self.ports:
+            outstr += obj.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_switch_features.__eq__(self, other): return False
+        if self.ports != other.ports: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class features_request:
+    """
+    Wrapper class for features_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_FEATURES_REQUEST=5)
+
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_FEATURES_REQUEST
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'features_request (OFPT_FEATURES_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class flow_mod(ofp_flow_mod):
+    """
+    Wrapper class for flow_mod
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_FLOW_MOD=14)
+
+    Data members inherited from ofp_flow_mod:
+    @arg match
+    @arg cookie
+    @arg command
+    @arg idle_timeout
+    @arg hard_timeout
+    @arg priority
+    @arg buffer_id
+    @arg out_port
+    @arg flags
+    @arg actions: Object of type action_list
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_flow_mod.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_FLOW_MOD
+        self.actions = []
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+        # Coerce keyword arg into list type
+        self.actions = action_list(self.actions)
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_flow_mod.pack(self)
+        packed += self.actions.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_flow_mod.unpack(self, binary_string)
+        ai_len = self.header.length - (OFP_FLOW_MOD_BYTES + OFP_HEADER_BYTES)
+        binary_string = self.actions.unpack(binary_string, bytes=ai_len)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_flow_mod.__len__(self)
+        length += len(self.actions)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'flow_mod (OFPT_FLOW_MOD)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_flow_mod.show(self, prefix)
+        outstr += prefix + "List actions\n"
+        outstr += self.actions.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_flow_mod.__eq__(self, other): return False
+        if self.actions != other.actions: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class flow_removed(ofp_flow_removed):
+    """
+    Wrapper class for flow_removed
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_FLOW_REMOVED=11)
+
+    Data members inherited from ofp_flow_removed:
+    @arg match
+    @arg cookie
+    @arg priority
+    @arg reason
+    @arg duration_sec
+    @arg duration_nsec
+    @arg idle_timeout
+    @arg packet_count
+    @arg byte_count
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_flow_removed.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_FLOW_REMOVED
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_flow_removed.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_flow_removed.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_flow_removed.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'flow_removed (OFPT_FLOW_REMOVED)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_flow_removed.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_flow_removed.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class get_config_reply(ofp_switch_config):
+    """
+    Wrapper class for get_config_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_GET_CONFIG_REPLY=8)
+
+    Data members inherited from ofp_switch_config:
+    @arg flags
+    @arg miss_send_len
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_switch_config.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_GET_CONFIG_REPLY
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_switch_config.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_switch_config.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_switch_config.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'get_config_reply (OFPT_GET_CONFIG_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_switch_config.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_switch_config.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class get_config_request:
+    """
+    Wrapper class for get_config_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_GET_CONFIG_REQUEST=7)
+
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_GET_CONFIG_REQUEST
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'get_config_request (OFPT_GET_CONFIG_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class hello:
+    """
+    Wrapper class for hello
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_HELLO=0)
+
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        self.header.type = OFPT_HELLO
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'hello (OFPT_HELLO)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class packet_in(ofp_packet_in):
+    """
+    Wrapper class for packet_in
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_PACKET_IN=10)
+
+    Data members inherited from ofp_packet_in:
+    @arg buffer_id
+    @arg total_len
+    @arg in_port
+    @arg reason
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_packet_in.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_PACKET_IN
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_packet_in.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_packet_in.unpack(self, binary_string)
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_packet_in.__len__(self)
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'packet_in (OFPT_PACKET_IN)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_packet_in.show(self, prefix)
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_packet_in.__eq__(self, other): return False
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class packet_out(ofp_packet_out):
+    """
+    Wrapper class for packet_out
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_PACKET_OUT=13)
+
+    Data members inherited from ofp_packet_out:
+    @arg buffer_id
+    @arg in_port
+    @arg actions_len
+    @arg actions: Object of type action_list
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_packet_out.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_PACKET_OUT
+        self.actions = []
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+        # Coerce keyword arg into list type
+        self.actions = action_list(self.actions)
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        self.actions_len = len(self.actions)
+        packed += ofp_packet_out.pack(self)
+        packed += self.actions.pack()
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_packet_out.unpack(self, binary_string)
+        binary_string = self.actions.unpack(binary_string, bytes=self.actions_len)
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_packet_out.__len__(self)
+        length += len(self.actions)
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'packet_out (OFPT_PACKET_OUT)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_packet_out.show(self, prefix)
+        outstr += prefix + "List actions\n"
+        outstr += self.actions.show(prefix + '  ')
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_packet_out.__eq__(self, other): return False
+        if self.data != other.data: return False
+        if self.actions != other.actions: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class port_mod(ofp_port_mod):
+    """
+    Wrapper class for port_mod
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_PORT_MOD=15)
+
+    Data members inherited from ofp_port_mod:
+    @arg port_no
+    @arg hw_addr
+    @arg config
+    @arg mask
+    @arg advertise
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_port_mod.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_PORT_MOD
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_port_mod.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_port_mod.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_port_mod.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'port_mod (OFPT_PORT_MOD)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_port_mod.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_port_mod.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class port_status(ofp_port_status):
+    """
+    Wrapper class for port_status
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_PORT_STATUS=12)
+
+    Data members inherited from ofp_port_status:
+    @arg reason
+    @arg desc
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_port_status.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_PORT_STATUS
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_port_status.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_port_status.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_port_status.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'port_status (OFPT_PORT_STATUS)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_port_status.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_port_status.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class queue_get_config_reply(ofp_queue_get_config_reply):
+    """
+    Wrapper class for queue_get_config_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REPLY=21)
+
+    Data members inherited from ofp_queue_get_config_reply:
+    @arg port
+    @arg queues: Variable length array of TBD
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_queue_get_config_reply.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_QUEUE_GET_CONFIG_REPLY
+        self.queues = []
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_queue_get_config_reply.pack(self)
+        for obj in self.queues:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_queue_get_config_reply.unpack(self, binary_string)
+        for obj in self.queues:
+            binary_string = obj.unpack(binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_queue_get_config_reply.__len__(self)
+        for obj in self.queues:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'queue_get_config_reply (OFPT_QUEUE_GET_CONFIG_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_queue_get_config_reply.show(self, prefix)
+        outstr += prefix + "Array queues\n"
+        for obj in self.queues:
+            outstr += obj.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_queue_get_config_reply.__eq__(self, other): return False
+        if self.queues != other.queues: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class queue_get_config_request(ofp_queue_get_config_request):
+    """
+    Wrapper class for queue_get_config_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_QUEUE_GET_CONFIG_REQUEST=20)
+
+    Data members inherited from ofp_queue_get_config_request:
+    @arg port
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_queue_get_config_request.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_QUEUE_GET_CONFIG_REQUEST
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_queue_get_config_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_queue_get_config_request.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_queue_get_config_request.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'queue_get_config_request (OFPT_QUEUE_GET_CONFIG_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_queue_get_config_request.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_queue_get_config_request.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class set_config(ofp_switch_config):
+    """
+    Wrapper class for set_config
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_SET_CONFIG=9)
+
+    Data members inherited from ofp_switch_config:
+    @arg flags
+    @arg miss_send_len
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_switch_config.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_SET_CONFIG
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_switch_config.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_switch_config.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_switch_config.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'set_config (OFPT_SET_CONFIG)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_switch_config.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_switch_config.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for stats_reply
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_STATS_REPLY=17)
+
+    Data members inherited from ofp_stats_reply:
+    @arg type
+    @arg flags
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_stats_reply.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_STATS_REPLY
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_stats_reply.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_stats_reply.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'stats_reply (OFPT_STATS_REPLY)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_stats_reply.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class stats_request(ofp_stats_request):
+    """
+    Wrapper class for stats_request
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_STATS_REQUEST=16)
+
+    Data members inherited from ofp_stats_request:
+    @arg type
+    @arg flags
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_stats_request.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_STATS_REQUEST
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        # Fixme: If no self.data, add check for data remaining
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_stats_request.__len__(self)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'stats_request (OFPT_STATS_REQUEST)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self, prefix)
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_stats_request.__eq__(self, other): return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+class vendor(ofp_vendor_header):
+    """
+    Wrapper class for vendor
+
+    OpenFlow message header: length, version, xid, type
+    @arg length: The total length of the message
+    @arg version: The OpenFlow version (1)
+    @arg xid: The transaction ID
+    @arg type: The message type (OFPT_VENDOR=4)
+
+    Data members inherited from ofp_vendor_header:
+    @arg vendor
+    @arg data: Binary string following message members
+
+    """
+
+    def __init__(self, **kwargs):
+        ofp_vendor_header.__init__(self)
+        self.header = ofp_header()
+        self.header.type = OFPT_VENDOR
+        self.data = ""
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+
+    def pack(self):
+        """
+        Pack object into string
+
+        @return The packed string which can go on the wire
+
+        """
+        self.header.length = len(self)
+        packed = self.header.pack()
+
+        packed += ofp_vendor_header.pack(self)
+        packed += self.data
+        return packed
+
+    def unpack(self, binary_string):
+        """
+        Unpack object from a binary string
+
+        @param binary_string The wire protocol byte string holding the object
+        represented as an array of bytes.
+        @return The remainder of binary_string that was not parsed.
+
+        """
+        binary_string = self.header.unpack(binary_string)
+
+        binary_string = ofp_vendor_header.unpack(self, binary_string)
+        self.data = binary_string
+        binary_string = ''
+        return binary_string
+
+    def __len__(self):
+        """
+        Return the length of this object once packed into a string
+
+        @return An integer representing the number bytes in the packed
+        string.
+
+        """
+        length = OFP_HEADER_BYTES
+
+        length += ofp_vendor_header.__len__(self)
+        length += len(self.data)
+        return length
+
+    def show(self, prefix=''):
+        """
+        Generate a string (with multiple lines) describing the contents
+        of the object in a readable manner
+
+        @param prefix Pre-pended at the beginning of each line.
+
+        """
+
+        outstr = prefix + 'vendor (OFPT_VENDOR)\n'
+        prefix += '  '
+        outstr += prefix + 'ofp header\n'
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_vendor_header.show(self, prefix)
+        outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
+        ##@todo Fix this circular reference
+        # if len(self.data) > 0:
+            # obj = of_message_parse(self.data)
+            # if obj != None:
+                # outstr += obj.show(prefix)
+            # else:
+                # outstr += prefix + "Unable to parse data\n"
+        return outstr
+
+    def __eq__(self, other):
+        """
+        Return True if self and other hold the same data
+
+        @param other Other object in comparison
+
+        """
+        if type(self) != type(other): return False
+        if not self.header.__eq__(other.header): return False
+
+        if not ofp_vendor_header.__eq__(self, other): return False
+        if self.data != other.data: return False
+        return True
+
+    def __ne__(self, other):
+        """
+        Return True if self and other do not hold the same data
+
+        @param other Other object in comparison
+
+        """
+        return not self.__eq__(other)
+    
+
+
+################################################################
+#
+# Stats request and reply subclass definitions
+#
+################################################################
+
+
+# Stats request bodies for desc and table stats are not defined in the
+# OpenFlow header;  We define them here.  They are empty classes, really
+
+class ofp_desc_stats_request:
+    """
+    Forced definition of ofp_desc_stats_request (empty class)
+    """
+    def __init__(self):
+        pass
+    def pack(self, assertstruct=True):
+        return ""
+    def unpack(self, binary_string):
+        return binary_string
+    def __len__(self):
+        return 0
+    def show(self, prefix=''):
+        return prefix + "ofp_desc_stats_request (empty)\n"
+    def __eq__(self, other):
+        return type(self) == type(other)
+    def __ne__(self, other):
+        return type(self) != type(other)
+
+OFP_DESC_STATS_REQUEST_BYTES = 0
+
+class ofp_table_stats_request:
+    """
+    Forced definition of ofp_table_stats_request (empty class)
+    """
+    def __init__(self):
+        pass
+    def pack(self, assertstruct=True):
+        return ""
+    def unpack(self, binary_string):
+        return binary_string
+    def __len__(self):
+        return 0
+    def show(self, prefix=''):
+        return prefix + "ofp_table_stats_request (empty)\n"
+    def __eq__(self, other):
+        return type(self) == type(other)
+    def __ne__(self, other):
+        return type(self) != type(other)
+
+OFP_TABLE_STATS_REQUEST_BYTES = 0
+
+
+
+# Stats entries define the content of one element in a stats
+# reply for the indicated type; define _entry for consistency
+
+aggregate_stats_entry = ofp_aggregate_stats_reply
+desc_stats_entry = ofp_desc_stats
+port_stats_entry = ofp_port_stats
+queue_stats_entry = ofp_queue_stats
+table_stats_entry = ofp_table_stats
+
+
+#
+# Flow stats entry contains an action list of variable length, so
+# it is done by hand
+#
+
+class flow_stats_entry(ofp_flow_stats):
+    """
+    Special case flow stats entry to handle action list object
+    """
+    def __init__(self):
+        ofp_flow_stats.__init__(self)
+        self.actions = action_list()
+
+    def pack(self, assertstruct=True):
+        self.length = len(self)
+        packed = ofp_flow_stats.pack(self, assertstruct)
+        packed += self.actions.pack()
+        if len(packed) != self.length:
+            print("ERROR: flow_stats_entry pack length not equal",
+                  self.length, len(packed))
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = ofp_flow_stats.unpack(self, binary_string)
+        ai_len = self.length - OFP_FLOW_STATS_BYTES
+        if ai_len < 0:
+            print("ERROR: flow_stats_entry unpack length too small",
+                  self.length)
+        binary_string = self.actions.unpack(binary_string, bytes=ai_len)
+        return binary_string
+
+    def __len__(self):
+        return OFP_FLOW_STATS_BYTES + len(self.actions)
+
+    def show(self, prefix=''):
+        outstr = prefix + "flow_stats_entry\n"
+        outstr += ofp_flow_stats.show(self, prefix + '  ')
+        outstr += self.actions.show(prefix + '  ')
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (ofp_flow_stats.__eq__(self, other) and 
+                self.actions == other.actions)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class aggregate_stats_request(ofp_stats_request, ofp_aggregate_stats_request):
+    """
+    Wrapper class for aggregate stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_aggregate_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_AGGREGATE
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_aggregate_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_aggregate_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking aggregate: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_AGGREGATE_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "aggregate_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_aggregate_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_aggregate_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class aggregate_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for aggregate stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_AGGREGATE
+        # stats: Array of type aggregate_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = aggregate_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = aggregate_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking aggregate stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "aggregate_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class desc_stats_request(ofp_stats_request, ofp_desc_stats_request):
+    """
+    Wrapper class for desc stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_desc_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_DESC
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_desc_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_desc_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking desc: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_DESC_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "desc_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_desc_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_desc_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class desc_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for desc stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_DESC
+        # stats: Array of type desc_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = desc_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = desc_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking desc stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "desc_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class flow_stats_request(ofp_stats_request, ofp_flow_stats_request):
+    """
+    Wrapper class for flow stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_flow_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_FLOW
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_flow_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_flow_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking flow: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_FLOW_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "flow_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_flow_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_flow_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class flow_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for flow stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_FLOW
+        # stats: Array of type flow_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = flow_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = flow_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking flow stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "flow_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class port_stats_request(ofp_stats_request, ofp_port_stats_request):
+    """
+    Wrapper class for port stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_port_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_PORT
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_port_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_port_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking port: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_PORT_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "port_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_port_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_port_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class port_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for port stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_PORT
+        # stats: Array of type port_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = port_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = port_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking port stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "port_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class queue_stats_request(ofp_stats_request, ofp_queue_stats_request):
+    """
+    Wrapper class for queue stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_queue_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_QUEUE
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_queue_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_queue_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking queue: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_QUEUE_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "queue_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_queue_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_queue_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class queue_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for queue stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_QUEUE
+        # stats: Array of type queue_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = queue_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = queue_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking queue stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "queue_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class table_stats_request(ofp_stats_request, ofp_table_stats_request):
+    """
+    Wrapper class for table stats request message
+    """
+    def __init__(self, **kwargs):
+        self.header = ofp_header()
+        ofp_stats_request.__init__(self)
+        ofp_table_stats_request.__init__(self)
+        self.header.type = OFPT_STATS_REQUEST
+        self.type = OFPST_TABLE
+        for (k, v) in kwargs.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                raise NameError("field %s does not exist in %s" % (k, self.__class__))
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_request.pack(self)
+        packed += ofp_table_stats_request.pack(self)
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_request.unpack(self, binary_string)
+        binary_string = ofp_table_stats_request.unpack(self, binary_string)
+        if len(binary_string) != 0:
+            print "ERROR unpacking table: extra data"
+        return binary_string
+
+    def __len__(self):
+        return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+               OFP_TABLE_STATS_REQUEST_BYTES
+
+    def show(self, prefix=''):
+        outstr = prefix + "table_stats_request\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_request.show(self)
+        outstr += ofp_table_stats_request.show(self)
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_request.__eq__(self, other) and
+                ofp_table_stats_request.__eq__(self, other))
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+class table_stats_reply(ofp_stats_reply):
+    """
+    Wrapper class for table stats reply
+    """
+    def __init__(self):
+        self.header = ofp_header()
+        ofp_stats_reply.__init__(self)
+        self.header.type = OFPT_STATS_REPLY
+        self.type = OFPST_TABLE
+        # stats: Array of type table_stats_entry
+        self.stats = []
+
+    def pack(self, assertstruct=True):
+        self.header.length = len(self)
+        packed = self.header.pack()
+        packed += ofp_stats_reply.pack(self)
+        for obj in self.stats:
+            packed += obj.pack()
+        return packed
+
+    def unpack(self, binary_string):
+        binary_string = self.header.unpack(binary_string)
+        binary_string = ofp_stats_reply.unpack(self, binary_string)
+        dummy = table_stats_entry()
+        while len(binary_string) >= len(dummy):
+            obj = table_stats_entry()
+            binary_string = obj.unpack(binary_string)
+            self.stats.append(obj)
+        if len(binary_string) != 0:
+            print "ERROR unpacking table stats string: extra bytes"
+        return binary_string
+
+    def __len__(self):
+        length = len(self.header) + OFP_STATS_REPLY_BYTES
+        for obj in self.stats:
+            length += len(obj)
+        return length
+
+    def show(self, prefix=''):
+        outstr = prefix + "table_stats_reply\n"
+        outstr += prefix + "ofp header:\n"
+        outstr += self.header.show(prefix + '  ')
+        outstr += ofp_stats_reply.show(self)
+        outstr += prefix + "Stats array of length " + str(len(self.stats)) + '\n'
+        for obj in self.stats:
+            outstr += obj.show()
+        return outstr
+
+    def __eq__(self, other):
+        if type(self) != type(other): return False
+        return (self.header == other.header and
+                ofp_stats_reply.__eq__(self, other) and
+                self.stats == other.stats)
+
+    def __ne__(self, other): return not self.__eq__(other)
+
+
+message_type_list = (
+    aggregate_stats_reply,
+    aggregate_stats_request,
+    bad_action_error_msg,
+    bad_request_error_msg,
+    barrier_reply,
+    barrier_request,
+    desc_stats_reply,
+    desc_stats_request,
+    echo_reply,
+    echo_request,
+    features_reply,
+    features_request,
+    flow_mod,
+    flow_mod_failed_error_msg,
+    flow_removed,
+    flow_stats_reply,
+    flow_stats_request,
+    get_config_reply,
+    get_config_request,
+    hello,
+    hello_failed_error_msg,
+    packet_in,
+    packet_out,
+    port_mod,
+    port_mod_failed_error_msg,
+    port_stats_reply,
+    port_stats_request,
+    port_status,
+    queue_get_config_reply,
+    queue_get_config_request,
+    queue_op_failed_error_msg,
+    queue_stats_reply,
+    queue_stats_request,
+    set_config,
+    table_stats_reply,
+    table_stats_request,
+    vendor
+    )
+
diff --git a/src/python/of10/parse.py b/src/python/of10/parse.py
new file mode 100644
index 0000000..a3421a1
--- /dev/null
+++ b/src/python/of10/parse.py
@@ -0,0 +1,343 @@
+"""
+OpenFlow message parsing functions
+"""
+
+import sys
+import logging
+from message import *
+from error import *
+from action import *
+from action_list import action_list
+from cstruct import *
+try:
+    import scapy.all as scapy
+except:
+    try:
+        import scapy as scapy
+    except:
+        sys.exit("Need to install scapy for packet parsing")
+
+"""
+of_message.py
+Contains wrapper functions and classes for the of_message namespace
+that are generated by hand.  It includes the rest of the wrapper
+function information into the of_message namespace
+"""
+
+parse_logger = logging.getLogger("parse")
+#parse_logger.setLevel(logging.DEBUG)
+
+# These message types are subclassed
+msg_type_subclassed = [
+    OFPT_STATS_REQUEST,
+    OFPT_STATS_REPLY,
+    OFPT_ERROR
+]
+
+# Maps from sub-types to classes
+stats_reply_to_class_map = {
+    OFPST_DESC                      : desc_stats_reply,
+    OFPST_AGGREGATE                 : aggregate_stats_reply,
+    OFPST_FLOW                      : flow_stats_reply,
+    OFPST_TABLE                     : table_stats_reply,
+    OFPST_PORT                      : port_stats_reply,
+    OFPST_QUEUE                     : queue_stats_reply
+}
+
+stats_request_to_class_map = {
+    OFPST_DESC                      : desc_stats_request,
+    OFPST_AGGREGATE                 : aggregate_stats_request,
+    OFPST_FLOW                      : flow_stats_request,
+    OFPST_TABLE                     : table_stats_request,
+    OFPST_PORT                      : port_stats_request,
+    OFPST_QUEUE                     : queue_stats_request
+}
+
+error_to_class_map = {
+    OFPET_HELLO_FAILED              : hello_failed_error_msg,
+    OFPET_BAD_REQUEST               : bad_request_error_msg,
+    OFPET_BAD_ACTION                : bad_action_error_msg,
+    OFPET_FLOW_MOD_FAILED           : flow_mod_failed_error_msg,
+    OFPET_PORT_MOD_FAILED           : port_mod_failed_error_msg,
+    OFPET_QUEUE_OP_FAILED           : queue_op_failed_error_msg
+}
+
+# Map from header type value to the underlieing message class
+msg_type_to_class_map = {
+    OFPT_HELLO                      : hello,
+    OFPT_ERROR                      : error,
+    OFPT_ECHO_REQUEST               : echo_request,
+    OFPT_ECHO_REPLY                 : echo_reply,
+    OFPT_VENDOR                     : vendor,
+    OFPT_FEATURES_REQUEST           : features_request,
+    OFPT_FEATURES_REPLY             : features_reply,
+    OFPT_GET_CONFIG_REQUEST         : get_config_request,
+    OFPT_GET_CONFIG_REPLY           : get_config_reply,
+    OFPT_SET_CONFIG                 : set_config,
+    OFPT_PACKET_IN                  : packet_in,
+    OFPT_FLOW_REMOVED               : flow_removed,
+    OFPT_PORT_STATUS                : port_status,
+    OFPT_PACKET_OUT                 : packet_out,
+    OFPT_FLOW_MOD                   : flow_mod,
+    OFPT_PORT_MOD                   : port_mod,
+    OFPT_STATS_REQUEST              : stats_request,
+    OFPT_STATS_REPLY                : stats_reply,
+    OFPT_BARRIER_REQUEST            : barrier_request,
+    OFPT_BARRIER_REPLY              : barrier_reply,
+    OFPT_QUEUE_GET_CONFIG_REQUEST   : queue_get_config_request,
+    OFPT_QUEUE_GET_CONFIG_REPLY     : queue_get_config_reply
+}
+
+def _of_message_to_object(binary_string):
+    """
+    Map a binary string to the corresponding class.
+
+    Appropriately resolves subclasses
+    """
+    hdr = ofp_header()
+    hdr.unpack(binary_string)
+    # FIXME: Add error detection
+    if not hdr.type in msg_type_subclassed:
+        return msg_type_to_class_map[hdr.type]()
+    if hdr.type == OFPT_STATS_REQUEST:
+        sub_hdr = ofp_stats_request()
+        sub_hdr.unpack(binary_string[OFP_HEADER_BYTES:])
+        try:
+            obj = stats_request_to_class_map[sub_hdr.type]()
+        except KeyError:
+            obj = None
+        return obj
+    elif hdr.type == OFPT_STATS_REPLY:
+        sub_hdr = ofp_stats_reply()
+        sub_hdr.unpack(binary_string[OFP_HEADER_BYTES:])
+        try:
+            obj = stats_reply_to_class_map[sub_hdr.type]()
+        except KeyError:
+            obj = None
+        return obj
+    elif hdr.type == OFPT_ERROR:
+        sub_hdr = ofp_error_msg()
+        sub_hdr.unpack(binary_string[OFP_HEADER_BYTES:])
+        return error_to_class_map[sub_hdr.type]()
+    else:
+        parse_logger.error("Cannot parse pkt to message")
+        return None
+
+def of_message_parse(binary_string, raw=False):
+    """
+    Parse an OpenFlow packet
+
+    Parses a raw OpenFlow packet into a Python class, with class
+    members fully populated.
+
+    @param binary_string The packet (string) to be parsed
+    @param raw If true, interpret the packet as an L2 packet.  Not
+    yet supported.
+    @return An object of some message class or None if fails
+    Note that any data beyond that parsed is not returned
+
+    """
+
+    if raw:
+        parse_logger.error("raw packet message parsing not supported")
+        return None
+
+    obj = _of_message_to_object(binary_string)
+    if obj:
+        obj.unpack(binary_string)
+    return obj
+
+
+def of_header_parse(binary_string, raw=False):
+    """
+    Parse only the header from an OpenFlow packet
+
+    Parses the header from a raw OpenFlow packet into a
+    an ofp_header Python class.
+
+    @param binary_string The packet (string) to be parsed
+    @param raw If true, interpret the packet as an L2 packet.  Not
+    yet supported.
+    @return An ofp_header object
+
+    """
+
+    if raw:
+        parse_logger.error("raw packet message parsing not supported")
+        return None
+
+    hdr = ofp_header()
+    hdr.unpack(binary_string)
+
+    return hdr
+
+map_wc_field_to_match_member = {
+    'OFPFW_DL_VLAN'                 : 'dl_vlan',
+    'OFPFW_DL_SRC'                  : 'dl_src',
+    'OFPFW_DL_DST'                  : 'dl_dst',
+    'OFPFW_DL_TYPE'                 : 'dl_type',
+    'OFPFW_NW_PROTO'                : 'nw_proto',
+    'OFPFW_TP_SRC'                  : 'tp_src',
+    'OFPFW_TP_DST'                  : 'tp_dst',
+    'OFPFW_NW_SRC_SHIFT'            : 'nw_src_shift',
+    'OFPFW_NW_SRC_BITS'             : 'nw_src_bits',
+    'OFPFW_NW_SRC_MASK'             : 'nw_src_mask',
+    'OFPFW_NW_SRC_ALL'              : 'nw_src_all',
+    'OFPFW_NW_DST_SHIFT'            : 'nw_dst_shift',
+    'OFPFW_NW_DST_BITS'             : 'nw_dst_bits',
+    'OFPFW_NW_DST_MASK'             : 'nw_dst_mask',
+    'OFPFW_NW_DST_ALL'              : 'nw_dst_all',
+    'OFPFW_DL_VLAN_PCP'             : 'dl_vlan_pcp',
+    'OFPFW_NW_TOS'                  : 'nw_tos'
+}
+
+
+def parse_mac(mac_str):
+    """
+    Parse a MAC address
+
+    Parse a MAC address ':' separated string of hex digits to an
+    array of integer values.  '00:d0:05:5d:24:00' => [0, 208, 5, 93, 36, 0]
+    @param mac_str The string to convert
+    @return Array of 6 integer values
+    """
+    return map(lambda val: int(val, 16), mac_str.split(":"))
+
+def parse_ip(ip_str):
+    """
+    Parse an IP address
+
+    Parse an IP address '.' separated string of decimal digits to an
+    host ordered integer.  '172.24.74.77' => 
+    @param ip_str The string to convert
+    @return Integer value
+    """
+    array = map(lambda val: int(val), ip_str.split("."))
+    val = 0
+    for a in array:
+        val <<= 8
+        val += a
+    return val
+
+def packet_type_classify(ether):
+    try:
+        dot1q = ether[scapy.Dot1Q]
+    except:
+        dot1q = None
+
+    try:
+        ip = ether[scapy.IP]
+    except:
+        ip = None
+
+    try:
+        tcp = ether[scapy.TCP]
+    except:
+        tcp = None
+
+    try:
+        udp = ether[scapy.UDP]
+    except:
+        udp = None
+
+    try:
+        icmp = ether[scapy.ICMP]
+    except:
+        icmp = None
+
+    try:
+        arp = ether[scapy.ARP]
+    except:
+        arp = None
+    return (dot1q, ip, tcp, udp, icmp, arp)
+
+def packet_to_flow_match(packet, pkt_format="L2"):
+    """
+    Create a flow match that matches packet with the given wildcards
+
+    @param packet The packet to use as a flow template
+    @param pkt_format Currently only L2 is supported.  Will indicate the 
+    overall packet type for parsing
+    @return An ofp_match object if successful.  None if format is not
+    recognized.  The wildcards of the match will be cleared for the
+    values extracted from the packet.
+
+    @todo check min length of packet
+    @todo Check if packet is other than L2 format
+    @todo Implement ICMP and ARP fields
+    """
+
+    #@todo check min length of packet
+    if pkt_format.upper() != "L2":
+        parse_logger.error("Only L2 supported for packet_to_flow")
+        return None
+
+    if type(packet) == type(""):
+        ether = scapy.Ether(packet)
+    else:
+        ether = packet
+
+    # For now, assume ether IP packet and ignore wildcards
+    try:
+        (dot1q, ip, tcp, udp, icmp, arp) = packet_type_classify(ether)
+    except:
+        parse_logger.error("packet_to_flow_match: Classify error")
+        return None
+
+    match = ofp_match()
+    match.wildcards = OFPFW_ALL
+    #@todo Check if packet is other than L2 format
+    match.dl_dst = parse_mac(ether.dst)
+    match.wildcards &= ~OFPFW_DL_DST
+    match.dl_src = parse_mac(ether.src)
+    match.wildcards &= ~OFPFW_DL_SRC
+    match.dl_type = ether.type
+    match.wildcards &= ~OFPFW_DL_TYPE
+
+    if dot1q:
+        match.dl_vlan = dot1q.vlan
+        match.dl_vlan_pcp = dot1q.prio
+        match.dl_type = dot1q.type
+    else:
+        match.dl_vlan = OFP_VLAN_NONE
+        match.dl_vlan_pcp = 0
+    match.wildcards &= ~OFPFW_DL_VLAN
+    match.wildcards &= ~OFPFW_DL_VLAN_PCP
+
+    if ip:
+        match.nw_src = parse_ip(ip.src)
+        match.wildcards &= ~OFPFW_NW_SRC_MASK
+        match.nw_dst = parse_ip(ip.dst)
+        match.wildcards &= ~OFPFW_NW_DST_MASK
+        match.nw_tos = ip.tos
+        match.wildcards &= ~OFPFW_NW_TOS
+
+    if tcp:
+        match.nw_proto = 6
+        match.wildcards &= ~OFPFW_NW_PROTO
+    elif not tcp and udp:
+        tcp = udp
+        match.nw_proto = 17
+        match.wildcards &= ~OFPFW_NW_PROTO
+
+    if tcp:
+        match.tp_src = tcp.sport
+        match.wildcards &= ~OFPFW_TP_SRC
+        match.tp_dst = tcp.dport
+        match.wildcards &= ~OFPFW_TP_DST
+
+    if icmp:
+        match.nw_proto = 1
+        match.tp_src = icmp.type
+        match.tp_dst = icmp.code
+        match.wildcards &= ~OFPFW_NW_PROTO
+
+    if arp:
+        match.nw_proto = arp.op
+        match.wildcards &= ~OFPFW_NW_PROTO
+        match.nw_src = parse_ip(arp.psrc)
+        match.wildcards &= ~OFPFW_NW_SRC_MASK
+        match.nw_dst = parse_ip(arp.pdst)
+        match.wildcards &= ~OFPFW_NW_DST_MASK
+
+    return match
