On Wed, 19 Feb 2014 21:10:57 +0900 (JST)
FUJITA Tomonori <[email protected]> wrote:

> 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.
> 
> okay, how about the following?
> 
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index 39864d2..4fbc29a 100644
> --- a/ryu/ofproto/ofproto_v1_3_parser.py
> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
> @@ -3159,19 +3159,28 @@ 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 = ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
> +        if self.data:
> +            assert (len(data) % 8) == 0
> +            self.len += len(data)
>  
>      @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

Applied.

------------------------------------------------------------------------------
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