OFPStatsReply parser_stats_body_array needs body classes to have
length field.

Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/ofproto/ofproto_v1_0_parser.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_0_parser.py 
b/ryu/ofproto/ofproto_v1_0_parser.py
index 0ac5abc..f55e55f 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -749,7 +749,9 @@ class 
OFPAggregateStats(collections.namedtuple('OFPAggregateStats',
     def parser(cls, buf, offset):
         agg = struct.unpack_from(
             ofproto_v1_0.OFP_AGGREGATE_STATS_REPLY_PACK_STR, buf, offset)
-        return cls(*agg)
+        stats = cls(*agg)
+        stats.length = ofproto_v1_0.OFP_AGGREGATE_STATS_REPLY_SIZE
+        return stats
 
 
 class OFPTableStats(collections.namedtuple('OFPTableStats',
@@ -759,7 +761,9 @@ class OFPTableStats(collections.namedtuple('OFPTableStats',
     def parser(cls, buf, offset):
         tbl = struct.unpack_from(ofproto_v1_0.OFP_TABLE_STATS_PACK_STR,
                                  buf, offset)
-        return cls(*tbl)
+        stats = cls(*tbl) 
+        stats.length = ofproto_v1_0.OFP_TABLE_STATS_SIZE
+        return stats
 
 
 class OFPPortStats(collections.namedtuple('OFPPortStats',
@@ -770,7 +774,9 @@ class OFPPortStats(collections.namedtuple('OFPPortStats',
     def parser(cls, buf, offset):
         port = struct.unpack_from(ofproto_v1_0.OFP_PORT_STATS_PACK_STR,
                                   buf, offset)
-        return cls(*port)
+        stats = cls(*port)
+        stats.length = ofproto_v1_0.OFP_PORT_STATS_SIZE
+        return stats
 
 
 class OFPQueueStats(collections.namedtuple('OFPQueueStats',
@@ -779,7 +785,9 @@ class OFPQueueStats(collections.namedtuple('OFPQueueStats',
     def parser(cls, buf, offset):
         queue = struct.unpack_from(ofproto_v1_0.OFP_QUEUE_STATS_PACK_STR,
                                    buf, offset)
-        return cls(*queue)
+        stats = cls(*queue)
+        stats.length = ofproto_v1_0.OFP_QUEUE_STATS_SIZE
+        return stats
 
 
 class OFPVendorStats(collections.namedtuple('OFPVendorStats',
-- 
1.7.4.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to