This will be used by support for messages that have buckets
Signed-off-by: Simon Horman <[email protected]>
---
ryu/ofproto/ofproto_v1_4_parser.py | 39 ++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py
b/ryu/ofproto/ofproto_v1_4_parser.py
index 2365f50..e09b83e 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -3258,6 +3258,45 @@ class OFPActionPopPbb(OFPAction):
return cls()
+class OFPBucket(StringifyMixin):
+ def __init__(self, weight, watch_port, watch_group, actions, len_=None):
+ super(OFPBucket, self).__init__()
+ self.weight = weight
+ self.watch_port = watch_port
+ self.watch_group = watch_group
+ self.actions = actions
+
+ @classmethod
+ def parser(cls, buf, offset):
+ (len_, weight, watch_port, watch_group) = struct.unpack_from(
+ ofproto.OFP_BUCKET_PACK_STR, buf, offset)
+ msg = cls(weight, watch_port, watch_group, [])
+ msg.len = len_
+
+ length = ofproto.OFP_BUCKET_SIZE
+ offset += ofproto.OFP_BUCKET_SIZE
+ while length < msg.len:
+ action = OFPAction.parser(buf, offset)
+ msg.actions.append(action)
+ offset += action.len
+ length += action.len
+
+ return msg
+
+ def serialize(self, buf, offset):
+ action_offset = offset + ofproto.OFP_BUCKET_SIZE
+ action_len = 0
+ for a in self.actions:
+ a.serialize(buf, action_offset)
+ action_offset += a.len
+ action_len += a.len
+
+ self.len = utils.round_up(ofproto.OFP_BUCKET_SIZE + action_len, 8)
+ msg_pack_into(ofproto.OFP_BUCKET_PACK_STR, buf, offset,
+ self.len, self.weight, self.watch_port,
+ self.watch_group)
+
+
@_set_msg_type(ofproto.OFPT_ROLE_REQUEST)
class OFPRoleRequest(MsgBase):
"""
--
1.8.5.2
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel