On Mon, 27 Jan 2014 11:36:12 +0900
Simon Horman <[email protected]> wrote:
> On Sat, Jan 25, 2014 at 01:42:04PM +0900, FUJITA Tomonori wrote:
>> Fix the following:
>>
>> CLS <class 'ryu.ofproto.ofproto_v1_3_parser.OFPInstructionWriteMetadata'>
>> ARG {u'metadata_mask': 18446744073709551615L, u'type': 2, u'len': 24,
>> u'metadata': 18446744069414584320L}
>> KWARG {u'type_': 2, u'metadata_mask': 18446744073709551615L, u'len_': 24,
>> u'metadata': 18446744069414584320L}
>> Traceback (most recent call last):
>> File "a.py", line 19, in <module>
>> msg = ofproto_parser.ofp_msg_from_jsondict(dp, m)
>> File "/Users/fujita/git/ryu/ryu/ofproto/ofproto_parser.py", line 100, in
>> ofp_msg_from_jsondict
>> return cls.from_jsondict(v, datapath=dp)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 291, in
>> from_jsondict
>> kwargs = cls._restore_args(_mapdict_kv(decode, dict_))
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 46, in <lambda>
>> _mapdict_kv = lambda f, d: dict([(k, f(k, v)) for k, v in d.items()])
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 290, in <lambda>
>> decode = lambda k, x: cls._decode_value(k, x, decode_string)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 234, in
>> _decode_value
>> return cls._get_decoder(k, decode_string)(json_value)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 242, in _decode
>> v = map(_decode, json_value)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 245, in _decode
>> v = cls.obj_from_jsondict(json_value)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 223, in
>> obj_from_jsondict
>> return obj_cls.from_jsondict(v)
>> File "/Users/fujita/git/ryu/ryu/lib/stringify.py", line 293, in
>> from_jsondict
>> return cls(**dict(kwargs, **additional_args))
>> TypeError: __init__() got an unexpected keyword argument 'type_'
>>
>> Signed-off-by: FUJITA Tomonori <[email protected]>
>> ---
>> ryu/ofproto/ofproto_v1_3_parser.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
>> b/ryu/ofproto/ofproto_v1_3_parser.py
>> index 78ad9fc..8b4a6bc 100644
>> --- a/ryu/ofproto/ofproto_v1_3_parser.py
>> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
>> @@ -2464,7 +2464,7 @@ class OFPInstructionWriteMetadata(StringifyMixin):
>> metadata_mask Metadata write bitmask
>> ================ ======================================================
>> """
>> - def __init__(self, metadata, metadata_mask, len_=None):
>> + def __init__(self, metadata, metadata_mask, type_=None, len_=None):
>> super(OFPInstructionWriteMetadata, self).__init__()
>> self.type = ofproto_v1_3.OFPIT_WRITE_METADATA
>> self.len = ofproto_v1_3.OFP_INSTRUCTION_WRITE_METADATA_SIZE
>> --
>> 1.8.3.4 (Apple Git-47)
>
> Hi Fujita-san,
>
> this seems correct to me. But I wonder if a similar fix
> is also needed for OFPInstructionMeter.
Yeah, but this patch also need to remove _base_attributes. With
_base_attributes, you don't need type_ and len_ arguments.
Can you send a patch to add the type_ and len_ arguments, remove the
_base_attributes, and update the JSON format?
Thanks!
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index 78ad9fc..8794308 100644
> --- a/ryu/ofproto/ofproto_v1_3_parser.py
> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
> @@ -2560,7 +2560,7 @@ class OFPInstructionMeter(StringifyMixin):
> """
> _base_attributes = ['type', 'len']
>
> - def __init__(self, meter_id):
> + def __init__(self, meter_id, type_=None, len_=None):
> super(OFPInstructionMeter, self).__init__()
> self.type = ofproto_v1_3.OFPIT_METER
> self.len = ofproto_v1_3.OFP_INSTRUCTION_METER_SIZE
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel