Repository: kytos/python-openflow

Issue:
Review all __str__ and __repr__ methods
We need to make sure that all `__str__` and `__repr__` are correct.

For instance, look how strange is  `common.phy_port.PhyPort`:

```
PhyPort(None, None, None, None, None)
```

Discussion:

Patch:
diff --git a/pyof/v0x01/common/flow_match.py b/pyof/v0x01/common/flow_match.py
index a900b81..07d103e 100644
--- a/pyof/v0x01/common/flow_match.py
+++ b/pyof/v0x01/common/flow_match.py
@@ -1,6 +1,7 @@
 """Defines flow statistics structures and related items"""
 
 # System imports
+import enum
 
 # Third-party imports
 
@@ -8,7 +9,10 @@
 from pyof.v0x01.foundation import base
 from pyof.v0x01.foundation import basic_types
 
-class FlowWildCards(base.GenericBitMask):
+# Enums
+
+
+class FlowWildCards(enum.Enum):
     """
     Wildcards used to identify flows.
 
diff --git a/pyof/v0x01/common/phy_port.py b/pyof/v0x01/common/phy_port.py
index 7395fb6..b45777f 100644
--- a/pyof/v0x01/common/phy_port.py
+++ b/pyof/v0x01/common/phy_port.py
@@ -1,6 +1,7 @@
 """Defines physical port classes and related items"""
 
 # System imports
+import enum
 
 # Third-party imports
 
@@ -8,20 +9,9 @@
 from pyof.v0x01.foundation import base
 from pyof.v0x01.foundation import basic_types
 
+# Enums
+
 class PortConfig(base.GenericBitMask):
-    """Flags to indicate behavior of the physical port.
-
-    These flags are used in OFPPhyPort to describe the current configuration.
-    They are used in the OFPPortMod message to configure the port's behavior.
-
-        OFPPC_PORT_DOWN     # Port is administratively down.
-        OFPPC_NO_STP        # Disable 802.1D spanning tree on port.
-        OFPPC_NO_RECV       # Drop all packets except 802.1D spanning tree.
-        OFPPC_NO_RECV_STP   # Drop received 802.1D STP packets.
-        OFPPC_NO_FLOOD      # Do not include this port when flooding.
-        OFPPC_NO_FWD        # Drop packets forwarded to port.
-        OFPPC_NO_PACKET_IN  # Do not send packet-in msgs for port.
-    """
     OFPC_PORT_DOWN = 1 << 0
     OFPPC_NO_STP = 1 << 1
     OFPPC_NO_RECV = 1 << 2
@@ -31,9 +21,32 @@ class PortConfig(base.GenericBitMask):
     OFPPC_NO_PACKET_IN = 1 << 6
 
 
-
-
-class PortState(base.GenericBitMask):
+#class PortConfig(enum.Enum):
+#    """Flags to indicate behavior of the physical port.
+#
+#    These flags are used in OFPPhyPort to describe the current configuration.
+#    They are used in the OFPPortMod message to configure the port's behavior.
+#
+#    Enums:
+#        OFPPC_PORT_DOWN     # Port is administratively down.
+#        OFPPC_NO_STP        # Disable 802.1D spanning tree on port.
+#        OFPPC_NO_RECV       # Drop all packets except 802.1D spanning tree.
+#        OFPPC_NO_RECV_STP   # Drop received 802.1D STP packets.
+#        OFPPC_NO_FLOOD      # Do not include this port when flooding.
+#        OFPPC_NO_FWD        # Drop packets forwarded to port.
+#        OFPPC_NO_PACKET_IN  # Do not send packet-in msgs for port.
+#    """
+#
+#    OFPPC_PORT_DOWN = 1 << 0
+#    OFPPC_NO_STP = 1 << 1
+#    OFPPC_NO_RECV = 1 << 2
+#    OFPPC_NO_RECV_STP = 1 << 3
+#    OFPPC_FLOOD = 1 << 4
+#    OFPPC_NO_FWD = 1 << 5
+#    OFPPC_NO_PACKET_IN = 1 << 6
+
+
+class PortState(enum.Enum):
     """Current state of the physical port.
 
     These are not configurable from the controller.
@@ -42,6 +55,7 @@ class PortState(base.GenericBitMask):
     must adjust OFPPC_NO_RECV, OFPPC_NO_FWD, and OFPPC_NO_PACKET_IN
     appropriately to fully implement an 802.1D spanning tree.
 
+    Enums:
         OFPPS_LINK_DOWN    # Not learning or relaying frames.
         OFPPS_STP_LISTEN   # Not learning or relaying frames.
         OFPPS_STP_LEARN    # Learning but not relaying frames.
@@ -58,7 +72,7 @@ class PortState(base.GenericBitMask):
     # OFPPS_STP_MASK = 3 << 8  - Refer to ISSUE #7
 
 
-class Port(base.GenericBitMask):
+class Port(enum.Enum):
     """Port numbering.
 
     Physical ports are numbered starting from 1. Port number 0 is reserved by
@@ -87,13 +101,14 @@ class Port(base.GenericBitMask):
     OFPP_NONE = 0xffff
 
 
-class PortFeatures(base.GenericBitMask):
+class PortFeatures(enum.Enum):
     """Physical ports features.
 
     The curr, advertised, supported, and peer fields indicate link modes
     (10M to 10G full and half-duplex), link type (copper/fiber) and
     link features (autone-gotiation and pause).
 
+    Enums:
         OFPPF_10MB_HD     # 10 Mb half-duplex rate support.
         OFPPF_10MB_FD     # 10 Mb full-duplex rate support.
         OFPPF_100MB_HD    # 100 Mb half-duplex rate support.
diff --git a/pyof/v0x01/controller2switch/aggregate_stats_reply.py b/pyof/v0x01/controller2switch/aggregate_stats_reply.py
new file mode 100644
index 0000000..339127c
--- /dev/null
+++ b/pyof/v0x01/controller2switch/aggregate_stats_reply.py
@@ -0,0 +1,31 @@
+"""Body of the reply message"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class AggregateStatsReply(base.GenericStruct):
+    """Body of reply to OFPST_AGGREGATE request.
+
+    :param packet_count: Number of packets in flows
+    :param byte_count:   Number of bytes in flows
+    :param flow_count:   Number of flows
+    :param pad:          Align to 64 bits
+
+    """
+    packet_count = basic_types.UBInt64()
+    byte_count = basic_types.UBInt64()
+    flow_count = basic_types.UBInt32()
+    pad = basic_types.PAD(4)
+
+    def __init__(self, packet_count=None, byte_count=None, flow_count=None):
+        self.packet_count = packet_count
+        self.byte_count = byte_count
+        self.flow_count = flow_count
diff --git a/pyof/v0x01/controller2switch/aggregate_stats_request.py b/pyof/v0x01/controller2switch/aggregate_stats_request.py
new file mode 100644
index 0000000..b45f923
--- /dev/null
+++ b/pyof/v0x01/controller2switch/aggregate_stats_request.py
@@ -0,0 +1,38 @@
+"""Aggregate information about multiple flows is requested with the
+OFPST_AGGREGATE stats request type"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.common import flow_match
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class AggregateStatsRequest(base.GenericStruct):
+    """
+    Body for ofp_stats_request of type OFPST_AGGREGATE.
+
+    :param match:    Fields to match
+    :param table_id: ID of table to read (from pyof_table_stats) 0xff
+                     for all tables or 0xfe for emergency.
+    :param pad:      Align to 32 bits
+    :param out_port: Require matching entries to include this as an
+                     output port.  A value of OFPP_NONE indicates
+                     no restriction
+
+    """
+    match = flow_match.Match()
+    table_id = basic_types.UBInt8()
+    pad = basic_types.PAD(1)
+    out_port = basic_types.UBInt16()
+
+    def __init__(self, match=None, table_id=None, out_port=None):
+        super().__init__()
+        self.match = match
+        self.table_id = table_id
+        self.out_port = out_port
diff --git a/pyof/v0x01/controller2switch/common.py b/pyof/v0x01/controller2switch/common.py
index bfb9cd3..c5490dd 100644
--- a/pyof/v0x01/controller2switch/common.py
+++ b/pyof/v0x01/controller2switch/common.py
@@ -8,7 +8,6 @@ import enum
 # Local source tree imports
 from pyof.v0x01.common import header as of_header
 from pyof.v0x01.common import action
-from pyof.v0x01.common import flow_match
 from pyof.v0x01.foundation import base
 from pyof.v0x01.foundation import basic_types
 
@@ -66,313 +65,3 @@ class ListOfActions(basic_types.FixedTypeList):
     """
     def __init__(self, items=None):
         super().__init__(pyof_class=action.ActionHeader, items=items)
-
-
-class AggregateStatsReply(base.GenericStruct):
-    """Body of reply to OFPST_AGGREGATE request.
-
-    :param packet_count: Number of packets in flows
-    :param byte_count:   Number of bytes in flows
-    :param flow_count:   Number of flows
-    :param pad:          Align to 64 bits
-
-    """
-    packet_count = basic_types.UBInt64()
-    byte_count = basic_types.UBInt64()
-    flow_count = basic_types.UBInt32()
-    pad = basic_types.PAD(4)
-
-    def __init__(self, packet_count=None, byte_count=None, flow_count=None):
-        self.packet_count = packet_count
-        self.byte_count = byte_count
-        self.flow_count = flow_count
-
-
-class AggregateStatsRequest(base.GenericStruct):
-    """
-    Body for ofp_stats_request of type OFPST_AGGREGATE.
-
-    :param match:    Fields to match
-    :param table_id: ID of table to read (from pyof_table_stats) 0xff
-                     for all tables or 0xfe for emergency.
-    :param pad:      Align to 32 bits
-    :param out_port: Require matching entries to include this as an
-                     output port.  A value of OFPP_NONE indicates
-                     no restriction
-
-    """
-    match = flow_match.Match()
-    table_id = basic_types.UBInt8()
-    pad = basic_types.PAD(1)
-    out_port = basic_types.UBInt16()
-
-    def __init__(self, match=None, table_id=None, out_port=None):
-        super().__init__()
-        self.match = match
-        self.table_id = table_id
-        self.out_port = out_port
-
-
-class DescStats(base.GenericStruct):
-    """
-    Information about the switch manufacturer, hardware revision, software
-    revision, serial number, and a description field is avail- able from
-    the OFPST_DESC stats request.
-
-    :param mfr_desc:   Manufacturer description
-    :param hw_desc:    Hardware description
-    :param sw_desc:    Software description
-    :param serial_num: Serial number
-    :param dp_desc:    Human readable description of datapath
-
-    """
-    mfr_desc = basic_types.Char(length=base.DESC_STR_LEN)
-    hw_desc = basic_types.Char(length=base.DESC_STR_LEN)
-    sw_desc = basic_types.Char(length=base.DESC_STR_LEN)
-    serial_num = basic_types.Char(length=base.SERIAL_NUM_LEN)
-    dp_desc = basic_types.Char(length=base.DESC_STR_LEN)
-
-    def __init__(self, mfr_desc=None, hw_desc=None, sw_desc=None,
-                 serial_num=None, dp_desc=None):
-        self.mfr_desc = mfr_desc
-        self.hw_desc = hw_desc
-        self.sw_desc = sw_desc
-        self.serial_num = serial_num
-        self.dp_desc = dp_desc
-
-
-class FlowStats(base.GenericStruct):
-    """
-    Body of reply to OFPST_FLOW request.
-
-    :param length:        Length of this entry
-    :param table_id:      ID of table flow came from
-    :param pad:           Align to 32 bits
-    :param match:         Description of fields
-    :param duration_sec:  Time flow has been alive in seconds
-    :param duration_nsec: Time flow has been alive in nanoseconds beyond
-                          duration_sec
-    :param priority:      Priority of the entry. Only meaningful when this
-                          is not an exact-match entry
-    :param idle_timeout:  Number of seconds idle before expiration
-    :param hard_timeout:  Number of seconds before expiration
-    :param pad2:          Align to 64-bits
-    :param cookie:        Opaque controller-issued identifier
-    :param packet_count:  Number of packets in flow
-    :param byte_count:    Number of bytes in flow
-    :param actions:       Actions
-    """
-    length = basic_types.UBInt16()
-    table_id = basic_types.UBInt8()
-    pad = basic_types.PAD(1)
-    match = flow_match.Match()
-    duration_sec = basic_types.UBInt32()
-    duration_nsec = basic_types.UBInt32()
-    priority = basic_types.UBInt16()
-    idle_timeout = basic_types.UBInt16()
-    hard_timeout = basic_types.UBInt16()
-    pad2 = basic_types.PAD(6)
-    cookie = basic_types.UBInt64()
-    packet_count = basic_types.UBInt64()
-    byte_count = basic_types.UBInt64()
-    actions = ListOfActions()
-
-    def __init__(self, length=None, table_id=None, match=None,
-                 duration_sec=None, duration_nsec=None, priority=None,
-                 idle_timeout=None, hard_timeout=None, cookie=None,
-                 packet_count=None, byte_count=None, actions=None):
-        self.length = length
-        self.table_id = table_id
-        self.match = match
-        self.duration_sec = duration_sec
-        self.duration_nsec = duration_nsec
-        self.prioriry = priority
-        self.idle_timeout = idle_timeout
-        self.hard_timeout = hard_timeout
-        self.cookie = cookie
-        self.packet_count = packet_count
-        self.byte_count = byte_count
-        self.actions = [] if actions is None else actions
-
-
-class FlowStatsRequest(base.GenericStruct):
-    """
-    Body for ofp_stats_request of type OFPST_FLOW.
-
-    :param match:    Fields to match
-    :param table_id: ID of table to read (from pyof_table_stats)
-                     0xff for all tables or 0xfe for emergency
-    :param pad:      Align to 32 bits
-    :param out_port: Require matching entries to include this as an output
-                     port. A value of OFPP_NONE indicates no restriction.
-
-    """
-    match = flow_match.Match()
-    table_id = basic_types.UBInt8()
-    pad = basic_types.PAD(1)
-    out_port = basic_types.UBInt16()
-
-    def __init__(self, match=None, table_id=None, out_port=None):
-        self.match = match
-        self.table_id = table_id
-        self.out_port = out_port
-
-
-class PortStats(base.GenericStruct):
-    """Body of reply to OFPST_PORT request.
-
-    If a counter is unsupported, set the field to all ones.
-
-    :param port_no:      Port number
-    :param pad:          Align to 64-bits
-    :param rx_packets:   Number of received packets
-    :param tx_packets:   Number of transmitted packets
-    :param rx_bytes:     Number of received bytes
-    :param tx_bytes:     Number of transmitted bytes
-    :param rx_dropped:   Number of packets dropped by RX
-    :param tx_dropped:   Number of packets dropped by TX
-    :param rx_errors:    Number of receive errors.  This is a super-set
-                         of more specific receive errors and should be
-                         greater than or equal to the sum of all
-                         rx_*_err values
-    :param tx_errors:    Number of transmit errors.  This is a super-set
-                         of more specific transmit errors and should be
-                         greater than or equal to the sum of all
-                         tx_*_err values (none currently defined.)
-    :param rx_frame_err: Number of frame alignment errors
-    :param rx_over_err:  Number of packets with RX overrun
-    :param rx_crc_err:   Number of CRC errors
-    :param collisions:   Number of collisions
-
-    """
-    port_no = basic_types.UBInt16()
-    pad = basic_types.PAD(6)
-    rx_packets = basic_types.UBInt64()
-    tx_packets = basic_types.UBInt64()
-    rx_bytes = basic_types.UBInt64()
-    tx_bytes = basic_types.UBInt64()
-    rx_dropped = basic_types.UBInt64()
-    tx_dropped = basic_types.UBInt64()
-    rx_errors = basic_types.UBInt64()
-    tx_errors = basic_types.UBInt64()
-    rx_frame_err = basic_types.UBInt64()
-    rx_over_err = basic_types.UBInt64()
-    rx_crc_err = basic_types.UBInt64()
-    collisions = basic_types.UBInt64()
-
-    def __init__(self, port_no=None, rx_packets=None,
-                 tx_packets=None, rx_bytes=None, tx_bytes=None,
-                 rx_dropped=None, tx_dropped=None, rx_errors=None,
-                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
-                 rx_crc_err=None, collisions=None):
-        self.port_no = port_no
-        self.rx_packets = rx_packets
-        self.tx_packets = tx_packets
-        self.rx_bytes = rx_bytes
-        self.tx_bytes = tx_bytes
-        self.rx_dropped = rx_dropped
-        self.tx_dropped = tx_dropped
-        self.rx_errors = rx_errors
-        self.tx_errors = tx_errors
-        self.rx_frame_err = rx_frame_err
-        self.rx_over_err = rx_over_err
-        self.rx_crc_err = rx_crc_err
-        self.collisions = collisions
-
-
-class PortStatsRequest(base.GenericStruct):
-    """
-    Body for ofp_stats_request of type OFPST_PORT
-
-    :param port_no: OFPST_PORT message must request statistics either
-                    for a single port (specified in port_no) or for
-                    all ports (if port_no == OFPP_NONE).
-    :param pad:
-
-    """
-    port_no = basic_types.UBInt16()
-    pad = basic_types.PAD(6)
-
-    def __init__(self, port_no=None):
-        self.port_no = port_no
-
-
-class QueueStats(base.GenericStruct):
-    """
-    Implements the reply body of a port_no
-
-    :param port_no:    Port Number
-    :param pad:        Align to 32-bits
-    :param queue_id:   Queue ID
-    :param tx_bytes:   Number of transmitted bytes
-    :param tx_packets: Number of transmitted packets
-    :param tx_errors:  Number of packets dropped due to overrun
-
-    """
-    port_no = basic_types.UBInt16()
-    pad = basic_types.PAD(2)
-    queue_id = basic_types.UBInt32()
-    tx_bytes = basic_types.UBInt64()
-    tx_packets = basic_types.UBInt64()
-    tx_errors = basic_types.UBInt64()
-
-    def __init__(self, port_no=None, queue_id=None, tx_bytes=None,
-                 tx_packets=None, tx_errors=None):
-        self.port_no = port_no
-        self.queue_id = queue_id
-        self.tx_bytes = tx_bytes
-        self.tx_packets = tx_packets
-        self.tx_errors = tx_errors
-
-
-class QueueStatsRequest(base.GenericStruct):
-    """
-    Implements the request body of a port_no
-
-    :param port_no:  All ports if OFPT_ALL
-    :param pad:      Align to 32-bits
-    :param queue_id: All queues if OFPQ_ALL
-    """
-    port_no = basic_types.UBInt16()
-    pad = basic_types.PAD(2)
-    queue_id = basic_types.UBInt32()
-
-    def __init__(self, port_no=None, queue_id=None):
-        self.port_no = port_no
-        self.queue_id = queue_id
-
-
-class TableStats(base.GenericStruct):
-    """Body of reply to OFPST_TABLE request.
-
-    :param table_id:      Identifier of table.  Lower numbered tables
-                          are consulted first
-    :param pad:           Align to 32-bits
-    :param name:          Table name
-    :param wildcards:     Bitmap of OFPFW_* wildcards that are supported
-                          by the table
-    :param max_entries:   Max number of entries supported
-    :param active_count:  Number of active entries
-    :param count_lookup:  Number of packets looked up in table
-    :param count_matched: Number of packets that hit table
-
-    """
-    table_id = basic_types.UBInt8()
-    pad = basic_types.PAD(3)
-    name = basic_types.Char(length=base.OFP_MAX_TABLE_NAME_LEN)
-    wildcards = basic_types.UBInt32()
-    max_entries = basic_types.UBInt32()
-    active_count = basic_types.UBInt32()
-    count_lookup = basic_types.UBInt64()
-    count_matched = basic_types.UBInt64()
-
-    def __init__(self, table_id=None, name=None, wildcards=None,
-                 max_entries=None, active_count=None, count_lookup=None,
-                 count_matched=None):
-        self.table_id = table_id
-        self.name = name
-        self.wildcards = wildcards
-        self.max_entries = max_entries
-        self.active_count = active_count
-        self.count_lookup = count_lookup
-        self.count_matched = count_matched
diff --git a/pyof/v0x01/controller2switch/desc_stats.py b/pyof/v0x01/controller2switch/desc_stats.py
new file mode 100644
index 0000000..bceffb9
--- /dev/null
+++ b/pyof/v0x01/controller2switch/desc_stats.py
@@ -0,0 +1,39 @@
+"""Information about the switch manufactures"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class DescStats(base.GenericStruct):
+    """
+    Information about the switch manufacturer, hardware revision, software
+    revision, serial number, and a description field is avail- able from
+    the OFPST_DESC stats request.
+
+    :param mfr_desc:   Manufacturer description
+    :param hw_desc:    Hardware description
+    :param sw_desc:    Software description
+    :param serial_num: Serial number
+    :param dp_desc:    Human readable description of datapath
+
+    """
+    mfr_desc = basic_types.Char(length=base.DESC_STR_LEN)
+    hw_desc = basic_types.Char(length=base.DESC_STR_LEN)
+    sw_desc = basic_types.Char(length=base.DESC_STR_LEN)
+    serial_num = basic_types.Char(length=base.SERIAL_NUM_LEN)
+    dp_desc = basic_types.Char(length=base.DESC_STR_LEN)
+
+    def __init__(self, mfr_desc=None, hw_desc=None, sw_desc=None,
+                 serial_num=None, dp_desc=None):
+        self.mfr_desc = mfr_desc
+        self.hw_desc = hw_desc
+        self.sw_desc = sw_desc
+        self.serial_num = serial_num
+        self.dp_desc = dp_desc
diff --git a/pyof/v0x01/controller2switch/features_reply.py b/pyof/v0x01/controller2switch/features_reply.py
index c5f3bca..e02f012 100644
--- a/pyof/v0x01/controller2switch/features_reply.py
+++ b/pyof/v0x01/controller2switch/features_reply.py
@@ -1,6 +1,7 @@
 """Defines Features Reply classes and related items"""
 
 # System imports
+import enum
 
 # Third-party imports
 
@@ -11,9 +12,13 @@ from pyof.v0x01.foundation import base
 from pyof.v0x01.foundation import basic_types
 
 
-class Capabilities(base.GenericBitMask):
-    """Capabilities supported by the datapath
+# Enums
 
