> On Tue, 18 Feb 2014 22:52:38 +0900 (JST) > [email protected] (YAMAMOTO Takashi) wrote: > >>> 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) >> >> how about assert (len(data) % 8) == 0 ? >> i think it's what the spec says. > > Ah, we had better to add a padding to the data if the length is not > multiples of 8?
yes, my understanding of the spec is that the actual length of data should be a multiple of 8. automatic padding might confuse users as it breaks serialize/parse round-trip. i have no strong opinion about this, though. YAMAMOTO Takashi ------------------------------------------------------------------------------ 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
