Signed-off-by: Simon Horman <ho...@verge.net.au>

---
v4
* Inherit MsgInMsgBase instead of MsgBase
  - This is a new mechanism to allow messages inside messages

v3
* No change

v2
* First post
---
 ryu/ofproto/ofproto_v1_4_parser.py | 48 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/ryu/ofproto/ofproto_v1_4_parser.py 
b/ryu/ofproto/ofproto_v1_4_parser.py
index 49da0ec..013cd9a 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -4481,6 +4481,54 @@ class OFPTableStatus(MsgBase):
         return msg
 
 
+@_set_msg_type(ofproto.OFPT_REQUESTFORWARD)
+class OFPRequestForward(MsgInMsgBase):
+    """
+    Forwarded request message
+
+    The swtich forwards request messages from one controller to other
+    controllers.
+
+    ================ ======================================================
+    Attribute        Description
+    ================ ======================================================
+    request          ``OFPGroupMod`` or ``OFPMeterMod`` instance
+    ================ ======================================================
+
+    Example::
+
+        def send_bundle_add_message(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
+            msg = ofp_parser.OFPGroupMod(datapath, ofp.OFPGC_ADD,
+                                         ofp.OFPGT_SELECT, group_id, buckets)
+
+            req = ofp_parser.OFPRequestForward(datapath, msg)
+            datapath.send_msg(req)
+    """
+    def __init__(self, datapath, request):
+        super(OFPRequestForward, self).__init__(datapath)
+        assert(isinstance(request, OFPGroupMod) or
+               isinstance(request, OFPMeterMod))
+        self.request = request
+
+    def _serialize_body(self):
+        tail_buf = self.request.serialize()
+        self.buf += self.request.buf
+
+
 @_set_msg_type(ofproto.OFPT_PACKET_OUT)
 class OFPPacketOut(MsgBase):
     """
-- 
1.8.5.2


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to