On Mon, 17 Feb 2014 02:25:55 -0500
Rob Udechukwu <[email protected]> wrote:

> Sorry for the delay. Thanks for the help, the only modifications I had to 
> make to the code was within the init() and the serialize() function. 
> - init() - I am ensuring data’s length is a multiple of 8 as specified in 1.3
> - serialize() - Removed the self.buf for just but
> 
> Code listed below.

Thanks! I converted this to a patch. I'll apply this if it works for
you.

=
From b7b9ed72b9c51e7495f7a36032dcc1fa89a65110 Mon Sep 17 00:00:00 2001
From: Rob Udechukwu <[email protected]>
Date: Tue, 18 Feb 2014 22:35:31 +0900
Subject: [PATCH] of13: support OFPAactionExperimenter with data

Signed-off-by: Rob Udechukwu <[email protected]>
Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/ofproto/ofproto_v1_3_parser.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index 39864d2..06addda 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -3159,19 +3159,26 @@ class OFPActionExperimenter(OFPAction):
     experimenter     Experimenter ID
     ================ ======================================================
     """
-    def __init__(self, experimenter, type_=None, len_=None):
+    def __init__(self, experimenter, data=None, type_=None, len_=None):
         super(OFPActionExperimenter, self).__init__()
         self.experimenter = experimenter
+        self.data = data
+        self.len = (utils.round_up(len(data), 8) +
+                    ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)
 
     @classmethod
     def parser(cls, buf, offset):
         (type_, len_, experimenter) = struct.unpack_from(
             ofproto.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR, buf, offset)
-        return cls(experimenter)
+        data = buf[(offset + ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
+                    ): offset + len_]
+        return cls(experimenter, data)
 
     def serialize(self, buf, offset):
         msg_pack_into(ofproto.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR,
                       buf, offset, self.type, self.len, self.experimenter)
+        if self.data:
+            buf += self.data
 
 
 class OFPBucket(StringifyMixin):
-- 
1.8.3.4 (Apple Git-47)

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to