loxi-prep: rename stats reply 'stats' field to 'entries' to match PyLoxi
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)
"""