On 11/22/21 14:07, Timothy Redaelli wrote:
On Mon, 22 Nov 2021 12:22:40 +0100
Adrian Moreno <[email protected]> wrote:
Add more decoders that can be used by KVParser.
For IPv4 and IPv6 addresses, create a new class that wraps
netaddr.IPAddress.
For Ethernet addresses, create a new class that wraps netaddr.EUI.
For Integers, create a new class that performs basic bitwise mask
comparisons
Signed-off-by: Adrian Moreno <[email protected]>
---
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
object.
"""
+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
Ack, will do. Thanks.
--
Adrián Moreno
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev