diff options
author | Simon Horman <horms@verge.net.au> | 2014-01-29 12:06:20 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-01-29 12:43:55 +0900 |
commit | 2f36dd628fcd7d535cce83f52e2e09765d5ebbe5 (patch) | |
tree | 3ae2bd7849823400fe5384f33d8539b3fb1fd5b3 | |
parent | e59f9acc16d1157b02e0a4badbd9aed00633a798 (diff) |
Add OF1.4 group mod message supoort
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.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index c5443c48..0578c6e6 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -3472,6 +3472,70 @@ class OFPActionPopPbb(OFPAction): return cls() +@_set_msg_type(ofproto.OFPT_GROUP_MOD) +class OFPGroupMod(MsgBase): + """ + Modify group entry message + + The controller sends this message to modify the group table. + + ================ ====================================================== + Attribute Description + ================ ====================================================== + command One of the following values. + OFPFC_ADD + OFPFC_MODIFY + OFPFC_DELETE + type One of the following values. + OFPGT_ALL + OFPGT_SELECT + OFPGT_INDIRECT + OFPGT_FF + group_id Group identifier + buckets list of ``OFPBucket`` + ================ ====================================================== + + ``type`` attribute corresponds to ``type_`` parameter of __init__. + + Example:: + + def send_group_mod(self, datapath): + ofp = datapath.ofproto + ofp_parser = datapath.ofproto_parser + + port = 1 + max_len = 2000 + actions = [ofp_parser.OFPActionOutput(port, max_len)] + + weight = 100 + watch_port = 0 + watch_group = 0 + buckets = [ofp_parser.OFPBucket(weight, watch_port, watch_group, + actions)] + + group_id = 1 + req = ofp_parser.OFPGroupMod(datapath, ofp.OFPFC_ADD, + ofp.OFPGT_SELECT, group_id, buckets) + datapath.send_msg(req) + """ + def __init__(self, datapath, command, type_, group_id, buckets): + super(OFPGroupMod, self).__init__(datapath) + self.command = command + self.type = type_ + self.group_id = group_id + self.buckets = buckets + + def _serialize_body(self): + msg_pack_into(ofproto.OFP_GROUP_MOD_PACK_STR, self.buf, + ofproto.OFP_HEADER_SIZE, + self.command, self.type, self.group_id) + + offset = ofproto.OFP_GROUP_MOD_SIZE + for b in self.buckets: + b.serialize(self.buf, offset) + offset += b.len + + class OFPBucket(StringifyMixin): def __init__(self, weight, watch_port, watch_group, actions, len_=None): super(OFPBucket, self).__init__() |