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.
@OFPAction.register_action_type(
ofproto_v1_3.OFPAT_EXPERIMENTER,
ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)
class OFPActionExperimenter(OFPAction):
def __init__(self, experimenter, data=None, type_=None, len_=None):
super(OFPActionExperimenter, self).__init__()
self.experimenter = experimenter
self.data = data
len_ = utils.round_up(len(data), 8)
self.len = len_ + ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
#self.len = len(data) + ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
@classmethod
def parser(cls, buf, offset):
(type_, len_, experimenter) = struct.unpack_from(
ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR, buf, offset)
return cls(experimenter)
data = buf[(offset + ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE):
(offset + len_)]
return cls(experimenter, data)
def serialize(self, buf, offset):
msg_pack_into(ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR,
buf, offset, self.type, self.len, self.experimenter)
if self.data:
buf += self.data
#self.buf += self.data
----
Robinson N. Udechukwu
North Carolina State University Alumnus
Computer Science
2012 GEM Fellow
Certifications: A+, Net+, CCNA
On Jan 27, 2014, at 11:05 AM, FUJITA Tomonori <[email protected]>
wrote:
> On Sun, 26 Jan 2014 02:22:54 -0500
> Rob Udechukwu <[email protected]> wrote:
>
>> I have a question on whether there is a way to send data along with
>> the experimenter ID within Ryu's OFPActionExperimenter()
>> message. LINC's OpenFlow protocol hints at data
>> (https://github.com/FlowForwarding/of_protocol/blob/master/include/ofp_v4.hrl#L492),
>> which is why I asking.
>
> There is no easy way to do such. The following works (not tested) for
> you? With this, you can do something like:
>
> OFPActionExperimenter(experimenter=10, data=data)
>
>
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index 8b4a6bc..e67b321 100644
> --- a/ryu/ofproto/ofproto_v1_3_parser.py
> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
> @@ -3128,19 +3128,25 @@ 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 = len(data) +
> ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
>
> @classmethod
> def parser(cls, buf, offset):
> (type_, len_, experimenter) = struct.unpack_from(
> ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR, buf, offset)
> - return cls(experimenter)
> + data = buf[(offset +
> ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE):
> + (offset + len_)]
> + return cls(experimenter, data)
>
> def serialize(self, buf, offset):
> msg_pack_into(ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR,
> buf, offset, self.type, self.len, self.experimenter)
> + if self.data:
> + self.buf += self.data
>
>
> class OFPBucket(StringifyMixin):
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel