On Thu, 12 Feb 2015 20:01:45 +0100
Tobias Jungel <[email protected]> wrote:

> In case one of the kwargs is set to None the ofproto parsers for
> versions 1.2, 1.3 and 1.4 fail. This patch skips k,v pairs having set v
> to None.

Why does an user need to pass an arugment set to None?

> Signed-off-by: Tobias Jungel <[email protected]>
> ---
>  ryu/ofproto/ofproto_v1_2_parser.py | 4 ++--
>  ryu/ofproto/ofproto_v1_3_parser.py | 4 ++--
>  ryu/ofproto/ofproto_v1_4_parser.py | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
> b/ryu/ofproto/ofproto_v1_2_parser.py
> index 20f3b57..e96614a 100644
> --- a/ryu/ofproto/ofproto_v1_2_parser.py
> +++ b/ryu/ofproto/ofproto_v1_2_parser.py
> @@ -3395,9 +3395,9 @@ class OFPMatch(StringifyMixin):
>              #   OFPMatch(eth_src=('ff:ff:ff:00:00:00'), eth_type=0x800,
>              #            ipv4_src='10.0.0.1')
>              kwargs = dict(ofproto.oxm_normalize_user(k, v) for
> -                          (k, v) in kwargs.iteritems())
> +                          (k, v) in kwargs.iteritems() if v is not None)
>              fields = [ofproto.oxm_from_user(k, v) for (k, v)
> -                      in kwargs.iteritems()]
> +                      in kwargs.iteritems() if v is not None]
>              # assumption: sorting by OXM type values makes fields
>              # meet ordering requirements (eg. eth_type before ipv4_src)
>              fields.sort()
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index e9b4b29..5e35612 100644
> --- a/ryu/ofproto/ofproto_v1_3_parser.py
> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
> @@ -828,9 +828,9 @@ class OFPMatch(StringifyMixin):
>              #   OFPMatch(eth_src=('ff:ff:ff:00:00:00'), eth_type=0x800,
>              #            ipv4_src='10.0.0.1')
>              kwargs = dict(ofproto.oxm_normalize_user(k, v) for
> -                          (k, v) in kwargs.iteritems())
> +                          (k, v) in kwargs.iteritems() if v is not None)
>              fields = [ofproto.oxm_from_user(k, v) for (k, v)
> -                      in kwargs.iteritems()]
> +                      in kwargs.iteritems() if v is not None]
>              # assumption: sorting by OXM type values makes fields
>              # meet ordering requirements (eg. eth_type before ipv4_src)
>              fields.sort()
> diff --git a/ryu/ofproto/ofproto_v1_4_parser.py 
> b/ryu/ofproto/ofproto_v1_4_parser.py
> index 1363908..d61435b 100644
> --- a/ryu/ofproto/ofproto_v1_4_parser.py
> +++ b/ryu/ofproto/ofproto_v1_4_parser.py
> @@ -714,9 +714,9 @@ class OFPMatch(StringifyMixin):
>              self._fields2 = _ordered_fields
>          else:
>              kwargs = dict(ofproto.oxm_normalize_user(k, v) for
> -                          (k, v) in kwargs.iteritems())
> +                          (k, v) in kwargs.iteritems() if v is not None)
>              fields = [ofproto.oxm_from_user(k, v) for (k, v)
> -                      in kwargs.iteritems()]
> +                      in kwargs.iteritems() if v is not None]
>              # assumption: sorting by OXM type values makes fields
>              # meet ordering requirements (eg. eth_type before ipv4_src)
>              fields.sort()
> -- 
> 2.1.0
> 
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to