+
+class Capabilities(enum.Enum):
+    """Enumeration of Capabilities supported by the datapath
+
+    Enums:
         OFPC_FLOW_STATS     # Flow statistics
         OFPC_TABLE_STATS    # Table statistics
         OFPC_PORT_STATS     # Port statistics
diff --git a/pyof/v0x01/controller2switch/flow_stats.py b/pyof/v0x01/controller2switch/flow_stats.py
new file mode 100644
index 0000000..efb5edd
--- /dev/null
+++ b/pyof/v0x01/controller2switch/flow_stats.py
@@ -0,0 +1,67 @@
+"""Body of the reply to an OFPST_FLOW"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.common import flow_match
+from pyof.v0x01.controller2switch import common
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class FlowStats(base.GenericStruct):
+    """
+    Body of reply to OFPST_FLOW request.
+
+    :param length:        Length of this entry
+    :param table_id:      ID of table flow came from
+    :param pad:           Align to 32 bits
+    :param match:         Description of fields
+    :param duration_sec:  Time flow has been alive in seconds
+    :param duration_nsec: Time flow has been alive in nanoseconds beyond
+                          duration_sec
+    :param priority:      Priority of the entry. Only meaningful when this
+                          is not an exact-match entry
+    :param idle_timeout:  Number of seconds idle before expiration
+    :param hard_timeout:  Number of seconds before expiration
+    :param pad2:          Align to 64-bits
+    :param cookie:        Opaque controller-issued identifier
+    :param packet_count:  Number of packets in flow
+    :param byte_count:    Number of bytes in flow
+    :param actions:       Actions
+    """
+    length = basic_types.UBInt16()
+    table_id = basic_types.UBInt8()
+    pad = basic_types.PAD(1)
+    match = flow_match.Match()
+    duration_sec = basic_types.UBInt32()
+    duration_nsec = basic_types.UBInt32()
+    priority = basic_types.UBInt16()
+    idle_timeout = basic_types.UBInt16()
+    hard_timeout = basic_types.UBInt16()
+    pad2 = basic_types.PAD(6)
+    cookie = basic_types.UBInt64()
+    packet_count = basic_types.UBInt64()
+    byte_count = basic_types.UBInt64()
+    actions = common.ListOfActions()
+
+    def __init__(self, length=None, table_id=None, match=None,
+                 duration_sec=None, duration_nsec=None, priority=None,
+                 idle_timeout=None, hard_timeout=None, cookie=None,
+                 packet_count=None, byte_count=None, actions=None):
+        self.length = length
+        self.table_id = table_id
+        self.match = match
+        self.duration_sec = duration_sec
+        self.duration_nsec = duration_nsec
+        self.prioriry = priority
+        self.idle_timeout = idle_timeout
+        self.hard_timeout = hard_timeout
+        self.cookie = cookie
+        self.packet_count = packet_count
+        self.byte_count = byte_count
+        self.actions = [] if actions is None else actions
diff --git a/pyof/v0x01/controller2switch/flow_stats_request.py b/pyof/v0x01/controller2switch/flow_stats_request.py
new file mode 100644
index 0000000..1fc5794
--- /dev/null
+++ b/pyof/v0x01/controller2switch/flow_stats_request.py
@@ -0,0 +1,35 @@
+"""Information about individual flows"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.common import flow_match
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class FlowStatsRequest(base.GenericStruct):
+    """
+    Body for ofp_stats_request of type OFPST_FLOW.
+
+    :param match:    Fields to match
+    :param table_id: ID of table to read (from pyof_table_stats)
+                     0xff for all tables or 0xfe for emergency
+    :param pad:      Align to 32 bits
+    :param out_port: Require matching entries to include this as an output
+                     port. A value of OFPP_NONE indicates no restriction.
+
+    """
+    match = flow_match.Match()
+    table_id = basic_types.UBInt8()
+    pad = basic_types.PAD(1)
+    out_port = basic_types.UBInt16()
+
+    def __init__(self, match=None, table_id=None, out_port=None):
+        self.match = match
+        self.table_id = table_id
+        self.out_port = out_port
diff --git a/pyof/v0x01/controller2switch/port_stats.py b/pyof/v0x01/controller2switch/port_stats.py
new file mode 100644
index 0000000..474828d
--- /dev/null
+++ b/pyof/v0x01/controller2switch/port_stats.py
@@ -0,0 +1,73 @@
+"""Body of the port stats reply"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+# Classes
+
+
+class PortStats(base.GenericStruct):
+    """Body of reply to OFPST_PORT request.
+
+    If a counter is unsupported, set the field to all ones.
+
+    :param port_no:      Port number
+    :param pad:          Align to 64-bits
+    :param rx_packets:   Number of received packets
+    :param tx_packets:   Number of transmitted packets
+    :param rx_bytes:     Number of received bytes
+    :param tx_bytes:     Number of transmitted bytes
+    :param rx_dropped:   Number of packets dropped by RX
+    :param tx_dropped:   Number of packets dropped by TX
+    :param rx_errors:    Number of receive errors.  This is a super-set
+                         of more specific receive errors and should be
+                         greater than or equal to the sum of all
+                         rx_*_err values
+    :param tx_errors:    Number of transmit errors.  This is a super-set
+                         of more specific transmit errors and should be
+                         greater than or equal to the sum of all
+                         tx_*_err values (none currently defined.)
+    :param rx_frame_err: Number of frame alignment errors
+    :param rx_over_err:  Number of packets with RX overrun
+    :param rx_crc_err:   Number of CRC errors
+    :param collisions:   Number of collisions
+
+    """
+    port_no = basic_types.UBInt16()
+    pad = basic_types.PAD(6)
+    rx_packets = basic_types.UBInt64()
+    tx_packets = basic_types.UBInt64()
+    rx_bytes = basic_types.UBInt64()
+    tx_bytes = basic_types.UBInt64()
+    rx_dropped = basic_types.UBInt64()
+    tx_dropped = basic_types.UBInt64()
+    rx_errors = basic_types.UBInt64()
+    tx_errors = basic_types.UBInt64()
+    rx_frame_err = basic_types.UBInt64()
+    rx_over_err = basic_types.UBInt64()
+    rx_crc_err = basic_types.UBInt64()
+    collisions = basic_types.UBInt64()
+
+    def __init__(self, port_no=None, rx_packets=None,
+                 tx_packets=None, rx_bytes=None, tx_bytes=None,
+                 rx_dropped=None, tx_dropped=None, rx_errors=None,
+                 tx_errors=None, rx_frame_err=None, rx_over_err=None,
+                 rx_crc_err=None, collisions=None):
+        self.port_no = port_no
+        self.rx_packets = rx_packets
+        self.tx_packets = tx_packets
+        self.rx_bytes = rx_bytes
+        self.tx_bytes = tx_bytes
+        self.rx_dropped = rx_dropped
+        self.tx_dropped = tx_dropped
+        self.rx_errors = rx_errors
+        self.tx_errors = tx_errors
+        self.rx_frame_err = rx_frame_err
+        self.rx_over_err = rx_over_err
+        self.rx_crc_err = rx_crc_err
+        self.collisions = collisions
diff --git a/pyof/v0x01/controller2switch/port_stats_request.py b/pyof/v0x01/controller2switch/port_stats_request.py
new file mode 100644
index 0000000..8fa4049
--- /dev/null
+++ b/pyof/v0x01/controller2switch/port_stats_request.py
@@ -0,0 +1,26 @@
+"""Information about physical ports is requested with OFPST_PORT"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+
+class PortStatsRequest(base.GenericStruct):
+    """
+    Body for ofp_stats_request of type OFPST_PORT
+
+    :param port_no: OFPST_PORT message must request statistics either
+                    for a single port (specified in port_no) or for
+                    all ports (if port_no == OFPP_NONE).
+    :param pad:
+
+    """
+    port_no = basic_types.UBInt16()
+    pad = basic_types.PAD(6)
+
+    def __init__(self, port_no=None):
+        self.port_no = port_no
diff --git a/pyof/v0x01/controller2switch/queue_stats.py b/pyof/v0x01/controller2switch/queue_stats.py
new file mode 100644
index 0000000..d7df9b3
--- /dev/null
+++ b/pyof/v0x01/controller2switch/queue_stats.py
@@ -0,0 +1,38 @@
+"""The OFPST_QUEUE stats reply message provides queue statistics for one
+or more ports."""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+
+class QueueStats(base.GenericStruct):
+    """
+    Implements the reply body of a port_no
+
+    :param port_no:    Port Number
+    :param pad:        Align to 32-bits
+    :param queue_id:   Queue ID
+    :param tx_bytes:   Number of transmitted bytes
+    :param tx_packets: Number of transmitted packets
+    :param tx_errors:  Number of packets dropped due to overrun
+
+    """
+    port_no = basic_types.UBInt16()
+    pad = basic_types.PAD(2)
+    queue_id = basic_types.UBInt32()
+    tx_bytes = basic_types.UBInt64()
+    tx_packets = basic_types.UBInt64()
+    tx_errors = basic_types.UBInt64()
+
+    def __init__(self, port_no=None, queue_id=None, tx_bytes=None,
+                 tx_packets=None, tx_errors=None):
+        self.port_no = port_no
+        self.queue_id = queue_id
+        self.tx_bytes = tx_bytes
+        self.tx_packets = tx_packets
+        self.tx_errors = tx_errors
diff --git a/pyof/v0x01/controller2switch/queue_stats_request.py b/pyof/v0x01/controller2switch/queue_stats_request.py
new file mode 100644
index 0000000..c1b431b
--- /dev/null
+++ b/pyof/v0x01/controller2switch/queue_stats_request.py
@@ -0,0 +1,27 @@
+"""The OFPST_QUEUE stats request message provides queue statistics for one
+or more ports."""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+
+class QueueStatsRequest(base.GenericStruct):
+    """
+    Implements the request body of a port_no
+
+    :param port_no:  All ports if OFPT_ALL
+    :param pad:      Align to 32-bits
+    :param queue_id: All queues if OFPQ_ALL
+    """
+    port_no = basic_types.UBInt16()
+    pad = basic_types.PAD(2)
+    queue_id = basic_types.UBInt32()
+
+    def __init__(self, port_no=None, queue_id=None):
+        self.port_no = port_no
+        self.queue_id = queue_id
diff --git a/pyof/v0x01/controller2switch/table_stats.py b/pyof/v0x01/controller2switch/table_stats.py
new file mode 100644
index 0000000..bf2e42f
--- /dev/null
+++ b/pyof/v0x01/controller2switch/table_stats.py
@@ -0,0 +1,45 @@
+"""Information about tables is requested with OFPST_TABLE stats request type"""
+
+# System imports
+
+# Third-party imports
+
+# Local source tree imports
+from pyof.v0x01.foundation import base
+from pyof.v0x01.foundation import basic_types
+
+
+class TableStats(base.GenericStruct):
+    """Body of reply to OFPST_TABLE request.
+
+    :param table_id:      Identifier of table.  Lower numbered tables
+                          are consulted first
+    :param pad:           Align to 32-bits
+    :param name:          Table name
+    :param wildcards:     Bitmap of OFPFW_* wildcards that are supported
+                          by the table
+    :param max_entries:   Max number of entries supported
+    :param active_count:  Number of active entries
+    :param count_lookup:  Number of packets looked up in table
+    :param count_matched: Number of packets that hit table
+
+    """
+    table_id = basic_types.UBInt8()
+    pad = basic_types.PAD(3)
+    name = basic_types.Char(length=base.OFP_MAX_TABLE_NAME_LEN)
+    wildcards = basic_types.UBInt32()
+    max_entries = basic_types.UBInt32()
+    active_count = basic_types.UBInt32()
+    count_lookup = basic_types.UBInt64()
+    count_matched = basic_types.UBInt64()
+
+    def __init__(self, table_id=None, name=None, wildcards=None,
+                 max_entries=None, active_count=None, count_lookup=None,
+                 count_matched=None):
+        self.table_id = table_id
+        self.name = name
+        self.wildcards = wildcards
+        self.max_entries = max_entries
+        self.active_count = active_count
+        self.count_lookup = count_lookup
+        self.count_matched = count_matched
diff --git a/pyof/v0x01/foundation/base.py b/pyof/v0x01/foundation/base.py
index 7c07b3e..a146a48 100644
--- a/pyof/v0x01/foundation/base.py
+++ b/pyof/v0x01/foundation/base.py
@@ -60,17 +60,16 @@ class GenericType(object):
     """This is a foundation class for all custom attributes.
 
     Attributes like `UBInt8`, `UBInt16`, `HWAddress` amoung others uses this
-    class as base.
-    """
+    class as base."""
     def __init__(self, value=None, enum_ref=None):
         self._value = value
         self._enum_ref = enum_ref
 
     def __repr__(self):
-        return "{}({})".format(self.__class__.__name__, self._value)
+        return "{}({})".format(type(self).__name__, self._value)
 
     def __str__(self):
-        return '<{}: {}>'.format(self.__class__.__name__, str(self._value))
+        return '{}'.format(str(self._value))
 
     def __eq__(self, other):
         return self._value == other
@@ -105,7 +104,7 @@ class GenericType(object):
             return struct.pack(self._fmt, value)
         except struct.error as err:
             message = "Value out of the possible range to basic type "
-            message = message + self.__class__.__name__ + ". "
+            message = message + type(self).__name__ + ". "
             message = message + str(err)
             raise exceptions.BadValueException(message)
 
@@ -154,7 +153,6 @@ class GenericType(object):
 
 class MetaStruct(type):
     """MetaClass used to force ordered attributes."""
-
     @classmethod
     def __prepare__(self, name, bases):
         return _OD()
@@ -177,7 +175,6 @@ class GenericStruct(object, metaclass=MetaStruct):
               has a list of attributes and theses attributes can be of struct
               type too.
     """
-
     def __init__(self, *args, **kwargs):
         for _attr in self.__ordered__:
             if not callable(getattr(self, _attr)):
@@ -186,29 +183,6 @@ class GenericStruct(object, metaclass=MetaStruct):
                 except KeyError:
                     pass
 
-    def __repr__(self):
-        message = self.__class__.__name__
-        message += '('
-        for _attr in self.__ordered__:
-            message += repr(getattr(self, _attr))
-            message += ", "
-        # Removing a comma and a space from the end of the string
-        message = message[:-2]
-        message += ')'
-        return message
-
-    def __str__(self):
-        message = "{}:\n".format(self.__class__.__name__)
-        for _attr in self.__ordered__:
-            attr = getattr(self, _attr)
-            if not hasattr(attr, '_fmt'):
-                message += "  {}".format(str(attr).replace('\n', '\n  '))
-            else:
-                message += "  {}: {}\n".format(_attr, str(attr))
-        message.rstrip('\r')
-        message.rstrip('\n')
-        return message
-
     def _attributes(self):
         """Returns a generator with each attribute from the current instance.
 
@@ -282,7 +256,7 @@ class GenericStruct(object, metaclass=MetaStruct):
                 if _class.__name__ is 'PAD':
                     size += attr.get_size()
                 elif _class.__name__ is 'Char':
-                    size += getattr(self.__class__, _attr).get_size()
+                    size += getattr(type(self), _attr).get_size()
                 elif issubclass(_class, GenericType):
                     size += _class().get_size()
                 elif isinstance(attr, _class):
@@ -302,13 +276,13 @@ class GenericStruct(object, metaclass=MetaStruct):
         """
         if not self.is_valid():
             error_msg = "Erro on validation prior to pack() on class "
-            error_msg += "{}.".format(self.__class__.__name__)
+            error_msg += "{}.".format(type(self).__name__)
             raise exceptions.ValidationError(error_msg)
         else:
             message = b''
             for attr_name, attr_class in self.__ordered__.items():
                 attr = getattr(self, attr_name)
-                class_attr = getattr(self.__class__, attr_name)
+                class_attr = getattr(type(self), attr_name)
                 if isinstance(attr, attr_class):
                     message += attr.pack()
                 elif class_attr.is_enum():
@@ -469,10 +443,10 @@ class GenericBitMask(object, metaclass=MetaBitMask):
         self.bitmask = bitmask
 
     def __str__(self):
-        return "<%s: %s>" % (self.__class__.__name__, self.names)
+        return "{}".format(self.bitmask)
 
     def __repr__(self):
-        return "<%s(%s)>" % (self.__class__.__name__, self.bitmask)
+        return "{}({})".format(type(self).__name__, self.bitmask)
 
     @property
     def names(self):
diff --git a/pyof/v0x01/foundation/basic_types.py b/pyof/v0x01/foundation/basic_types.py
index 417d7f1..ba26316 100644
--- a/pyof/v0x01/foundation/basic_types.py
+++ b/pyof/v0x01/foundation/basic_types.py
@@ -27,10 +27,10 @@ class PAD(base.GenericType):
         self._length = length
 
     def __repr__(self):
-        return "{}({})".format(self.__class__.__name__, self._length)
+        return "{}({})".format(type(self).__name__, self._length)
 
     def __str__(self):
-        return str(self._length)
+        return self.pack()
 
     def get_size(self):
         """ Return the size of type in bytes. """
@@ -131,7 +131,6 @@ class BinaryData(base.GenericType):
     Both the 'pack' and 'unpack' methods will return the binary data itself.
     get_size method will return the size of the instance using python 'len'
     """
-
     def __init__(self, value=b''):
         super().__init__(value)
 
@@ -144,7 +143,7 @@ class BinaryData(base.GenericType):
         else:
             raise exceptions.NotBinarydata()
 
-    def unpack(self, buff):
+    def unpack(self, buff, offset):
         self._value = buff
 
     def get_size(self):
@@ -163,18 +162,9 @@ class FixedTypeList(list, base.GenericStruct):
         elif items:
             self.append(items)
 
-    def __repr__(self):
-        """Unique representantion of the object.
-
-        This can be used to generate an object that has the
-        same content of the current object"""
-        return "{}({},{})".format(self.__class__.__name__,
-                                  self._pyof_class,
-                                  self)
-
     def __str__(self):
         """Human-readable object representantion"""
-        return "{}".format([item for item in self])
+        return "{}".format([str(item) for item in self])
 
     def append(self, item):
         if type(item) is list:
@@ -243,17 +233,9 @@ class ConstantTypeList(list, base.GenericStruct):
         elif items:
             self.append(items)
 
-    def __repr__(self):
-        """Unique representantion of the object.
-
-        This can be used to generate an object that has the
-        same content of the current object"""
-        return "{}({})".format(self.__class__.__name__,
-                               self)
-
     def __str__(self):
         """Human-readable object representantion"""
-        return "{}".format([item for item in self])
+        return "{}".format([str(item) for item in self])
 
     def append(self, item):
         if type(item) is list:


Test patch:
diff --git a/tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py b/tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py
index 1c699dd..3fc3326 100644
--- a/tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py
+++ b/tests/v0x01/test_controller2switch/test_aggregate_stats_reply.py
@@ -1,12 +1,12 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import AggregateStatsReply
+from pyof.v0x01.controller2switch import aggregate_stats_reply
 
 
 class TestAggregateStatsReply(unittest.TestCase):
 
     def setUp(self):
-        self.message = AggregateStatsReply()
+        self.message = aggregate_stats_reply.AggregateStatsReply()
         self.message.packet_count = 5
         self.message.byte_count = 1
         self.message.flow_count = 8
diff --git a/tests/v0x01/test_controller2switch/test_aggregate_stats_request.py b/tests/v0x01/test_controller2switch/test_aggregate_stats_request.py
index 8e4be10..ca563fe 100644
--- a/tests/v0x01/test_controller2switch/test_aggregate_stats_request.py
+++ b/tests/v0x01/test_controller2switch/test_aggregate_stats_request.py
@@ -2,13 +2,13 @@ import unittest
 
 from pyof.v0x01.common import flow_match
 from pyof.v0x01.common import phy_port
-from pyof.v0x01.controller2switch.common import AggregateStatsRequest
+from pyof.v0x01.controller2switch import aggregate_stats_request
 
 
 class TestAggregateStatsRequest(unittest.TestCase):
 
     def setUp(self):
-        self.message = AggregateStatsRequest()
+        self.message = aggregate_stats_request.AggregateStatsRequest()
         self.message.match = flow_match.Match()
         self.message.table_id = 1
         self.message.out_port = phy_port.Port.OFPP_NONE
diff --git a/tests/v0x01/test_controller2switch/test_desc_stats.py b/tests/v0x01/test_controller2switch/test_desc_stats.py
index 4f13f97..5ea6422 100644
--- a/tests/v0x01/test_controller2switch/test_desc_stats.py
+++ b/tests/v0x01/test_controller2switch/test_desc_stats.py
@@ -1,6 +1,6 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import DescStats
+from pyof.v0x01.controller2switch import desc_stats
 from pyof.v0x01.foundation import base
 
 
@@ -8,7 +8,7 @@ class TestDescStats(unittest.TestCase):
 
     def setUp(self):
         content = bytes('A' * base.DESC_STR_LEN, 'utf-8')
-        self.message = DescStats()
+        self.message = desc_stats.DescStats()
         self.message.mfr_desc = content
         self.message.hw_desc = content
         self.message.sw_desc = content
diff --git a/tests/v0x01/test_controller2switch/test_flow_stats.py b/tests/v0x01/test_controller2switch/test_flow_stats.py
index 2a04c07..1de34ab 100644
--- a/tests/v0x01/test_controller2switch/test_flow_stats.py
+++ b/tests/v0x01/test_controller2switch/test_flow_stats.py
@@ -1,13 +1,13 @@
 import unittest
 
 from pyof.v0x01.common import flow_match
-from pyof.v0x01.controller2switch.common import FlowStats
+from pyof.v0x01.controller2switch import flow_stats
 
 
 class TestFlowStats(unittest.TestCase):
 
     def setUp(self):
-        self.message = FlowStats()
+        self.message = flow_stats.FlowStats()
         self.message.length = 160
         self.message.table_id = 1
         self.message.match = flow_match.Match()
diff --git a/tests/v0x01/test_controller2switch/test_flow_stats_request.py b/tests/v0x01/test_controller2switch/test_flow_stats_request.py
index 2a6f3fb..85a33bb 100644
--- a/tests/v0x01/test_controller2switch/test_flow_stats_request.py
+++ b/tests/v0x01/test_controller2switch/test_flow_stats_request.py
@@ -1,13 +1,13 @@
 import unittest
 
 from pyof.v0x01.common import flow_match
-from pyof.v0x01.controller2switch.common import FlowStatsRequest
+from pyof.v0x01.controller2switch import flow_stats_request
 
 
 class TestFlowStatsRequest(unittest.TestCase):
 
     def setUp(self):
-        self.message = FlowStatsRequest()
+        self.message = flow_stats_request.FlowStatsRequest()
         self.message.match = flow_match.Match()
         self.message.table_id = 1
         self.message.out_port = 80
diff --git a/tests/v0x01/test_controller2switch/test_port_stats.py b/tests/v0x01/test_controller2switch/test_port_stats.py
index e6f4b55..7a58485 100644
--- a/tests/v0x01/test_controller2switch/test_port_stats.py
+++ b/tests/v0x01/test_controller2switch/test_port_stats.py
@@ -1,12 +1,12 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import PortStats
+from pyof.v0x01.controller2switch import port_stats
 
 
 class TestPortStats(unittest.TestCase):
 
     def setUp(self):
-        self.message = PortStats()
+        self.message = port_stats.PortStats()
         self.message.port_no = 80
         self.message.rx_packets = 5
         self.message.tx_packets = 10
diff --git a/tests/v0x01/test_controller2switch/test_port_stats_request.py b/tests/v0x01/test_controller2switch/test_port_stats_request.py
index 8025055..e0454dc 100644
--- a/tests/v0x01/test_controller2switch/test_port_stats_request.py
+++ b/tests/v0x01/test_controller2switch/test_port_stats_request.py
@@ -1,12 +1,12 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import PortStatsRequest 
+from pyof.v0x01.controller2switch import port_stats_request
 
 
 class TestPortStatsRequest(unittest.TestCase):
 
     def setUp(self):
-        self.message = PortStatsRequest()
+        self.message = port_stats_request.PortStatsRequest()
         self.message.port_no = 80
 
     def test_get_size(self):
diff --git a/tests/v0x01/test_controller2switch/test_queue_stats.py b/tests/v0x01/test_controller2switch/test_queue_stats.py
index b1f1219..fb03ee7 100644
--- a/tests/v0x01/test_controller2switch/test_queue_stats.py
+++ b/tests/v0x01/test_controller2switch/test_queue_stats.py
@@ -1,12 +1,12 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import QueueStats
+from pyof.v0x01.controller2switch import queue_stats
 
 
 class TestQueueStats(unittest.TestCase):
 
     def setUp(self):
-        self.message = QueueStats()
+        self.message = queue_stats.QueueStats()
         self.message.port_no = 80
         self.message.queue_id = 5
         self.message.tx_bytes = 1
diff --git a/tests/v0x01/test_controller2switch/test_queue_stats_request.py b/tests/v0x01/test_controller2switch/test_queue_stats_request.py
index 2f95381..80cad68 100644
--- a/tests/v0x01/test_controller2switch/test_queue_stats_request.py
+++ b/tests/v0x01/test_controller2switch/test_queue_stats_request.py
@@ -1,12 +1,12 @@
 import unittest
 
-from pyof.v0x01.controller2switch.common import QueueStatsRequest
+from pyof.v0x01.controller2switch import queue_stats_request
 
 
 class TestQueueStatsRequest(unittest.TestCase):
 
     def setUp(self):
-        self.message = QueueStatsRequest()
+        self.message = queue_stats_request.QueueStatsRequest()
         self.message.port_no = 80
         self.message.queue_id = 5
 
diff --git a/tests/v0x01/test_controller2switch/test_table_stats.py b/tests/v0x01/test_controller2switch/test_table_stats.py
index 39888b5..353f6de 100644
--- a/tests/v0x01/test_controller2switch/test_table_stats.py
+++ b/tests/v0x01/test_controller2switch/test_table_stats.py
@@ -1,14 +1,14 @@
 import unittest
 
 from pyof.v0x01.common import flow_match
-from pyof.v0x01.controller2switch.common import TableStats
+from pyof.v0x01.controller2switch import table_stats
 from pyof.v0x01.foundation import base
 
 
 class TestTableStats(unittest.TestCase):
 
     def setUp(self):
-        self.message = TableStats()
+        self.message = table_stats.TableStats()
         self.message.table_id = 1
         self.message.name = bytes('X' * base.OFP_MAX_TABLE_NAME_LEN, 'utf-8')
         self.message.wildcards = flow_match.FlowWildCards.OFPFW_TP_DST