On 6/27/22 13:33, Ilya Maximets wrote:
On 6/27/22 13:25, Ilya Maximets wrote:
On 6/16/22 08:32, Adrian Moreno 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

Acked-by: Eelco Chaudron <echau...@redhat.com>
Signed-off-by: Adrian Moreno <amore...@redhat.com>
---
  python/ovs/flow/decoders.py | 398 ++++++++++++++++++++++++++++++++++++
  python/setup.py             |   2 +-
  2 files changed, 399 insertions(+), 1 deletion(-)

diff --git a/python/ovs/flow/decoders.py b/python/ovs/flow/decoders.py
index 0c2259c76..883e61acf 100644
--- a/python/ovs/flow/decoders.py
+++ b/python/ovs/flow/decoders.py
@@ -5,6 +5,15 @@ A decoder is generally a callable that accepts a string and 
returns the value
  object.
  """
+import netaddr

<snip>

diff --git a/python/setup.py b/python/setup.py
index 7ac3c3662..350ac6056 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -87,7 +87,7 @@ setup_args = dict(
      ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
                                        libraries=['openvswitch'])],
      cmdclass={'build_ext': try_build_ext},
-    install_requires=['sortedcontainers'],
+    install_requires=['sortedcontainers', 'netaddr'],
      extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0']},
  )

So, the 'netaddr' is not a test dependency, but a new global dependency.
The tests are failing on patches #11 and #12 for that reason (unable to
import netaddr), it will be installed as a test dependency in patch #13.

We have 2 options here:

1.
   - Document the new global dependency in installation docs.
   - Install python3-netaddr explicitly in CI scripts.
   - Update fedora spec and debian/control with a build dependency and
     runtime dependency for a python package.

2.
   - Make it an optional dependency, by adding to extras_require and
     providing a meaningful error on attempt to import ovs.flow if
     netaddr is not available instead of throwing an import error.
   - Skip python part of tests in patches #11 and #12 if ovs.flow
     import fails. (try/catch + exit(0) in test scripts ?)
   - Document optional dependency for a flow library and update packaging
     with 'Suggests' section for pytohn3-netaddr.

- Install python3-netaddr explicitly in CI scripts (GHA and CirrusCI).

Needed for that option too.
 >>
The second option seems better to me as it doesn't force users to install
python3-netaddr if they don't want to parse OVS flows in python.
What do you think?


Thanks Ilya,

I'll implement option 2 and send another version.

Best regards, Ilya Maximets.


--
Adrián Moreno

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to