summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2014-02-20 13:08:50 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-02-26 23:53:10 +0900
commit7c96df602398e847c18679cc43c36cdbf37dbcc0 (patch)
treef2f6cd31ccdfee1659a80ff82971fa5b4016a958
parentd268e10bf6ab438e29b67724c8e2bec1f6c6196e (diff)
of14: Add OFPQueueDescProp
This may be used by queue desc request and reply messages Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_4_parser.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py
index e1961bf6..6cbcbfeb 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -926,6 +926,72 @@ class OFPTableModPropExperimenter(StringifyMixin):
return buf
+class OFPQueueDescProp(OFPPropBase):
+ _TYPES = {}
+
+
+@OFPQueueDescProp.register_type(ofproto.OFPQDPT_MIN_RATE)
+class OFPQueueDescPropMinRate(StringifyMixin):
+ def __init__(self, type_=None, length=None, rate=None):
+ self.type = type_
+ self.length = length
+ self.rate = rate
+
+ @classmethod
+ def parser(cls, buf):
+ minrate = cls()
+ (minrate.type, minrate.length, minrate.rate) = struct.unpack_from(
+ ofproto.OFP_QUEUE_DESC_PROP_MIN_RATE_PACK_STR, buf, 0)
+ return minrate
+
+
+@OFPQueueDescProp.register_type(ofproto.OFPQDPT_MAX_RATE)
+class OFPQueueDescPropMaxRate(StringifyMixin):
+ def __init__(self, type_=None, length=None, rate=None):
+ self.type = type_
+ self.length = length
+ self.rate = rate
+
+ @classmethod
+ def parser(cls, buf):
+ maxrate = cls()
+ (maxrate.type, maxrate.length, maxrate.rate) = struct.unpack_from(
+ ofproto.OFP_QUEUE_DESC_PROP_MAX_RATE_PACK_STR, buf, 0)
+ return maxrate
+
+
+@OFPQueueDescProp.register_type(ofproto.OFPQDPT_EXPERIMENTER)
+class OFPQueueDescPropExperimenter(StringifyMixin):
+ _DATA_ELEMENT_PACK_STR = '!I'
+
+ def __init__(self, type_=None, length=None, experimenter=None,
+ exp_type=None, data=None):
+ self.type = type_
+ self.length = length
+ self.experimenter = experimenter
+ self.exp_type = exp_type
+ self.data = data
+
+ @classmethod
+ def parser(cls, buf):
+ exp = cls()
+ (exp.type, exp.length, exp.experimenter,
+ exp.exp_type) = struct.unpack_from(
+ ofproto.OFP_QUEUE_DESC_PROP_EXPERIMENTER_PACK_STR, buf, 0)
+
+ # Parse trailing data, a list of 4-byte words
+ exp.data = []
+ pack_size = struct.calcsize(cls._DATA_ELEMENT_PACK_STR)
+ offset = ofproto.OFP_QUEUE_DESC_PROP_EXPERIMENTER_SIZE
+ while offset < exp.length:
+ (word,) = struct.unpack_from(cls._DATA_ELEMENT_PACK_STR,
+ buf, offset)
+ exp.data.append(word)
+ offset += pack_size
+
+ return exp
+
+
class OFPMatchField(StringifyMixin):
_FIELDS_HEADERS = {}