From 50fd545ee8d40f70c9b2b680360c4a2e1b9e95b7 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 31 May 2021 11:41:04 +0000 Subject: [PATCH] Remove leading zeroes from an IP address In python3.9, ipaddress.IPv4Interface does not support defining an IP address with leading zeroes. E.g.: >>> ipaddress.IPv4Interface('00.0.0.0/0') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/ipaddress.py", line 1390, in __init__ IPv4Address.__init__(self, addr) File "/usr/lib/python3.9/ipaddress.py", line 1307, in __init__ self._ip = self._ip_int_from_string(addr_str) File "/usr/lib/python3.9/ipaddress.py", line 1199, in _ip_int_from_string raise AddressValueError("%s in %r" % (exc, ip_str)) from None ipaddress.AddressValueError: Leading zeros are not permitted in '00' in '00.0.0.0' Change-Id: I29137b22c158e979e81be9e41464948aa99f5498 Closes-Bug: #1930222 (cherry picked from commit b141aed51296fd6564ccce18f907dc1913a4bc5b) --- neutron/tests/unit/services/metering/test_metering_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/tests/unit/services/metering/test_metering_plugin.py b/neutron/tests/unit/services/metering/test_metering_plugin.py index f430c5894ac..97a84bebc8c 100644 --- a/neutron/tests/unit/services/metering/test_metering_plugin.py +++ b/neutron/tests/unit/services/metering/test_metering_plugin.py @@ -476,7 +476,7 @@ class TestMeteringPlugin(test_db_base_plugin_v2.NeutronDbPluginV2TestCase, 'id': self.uuid}] ip_prefixes = {'source_ip_prefix': '10.0.0.0/24', - 'destination_ip_prefix': '00.0.0.0/0'} + 'destination_ip_prefix': '0.0.0.0/0'} with self.router(tenant_id=self.tenant_id, set_context=True): with self.metering_label(tenant_id=self.tenant_id, set_context=True) as label: