diff --git a/src/python/of10/message.py b/src/python/of10/message.py
index 849c15a..76d7d30 100644
--- a/src/python/of10/message.py
+++ b/src/python/of10/message.py
@@ -2749,13 +2749,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_AGGREGATE
         # stats: Array of type aggregate_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -2766,14 +2766,14 @@
         while len(binary_string) >= len(dummy):
             obj = aggregate_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -2782,8 +2782,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -2791,7 +2791,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
@@ -2858,13 +2858,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_DESC
         # stats: Array of type desc_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -2875,14 +2875,14 @@
         while len(binary_string) >= len(dummy):
             obj = desc_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -2891,8 +2891,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -2900,7 +2900,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
@@ -2967,13 +2967,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_FLOW
         # stats: Array of type flow_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -2984,14 +2984,14 @@
         while len(binary_string) >= len(dummy):
             obj = flow_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -3000,8 +3000,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -3009,7 +3009,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
@@ -3076,13 +3076,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_PORT
         # stats: Array of type port_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -3093,14 +3093,14 @@
         while len(binary_string) >= len(dummy):
             obj = port_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -3109,8 +3109,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -3118,7 +3118,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
@@ -3185,13 +3185,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_QUEUE
         # stats: Array of type queue_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -3202,14 +3202,14 @@
         while len(binary_string) >= len(dummy):
             obj = queue_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -3218,8 +3218,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -3227,7 +3227,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
@@ -3294,13 +3294,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = OFPST_TABLE
         # stats: Array of type table_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -3311,14 +3311,14 @@
         while len(binary_string) >= len(dummy):
             obj = table_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.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:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -3327,8 +3327,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -3336,7 +3336,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 1aacf63..a14eab1 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -1011,9 +1011,9 @@
     rv = {}
 
     (reply, pkt) = parent.controller.transact(stat_req)
-    parent.assertTrue(len(reply.stats) == 1, "Did not receive flow stats reply")
+    parent.assertTrue(len(reply.entries) == 1, "Did not receive flow stats reply")
 
-    for obj in reply.stats:
+    for obj in reply.entries:
         (rv["flows"], rv["packets"], rv["bytes"]) = (obj.flow_count, 
                                                   obj.packet_count, obj.byte_count)
         break
@@ -1023,7 +1023,7 @@
 
     
     (rv["active"], rv["lookups"], rv["matched"]) = (0,0,0)
-    for obj in reply.stats:
+    for obj in reply.entries:
         rv["active"] += obj.active_count
         rv["lookups"] += obj.lookup_count
         rv["matched"] += obj.matched_count
@@ -1147,11 +1147,11 @@
     stats = []
     reply, _ = test.controller.transact(req)
     test.assertTrue(reply is not None, "No response to stats request")
-    stats.extend(reply.stats)
+    stats.extend(reply.entries)
     while reply.flags & of10.OFPSF_REPLY_MORE != 0:
         reply, pkt = self.controller.poll(exp_msg=of10.OFPT_STATS_REPLY)
         test.assertTrue(reply is not None, "No response to stats request")
-        stats.extend(reply.stats)
+        stats.extend(reply.entries)
     return stats
 
 def get_flow_stats(test, match, table_id=0xff, out_port=of10.OFPP_NONE):
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index 9f5278d..92b3024 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -422,7 +422,7 @@
     tx_err=0
 
 
-    for obj in response.stats:
+    for obj in response.entries:
         rx_pkts += obj.rx_packets
         tx_pkts += obj.tx_packets
         rx_byts += obj.rx_bytes
@@ -461,7 +461,7 @@
     current_matched = 0
     current_active = 0 
 
-    for obj in response.stats:
+    for obj in response.entries:
         current_lookedup += obj.lookup_count
         current_matched  += obj.matched_count
         current_active += obj.active_count
@@ -486,7 +486,7 @@
         matched = 0 
         active = 0
         
-        for item in response.stats:
+        for item in response.entries:
             lookedup += item.lookup_count
             matched += item.matched_count
             active += item.active_count
diff --git a/tests/basic.py b/tests/basic.py
index b2fe483..82670b4 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -416,7 +416,7 @@
             request = ofp.message.table_stats_request()
             response, _ = self.controller.transact(request)
             try:
-                table_stats = [x for x in response.stats if x.table_id == table_id][0]
+                table_stats = [x for x in response.entries if x.table_id == table_id][0]
             except IndexError:
                 raise AssertionError("table id %d not found" % table_id)
             return table_stats.config
diff --git a/tests/caps.py b/tests/caps.py
index 76147d7..7a0b83f 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -73,10 +73,10 @@
             logging.info(response.show())
             if table_idx == -1:  # Accumulate for all tables
                 active_flows = 0
-                for stats in response.stats:
+                for stats in response.entries:
                     active_flows += stats.active_count
             else: # Table index to use specified in config
-                active_flows = response.stats[table_idx].active_count
+                active_flows = response.entries[table_idx].active_count
             if active_flows != flow_count:
                 break
 
diff --git a/tests/counters.py b/tests/counters.py
index afa1961..77182b6 100644
--- a/tests/counters.py
+++ b/tests/counters.py
@@ -24,7 +24,7 @@
 
 def port_queues_get(self, queue_stats, port_num):
             result = []
-            for qs in queue_stats.stats:
+            for qs in queue_stats.entries:
                 if qs.port_no != port_num:
                     continue
                 result.append(qs.queue_id)
@@ -131,9 +131,9 @@
         response, pkt = self.controller.transact(stat_req)
         
         self.assertTrue(response is not None,"No response to stats request")
-        self.assertTrue(len(response.stats) == 1,"Did not receive flow stats reply")
+        self.assertTrue(len(response.entries) == 1,"Did not receive flow stats reply")
         
-        stat = response.stats[0]
+        stat = response.entries[0]
         logging.info("Duration of flow is %d s %d ns", stat.duration_sec, stat.duration_nsec) 
         self.assertTrue(stat.duration_sec == expected_duration, "Flow stats reply incorrect")
 
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 0784040..9c53ab6 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -1162,7 +1162,7 @@
             fc = Flow_Cfg()
             fc.rand(fi, \
                     wildcards_force, \
-                    sw.tbl_stats.stats[tbl].wildcards, \
+                    sw.tbl_stats.entries[tbl].wildcards, \
                     sw.sw_features.actions, \
                     sw.valid_ports, \
                     sw.valid_queues \
@@ -1174,7 +1174,7 @@
             self.insert(fc)
             i = i + 1
             j = j + 1
-            if j >= sw.tbl_stats.stats[tbl].max_entries:
+            if j >= sw.tbl_stats.entries[tbl].max_entries:
                 tbl = tbl + 1
                 j = 0
 
@@ -1273,7 +1273,7 @@
             logging.error("Get table stats failed")
             return False
         i = 0
-        for ts in self.tbl_stats.stats:
+        for ts in self.tbl_stats.entries:
             logging.info("Supported wildcards for table %d reported by switch:"
                            % (i)
                            )
@@ -1302,7 +1302,7 @@
             logging.error("Get queue stats failed")
             return False
         self.valid_queues = map(lambda x: (x.port_no, x.queue_id), \
-                                self.queue_stats.stats \
+                                self.queue_stats.entries \
                                 )
         logging.info("(Port, queue) pairs reported by switch:")
         logging.info(self.valid_queues)
@@ -1342,9 +1342,9 @@
             if n == 0:
                 self.flow_stats = resp
             else:
-                self.flow_stats.stats.extend(resp.stats)
+                self.flow_stats.entries.extend(resp.entries)
             n = n + 1
-            if len(self.flow_stats.stats) > limit:
+            if len(self.flow_stats.entries) > limit:
                 logging.error("Too many flows returned")
                 return False
             if (resp.flags & 1) == 0:
@@ -1451,7 +1451,7 @@
             logging.error("Get table stats failed")
             return False
         n = 0
-        for ts in self.tbl_stats.stats:
+        for ts in self.tbl_stats.entries:
             n = n + ts.active_count
         logging.info("Table stats reported %d active flows" \
                           % (n) \
@@ -1466,18 +1466,18 @@
         if not self.flow_stats_get():
             logging.error("Get flow stats failed")
             return False
-        logging.info("Retrieved %d flows" % (len(self.flow_stats.stats)))
+        logging.info("Retrieved %d flows" % (len(self.flow_stats.entries)))
     
         # Verify flows returned by switch
     
-        if len(self.flow_stats.stats) != self.flow_tbl.count():
+        if len(self.flow_stats.entries) != self.flow_tbl.count():
             logging.error("Switch reported incorrect number of flows")
             result = False
     
         logging.info("Verifying received flows")
         for fc in self.flow_tbl.values():
             fc.matched = False
-        for fs in self.flow_stats.stats:
+        for fs in self.flow_stats.entries:
             flow_in = Flow_Cfg()
             flow_in.from_flow_stat(fs)
             logging.info("Received flow:")
@@ -1593,7 +1593,7 @@
             # Number of flows requested was 0
             # => Generate max number of flows
 
-            for ts in sw.tbl_stats.stats:
+            for ts in sw.tbl_stats.entries:
                 num_flows = num_flows + ts.max_entries
 
         logging.info("Generating %d flows" % (num_flows))        
@@ -1702,7 +1702,7 @@
             fc = Flow_Cfg()
             fc.rand(fi, \
                     required_wildcards(self), \
-                    sw.tbl_stats.stats[0].wildcards, \
+                    sw.tbl_stats.entries[0].wildcards, \
                     sw.sw_features.actions, \
                     sw.valid_ports, \
                     sw.valid_queues \
@@ -1805,7 +1805,7 @@
                         )
 
         num_flows = 0
-        for ts in sw.tbl_stats.stats:
+        for ts in sw.tbl_stats.entries:
             num_flows = num_flows + ts.max_entries
 
         logging.info("Switch capacity is %d flows" % (num_flows))        
@@ -1850,7 +1850,7 @@
             fc = Flow_Cfg()
             fc.rand(fi, \
                     required_wildcards(self), \
-                    sw.tbl_stats.stats[0].wildcards, \
+                    sw.tbl_stats.entries[0].wildcards, \
                     sw.sw_features.actions, \
                     sw.valid_ports, \
                     sw.valid_queues \
@@ -1946,7 +1946,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
@@ -2068,7 +2068,7 @@
         while True:
             fc.rand(fi, \
                     required_wildcards(self), \
-                    sw.tbl_stats.stats[0].wildcards, \
+                    sw.tbl_stats.entries[0].wildcards, \
                     sw.sw_features.actions, \
                     sw.valid_ports, \
                     sw.valid_queues \
@@ -2193,7 +2193,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
@@ -2469,7 +2469,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
@@ -2561,7 +2561,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
@@ -2676,7 +2676,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
@@ -2955,7 +2955,7 @@
         fc = Flow_Cfg()
         fc.rand(fi, \
                 required_wildcards(self), \
-                sw.tbl_stats.stats[0].wildcards, \
+                sw.tbl_stats.entries[0].wildcards, \
                 sw.sw_features.actions, \
                 sw.valid_ports, \
                 sw.valid_queues \
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index 8520638..a1cadd5 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -84,9 +84,9 @@
                                                      timeout=test_timeout)
             self.assertTrue(response is not None, 
                             "No response to stats request")
-            self.assertTrue(len(response.stats) == 1,
+            self.assertTrue(len(response.entries) == 1,
                             "Did not receive flow stats reply")
-            for obj in response.stats:
+            for obj in response.entries:
                 # TODO: pad1 and pad2 fields may be nonzero, is this a bug?
                 # for now, just clear them so the assert is simpler
                 obj.match.pad1 = 0
@@ -202,7 +202,7 @@
 
     def sumStatsReplyCounts(self, response):
         total_packets = 0
-        for obj in response.stats:
+        for obj in response.entries:
             # TODO: pad1 and pad2 fields may be nonzero, is this a bug?
             # for now, just clear them so the assert is simpler
             #obj.match.pad1 = 0
@@ -339,9 +339,9 @@
                                                      timeout=test_timeout)
             self.assertTrue(response is not None, 
                             "No response to stats request")
-            self.assertTrue(len(response.stats) == 1, 
+            self.assertTrue(len(response.entries) == 1, 
                             "Did not receive flow stats reply")
-            for obj in response.stats:
+            for obj in response.entries:
                 self.assertTrue(obj.flow_count == flow_count,
                                 "Flow count " + str(obj.flow_count) +
                                 " does not match expected " + str(flow_count))
@@ -421,7 +421,7 @@
         response, pkt = self.controller.transact(stat_req)
         self.assertTrue(response is not None,
                         "No response to stats request")
-        self.assertEquals(len(response.stats), 0)
+        self.assertEquals(len(response.entries), 0)
         self.assertEquals(response.flags, 0)
 
 class EmptyAggregateStats(base_tests.SimpleDataPlane):
@@ -441,11 +441,11 @@
         response, pkt = self.controller.transact(stat_req)
         self.assertTrue(response is not None,
                         "No response to stats request")
-        self.assertTrue(len(response.stats) == 1,
+        self.assertTrue(len(response.entries) == 1,
                         "Did not receive flow stats reply")
-        self.assertEquals(response.stats[0].flow_count, 0)
-        self.assertEquals(response.stats[0].packet_count, 0)
-        self.assertEquals(response.stats[0].byte_count, 0)
+        self.assertEquals(response.entries[0].flow_count, 0)
+        self.assertEquals(response.entries[0].packet_count, 0)
+        self.assertEquals(response.entries[0].byte_count, 0)
 
 class DeletedFlowStats(base_tests.SimpleDataPlane):
     """
diff --git a/tests/load.py b/tests/load.py
index 7179914..3b72f72 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -203,7 +203,7 @@
 
         # Some switches report an extremely high max_entries that would cause
         # us to run out of memory attempting to create all the flow-mods.
-        num_flows = min(msg.stats[0].max_entries, 32678)
+        num_flows = min(msg.entries[0].max_entries, 32678)
 
         logging.info("Creating %d flow-mods messages", num_flows)
 
diff --git a/tests/message_types.py b/tests/message_types.py
index a7f7447..07e3e29 100644
--- a/tests/message_types.py
+++ b/tests/message_types.py
@@ -683,7 +683,7 @@
         serial_num = ""
         dp_decription = ""
 
-        for stats in response.stats:
+        for stats in response.entries:
 
             mfr_desc += stats.mfr_desc
             hw_desc += stats.hw_desc
diff --git a/tests/pktact.py b/tests/pktact.py
index b43c7f6..457d652 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -223,7 +223,7 @@
 
     def portQueuesGet(self, queue_stats, port_num):
         result = []
-        for qs in queue_stats.stats:
+        for qs in queue_stats.entries:
             if qs.port_no != port_num:
                 continue
             result.append(qs.queue_id)
@@ -322,8 +322,8 @@
                 # Make sure that tx packet counter for selected egress queue was
                 # incremented
 
-                self.assertEqual(qs_after.stats[0].tx_packets, \
-                                 qs_before.stats[0].tx_packets + 1, \
+                self.assertEqual(qs_after.entries[0].tx_packets, \
+                                 qs_before.entries[0].tx_packets + 1, \
                                  "Verification of egress queue tx packet count failed"
                                  )
                     
@@ -345,7 +345,7 @@
 
     def portQueuesGet(self, queue_stats, port_num):
         result = []
-        for qs in queue_stats.stats:
+        for qs in queue_stats.entries:
             if qs.port_no != port_num:
                 continue
             result.append(qs.queue_id)
@@ -461,8 +461,8 @@
                 # Make sure that tx packet counter for selected egress queue was
                 # incremented
 
-                self.assertEqual(qs_after.stats[0].tx_packets, \
-                                 qs_before.stats[0].tx_packets + 1, \
+                self.assertEqual(qs_after.entries[0].tx_packets, \
+                                 qs_before.entries[0].tx_packets + 1, \
                                  "Verification of egress queue tx packet count failed"
                                  )
                     
diff --git a/tests/port_stats.py b/tests/port_stats.py
index c4eb1a6..1df27f6 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -67,9 +67,9 @@
     response, pkt = obj.controller.transact(stat_req, timeout=2)
     obj.assertTrue(response is not None, 
                     "No response to stats request")
-    obj.assertTrue(len(response.stats) == 1,
+    obj.assertTrue(len(response.entries) == 1,
                     "Did not receive port stats reply")
-    for item in response.stats:
+    for item in response.entries:
         logging.info("Sent " + str(item.tx_packets) + " packets")
         packet_sent = item.tx_packets
         packet_recv = item.rx_packets
@@ -84,10 +84,10 @@
     response, pkt = obj.controller.transact(stat_req, timeout=2)
     obj.assertTrue(response is not None, 
                     "No response to stats request")
-    obj.assertTrue(len(response.stats) >= 3,
+    obj.assertTrue(len(response.entries) >= 3,
                     "Did not receive all port stats reply")
     stats = {}
-    for item in response.stats:
+    for item in response.entries:
         stats[ item.port_no ] = ( item.tx_packets, item.rx_packets )
     return stats
 
@@ -104,9 +104,9 @@
                                                 timeout=test_timeout)
         obj.assertTrue(response is not None, 
                        "No response to stats request")
-        obj.assertTrue(len(response.stats) == 1,
+        obj.assertTrue(len(response.entries) == 1,
                        "Did not receive port stats reply")
-        for item in response.stats:
+        for item in response.entries:
             sent = item.tx_packets
             recv = item.rx_packets
             logging.info("Sent " + str(item.tx_packets) + " packets")
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index 5d771e3..9fc3851 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -605,13 +605,13 @@
         self.header.type = OFPT_STATS_REPLY
         self.type = --STATS_NAME--
         # stats: Array of type --TYPE--_stats_entry
-        self.stats = []
+        self.entries = []
 
     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:
+        for obj in self.entries:
             packed += obj.pack()
         return packed
 
@@ -622,14 +622,14 @@
         while len(binary_string) >= len(dummy):
             obj = --TYPE--_stats_entry()
             binary_string = obj.unpack(binary_string)
-            self.stats.append(obj)
+            self.entries.append(obj)
         if len(binary_string) != 0:
             print "ERROR unpacking --TYPE-- stats string: extra bytes"
         return binary_string
 
     def __len__(self):
         length = len(self.header) + OFP_STATS_REPLY_BYTES
-        for obj in self.stats:
+        for obj in self.entries:
             length += len(obj)
         return length
 
@@ -638,8 +638,8 @@
         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 += prefix + "Stats array of length " + str(len(self.entries)) + '\\n'
+        for obj in self.entries:
             outstr += obj.show()
         return outstr
 
@@ -647,7 +647,7 @@
         if type(self) != type(other): return False
         return (self.header == other.header and
                 ofp_stats_reply.__eq__(self, other) and
-                self.stats == other.stats)
+                self.entries == other.entries)
 
     def __ne__(self, other): return not self.__eq__(other)
 """
