Public bug reported: netaddr 1.0.0 changed the default parsing mode from INET_ATON to INET_PTON[1]. This was initially added to netaddr.IPAddress and then later was applied to netaddr.IPNetwork in 1.1.0 [2]
While we attempted to bump netaddr to 1.0.1, we noticed this change broke some of the unit tests in neutron. https://zuul.opendev.org/t/openstack/build/8cfad48dcfb84be893fe78a1f965c5e6 (example) ``` neutron.tests.unit.agent.l3.extensions.test_ndp_proxy.NDPProxyExtensionDVRTestCase.test__get_snat_idx_ipv4 ---------------------------------------------------------------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 346, in __init__ self._value = self._module.str_to_int(addr, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/strategy/ipv4.py", line 120, in str_to_int raise error netaddr.core.AddrFormatError: '101.12.13.00' is not a valid IPv4 address string! During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 1019, in __init__ value, prefixlen = parse_ip_network(module, addr, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 899, in parse_ip_network ip = IPAddress(val1, module.version, flags=INET_PTON) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 348, in __init__ raise AddrFormatError( netaddr.core.AddrFormatError: base address '101.12.13.00' is not IPv4 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 178, in func return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 178, in func return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/unit/agent/l3/test_dvr_local_router.py", line 549, in test__get_snat_idx_ipv4 snat_idx = ri._get_snat_idx(ip_cidr) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/agent/l3/dvr_local_router.py", line 412, in _get_snat_idx net = netaddr.IPNetwork(ip_cidr) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 1028, in __init__ raise AddrFormatError('invalid IPNetwork %s' % (addr,)) netaddr.core.AddrFormatError: invalid IPNetwork 101.12.13.00/24 ``` An "easy" fix is adding flags=INET_ATON to all places. (note that INET_ATON was added in netaddr 0.10.0) but I'd like to ask someone from the neutron team to look into this and check whether we really have to use INET_ATON or fix unit test side to apply the more strict rule. [1] https://netaddr.readthedocs.io/en/latest/changes.html#release-1-0-0 [2] https://netaddr.readthedocs.io/en/latest/changes.html#release-1-1-0 ** Affects: neutron Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/2054203 Title: Default flag change in netaddr breaks (at least) unit tests Status in neutron: New Bug description: netaddr 1.0.0 changed the default parsing mode from INET_ATON to INET_PTON[1]. This was initially added to netaddr.IPAddress and then later was applied to netaddr.IPNetwork in 1.1.0 [2] While we attempted to bump netaddr to 1.0.1, we noticed this change broke some of the unit tests in neutron. https://zuul.opendev.org/t/openstack/build/8cfad48dcfb84be893fe78a1f965c5e6 (example) ``` neutron.tests.unit.agent.l3.extensions.test_ndp_proxy.NDPProxyExtensionDVRTestCase.test__get_snat_idx_ipv4 ---------------------------------------------------------------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 346, in __init__ self._value = self._module.str_to_int(addr, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/strategy/ipv4.py", line 120, in str_to_int raise error netaddr.core.AddrFormatError: '101.12.13.00' is not a valid IPv4 address string! During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 1019, in __init__ value, prefixlen = parse_ip_network(module, addr, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 899, in parse_ip_network ip = IPAddress(val1, module.version, flags=INET_PTON) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 348, in __init__ raise AddrFormatError( netaddr.core.AddrFormatError: base address '101.12.13.00' is not IPv4 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 178, in func return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 178, in func return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/unit/agent/l3/test_dvr_local_router.py", line 549, in test__get_snat_idx_ipv4 snat_idx = ri._get_snat_idx(ip_cidr) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/neutron/agent/l3/dvr_local_router.py", line 412, in _get_snat_idx net = netaddr.IPNetwork(ip_cidr) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/zuul/src/opendev.org/openstack/neutron/.tox/py311/lib/python3.11/site-packages/netaddr/ip/__init__.py", line 1028, in __init__ raise AddrFormatError('invalid IPNetwork %s' % (addr,)) netaddr.core.AddrFormatError: invalid IPNetwork 101.12.13.00/24 ``` An "easy" fix is adding flags=INET_ATON to all places. (note that INET_ATON was added in netaddr 0.10.0) but I'd like to ask someone from the neutron team to look into this and check whether we really have to use INET_ATON or fix unit test side to apply the more strict rule. [1] https://netaddr.readthedocs.io/en/latest/changes.html#release-1-0-0 [2] https://netaddr.readthedocs.io/en/latest/changes.html#release-1-1-0 To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/2054203/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp