diff --git a/DEVELOPING b/DEVELOPING
index ff391e4..ea6945a 100644
--- a/DEVELOPING
+++ b/DEVELOPING
@@ -44,7 +44,8 @@
 
     1.  If you change any of the code generation scripts in
     tools/munger/scripts you must re-run make -C tools/munger to
-    regenerate the OpenFlow message classes.
+    regenerate the OpenFlow message classes. Make sure you
+    commit the generated code.
 
 Adding Your Own Test Cases
 ++++++++++++++++++++++++++
diff --git a/README b/README
index 2f1a7da..a627e12 100644
--- a/README
+++ b/README
@@ -26,14 +26,6 @@
     controls data plane ports, sending and receiving packets, which 
     should be connected to the switch.
 
-    There are two parts to running the test framework:
-
-    * Building the python libraries that support the OF protocol
-    * Running oft, the main entry point of the test framework
-
-    Normally log output from oft is sent to the file oft.log, but
-    can be redirected to the console by specifying --log-file="".
-
     For information on writing new tests or making improvements to
     the test framework see the file DEVELOPING.
 
@@ -59,7 +51,6 @@
 
       # git clone git://github.com/floodlight/oftest
       # cd oftest
-      # make -C tools/munger
          Make sure the switch you want to test is running --
          see (4) below for the reference switch example.
       # ./oft --list
@@ -88,23 +79,13 @@
         * Doxygen and doxypy for document generation (optional)
         * lint for source checking (optional)
 
-    2.  Build the OpenFlow Python message classes
-
-        Important:  The OF version used by the controller is based on 
-        the file in <oftest>/tools/pylibopenflow/include/openflow.h
-        This is currently the 1.0 release file.
-
-        make -C <oftest>/tools/munger
-
-        This places files in <oftest>/src/python/oftest/src.
-
-    3.  Edit configuration if necessary
+    2.  Edit configuration if necessary
         The default (local) platform uses 4 veth interface pairs and
         is only suitable for testing local software switches. To test
         hardware switches you will need to create an appropriate
         platform file. See the "Platforms" section below.
 
-    4.  Start the switch to test
+    3.  Start the switch to test
         The switch must be running and actively attempting to 
         connect to a controller on the test host at the port number
         used by oft (6633 by default, or specified as --port=<n> as
@@ -132,7 +113,7 @@
         oftest/tools/ovs-ctl.  You will need to install a version of
         openvswitch.  See http://openvswitch.org/.
 
-    5.  Run oft (requires sudo to control the dataplane)
+    4.  Run oft (requires sudo to control the dataplane)
         cd <oftest>
         sudo ./oft --help
 
diff --git a/oft b/oft
index 2fb60d4..e672b6e 100755
--- a/oft
+++ b/oft
@@ -33,12 +33,6 @@
 
 import oftest
 from oftest import config
-
-try:
-    import oftest.message
-except:
-    sys.exit("Missing OpenFlow message classes: please run \"make -C tools/munger\"")
-
 import oftest.testutils
 import oftest.ofutils
 import oftest.help_formatter
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/oftest/action_list.py b/src/python/of10/action_list.py
similarity index 100%
rename from src/python/oftest/action_list.py
rename to src/python/of10/action_list.py
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/oftest/parse.py b/src/python/of10/parse.py
similarity index 100%
rename from src/python/oftest/parse.py
rename to src/python/of10/parse.py
diff --git a/src/python/oftest/.gitignore b/src/python/oftest/.gitignore
deleted file mode 100644
index 097bad4..0000000
--- a/src/python/oftest/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-action.py
-class_maps.py
-cstruct.py
-error.py
-message.py
diff --git a/src/python/oftest/__init__.py b/src/python/oftest/__init__.py
index 3974e08..65a5648 100644
--- a/src/python/oftest/__init__.py
+++ b/src/python/oftest/__init__.py
@@ -1,4 +1,5 @@
 '''Docstring to silence pylint; ignores --ignore option for __init__.py'''
+import sys
 
 # Global config dictionary
 # Populated by oft.
@@ -7,3 +8,9 @@
 # Global DataPlane instance used by all tests.
 # Populated by oft.
 dataplane_instance = None
+
+# Alias of10 modules into oftest namespace for backwards compatbility
+import of10
+from of10 import *
+for modname in of10.__all__:
+    sys.modules["oftest." + modname] = sys.modules["of10." + modname]
diff --git a/src/python/oftest/base_tests.py b/src/python/oftest/base_tests.py
index f91ae60..056f6e9 100644
--- a/src/python/oftest/base_tests.py
+++ b/src/python/oftest/base_tests.py
@@ -11,11 +11,8 @@
 import oftest
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
-import oftest.message as message
 import oftest.dataplane as dataplane
-import oftest.action as action
-
+import of10.message as message
 from oftest.testutils import *
 
 class SimpleProtocol(unittest.TestCase):
diff --git a/src/python/oftest/controller.py b/src/python/oftest/controller.py
index fa346c3..47049a0 100644
--- a/src/python/oftest/controller.py
+++ b/src/python/oftest/controller.py
@@ -32,8 +32,8 @@
 from threading import Thread
 from threading import Lock
 from threading import Condition
-from message import *
-from parse import *
+from of10.message import *
+from of10.parse import *
 from ofutils import *
 # For some reason, it seems select to be last (or later).
 # Otherwise get an attribute error when calling select.select
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index e8dec6e..480604d 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -1,6 +1,8 @@
-
 import sys
 import copy
+import logging
+import types
+import time
 
 try:
     import scapy.all as scapy
@@ -12,14 +14,11 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
-import oftest.message as message
 import oftest.dataplane as dataplane
-import oftest.action as action
-import oftest.parse as parse
-import logging
-import types
-import time
+import of10.cstruct as ofp
+import of10.message as message
+import of10.action as action
+import of10.parse as parse
 
 global skipped_test_count
 skipped_test_count = 0
diff --git a/tests/basic.py b/tests/basic.py
index d1bde14..25cea9d 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -21,11 +21,11 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
-import oftest.message as message
 import oftest.dataplane as dataplane
-import oftest.action as action
 import oftest.base_tests as base_tests
+import of10.cstruct as ofp
+import of10.message as message
+import of10.action as action
 
 import oftest.illegal_message as illegal_message
 
diff --git a/tools/munger/Makefile b/tools/munger/Makefile
index 06cc18d..c6cc8f1 100644
--- a/tools/munger/Makefile
+++ b/tools/munger/Makefile
@@ -11,7 +11,7 @@
 
 PYLIBOF_DIR = ${TOOLS_DIR}/pylibopenflow
 
-TARGET_DIR = ${TOP_DIR}/src/python/oftest
+TARGET_DIR = ${TOP_DIR}/src/python/of10
 
 # Relative to pyopenflow-pythonize exec location
 OF_HEADER = include/openflow.h
diff --git a/tools/munger/scripts/action_gen.py b/tools/munger/scripts/action_gen.py
index bde0291..e4f2350 100644
--- a/tools/munger/scripts/action_gen.py
+++ b/tools/munger/scripts/action_gen.py
@@ -5,7 +5,7 @@
 
 import re
 import sys
-sys.path.append("../../src/python/oftest")
+sys.path.append("../../src/python/of10")
 from cstruct import *
 from class_maps import class_to_members_map
 
diff --git a/tools/munger/scripts/error_gen.py b/tools/munger/scripts/error_gen.py
index 83850f5..b1f360e 100644
--- a/tools/munger/scripts/error_gen.py
+++ b/tools/munger/scripts/error_gen.py
@@ -5,7 +5,7 @@
 
 import re
 import sys
-sys.path.append("../../src/python/oftest")
+sys.path.append("../../src/python/of10")
 from cstruct import *
 from class_maps import class_to_members_map
 
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index 053170a..ff535f7 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -80,7 +80,7 @@
 import re
 import string
 import sys
-sys.path.append("../../src/python/oftest")
+sys.path.append("../../src/python/of10")
 from cstruct import *
 from class_maps import class_to_members_map
 
