Signed-off-by: WATANABE Fumitaka <watanabe.fumit...@nttcom.co.jp>
---
 ryu/ofproto/ofproto_v1_3_parser.py                            |    9 +++++----
 .../ofproto/json/of13/4-50-ofp_meter_stats_reply.packet.json  |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index bd71fe1..02ba8fc 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -3448,7 +3448,7 @@ class OFPMultipartReply(MsgBase):
         while offset < msg_len:
             b = stats_type_cls.cls_stats_body_cls.parser(msg.buf, offset)
             body.append(b)
-            offset += b.length
+            offset += b.length if hasattr(b, 'length') else b.len

         if stats_type_cls.cls_body_single_struct:
             msg.body = body[0]
@@ -4327,9 +4327,10 @@ class OFPMeterBandStats(StringifyMixin):
 class OFPMeterStats(StringifyMixin):
     def __init__(self, meter_id=None, flow_count=None, packet_in_count=None,
                  byte_in_count=None, duration_sec=None, duration_nsec=None,
-                 band_stats=None, length=None):
+                 band_stats=None, len_=None):
         super(OFPMeterStats, self).__init__()
         self.meter_id = meter_id
+        self.len = 0
         self.flow_count = flow_count
         self.packet_in_count = packet_in_count
         self.byte_in_count = byte_in_count
@@ -4341,7 +4342,7 @@ class OFPMeterStats(StringifyMixin):
     def parser(cls, buf, offset):
         meter_stats = cls()

-        (meter_stats.meter_id, meter_stats.length,
+        (meter_stats.meter_id, meter_stats.len,
          meter_stats.flow_count, meter_stats.packet_in_count,
          meter_stats.byte_in_count, meter_stats.duration_sec,
          meter_stats.duration_nsec) = struct.unpack_from(
@@ -4350,7 +4351,7 @@ class OFPMeterStats(StringifyMixin):

         meter_stats.band_stats = []
         length = ofproto_v1_3.OFP_METER_STATS_SIZE
-        while length < meter_stats.length:
+        while length < meter_stats.len:
             band_stats = OFPMeterBandStats.parser(buf, offset)
             meter_stats.band_stats.append(band_stats)
             offset += ofproto_v1_3.OFP_METER_BAND_STATS_SIZE
diff --git 
a/ryu/tests/unit/ofproto/json/of13/4-50-ofp_meter_stats_reply.packet.json 
b/ryu/tests/unit/ofproto/json/of13/4-50-ofp_meter_stats_reply.packet.json
index 73b37f9..b4fd822 100644
--- a/ryu/tests/unit/ofproto/json/of13/4-50-ofp_meter_stats_reply.packet.json
+++ b/ryu/tests/unit/ofproto/json/of13/4-50-ofp_meter_stats_reply.packet.json
@@ -15,7 +15,7 @@
                "duration_nsec": 480000,
                "duration_sec": 0,
                "flow_count": 0,
-               "length": 56,
+               "len": 56,
                "meter_id": 100,
                "packet_in_count": 0
             }
-- 1.7.10.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to