Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/ofproto/ofproto_v1_2_parser.py |   45 +++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index 1f437d5..d5b8ac2 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -1305,17 +1305,45 @@ class OFPPacketQueue(object):
 
     @classmethod
     def parser(cls, buf, offset):
-        (msg.queue_id, msg.port, msg.len) = struct.unpack_from(
+        (queue_id, port, len_) = struct.unpack_from(
             ofproto_v1_2.OFP_PACKET_QUEUE_PACK_STR, buf, offset)
         length = ofproto_v1_2.OFP_PACKET_QUEUE_SIZE
         offset += ofproto_v1_2.OFP_PACKET_QUEUE_SIZE
-        msg.properties = []
-        while length < msg.len:
+        properties = []
+        while length < len_:
             queue_prop = OFPQueueProp.parser(buf, offset)
-            msg.properties.append(queue_prop)
+            properties.append(queue_prop)
             offset += queue_prop.len
-            length += queue_prop
-        return msg
+            length += queue_prop.len
+        return cls(queue_id, port, len_, properties)
+
+
[email protected]_property(ofproto_v1_2.OFPQT_MIN_RATE,
+                                ofproto_v1_2.OFP_QUEUE_PROP_MIN_RATE_SIZE)
+class OFPQueuePropMinRate(OFPQueueProp):
+    def __init__(self, rate):
+        super(OFPQueuePropMinRate, self).__init__()
+        self.rate = rate
+
+    @classmethod
+    def parser(cls, buf, offset):
+        (rate,) = struct.unpack_from(
+            ofproto_v1_2.OFP_QUEUE_PROP_MIN_RATE_PACK_STR, buf, offset)
+        return cls(rate)
+
+
[email protected]_property(ofproto_v1_2.OFPQT_MAX_RATE,
+                                ofproto_v1_2.OFP_QUEUE_PROP_MAX_RATE_SIZE)
+class OFPQueuePropMaxRate(OFPQueueProp):
+    def __init__(self, rate):
+        super(OFPQueuePropMaxRate, self).__init__()
+        self.rate = rate
+
+    @classmethod
+    def parser(cls, buf, offset):
+        (rate,) = struct.unpack_from(
+            ofproto_v1_2.OFP_QUEUE_PROP_MAX_RATE_PACK_STR, buf, offset)
+        return cls(rate)
 
 
 @_register_parser
@@ -1335,8 +1363,9 @@ class OFPQueueGetConfigReply(MsgBase):
 
         msg.queues = []
         length = ofproto_v1_2.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
-        while length < msg.length:
-            queue = OFPPacketQueue.parser(buf, offset)
+        offset = ofproto_v1_2.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
+        while length < msg.msg_len:
+            queue = OFPPacketQueue.parser(msg.buf, offset)
             msg.queues.append(queue)
 
             offset += queue.len
-- 
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