[ovs-dev] [PATCH v1 02/18] python: add mask, ip and eth decoders
tredaelli at redhat.com
Mon Nov 22 13:07:54 UTC 2021
On Mon, 22 Nov 2021 12:22:40 +0100
Adrian Moreno <amorenoz at redhat.com> wrote:
> Add more decoders that can be used by KVParser.
> For IPv4 and IPv6 addresses, create a new class that wraps
> For Ethernet addresses, create a new class that wraps netaddr.EUI.
> For Integers, create a new class that performs basic bitwise mask
> Signed-off-by: Adrian Moreno <amorenoz at redhat.com>
> python/ovs/flows/decoders.py | 341 +++++++++++++++++++++++++++++++++++
> python/setup.py | 2 +-
> 2 files changed, 342 insertions(+), 1 deletion(-)
> diff --git a/python/ovs/flows/decoders.py b/python/ovs/flows/decoders.py
> index bfb64e70e..bf7a94ae8 100644
> --- a/python/ovs/flows/decoders.py
> +++ b/python/ovs/flows/decoders.py
> @@ -5,6 +5,15 @@ A decoder is generally a callable that accepts a string and returns the value
> +import netaddr
> +class Decoder:
> + """Base class for all decoder classes"""
> + def to_json(self):
> + assert "function must be implemented by derived class"
I think it's better to use "raise NotImplementedError" here
More information about the dev