From 2d67b68cc41e16914a2007ab3883a5c9995d1cd3 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Thu, 1 Sep 2016 16:49:59 -0400 Subject: [PATCH] Fix AddrFormatError in DHCPv6 lease release code A change that merged recently for DHCPv6 lease release did not have the correct format for the lease file in the unit test, so we started seeing these today from the functional tests: AddrFormatError: failed to detect a valid IP address from '[2003::2]' We have to strip the brackets from IPs read from the lease file. https://review.openstack.org/#/c/301747/ was the culprit. Closes-bug: 1619463 Change-Id: I0964fe9d00f8f3922041b12c352449e943b8f251 --- neutron/agent/linux/dhcp.py | 1 + neutron/tests/unit/agent/linux/test_dhcp.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index ea7871c654a..a7298a40d3d 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -771,6 +771,7 @@ class Dnsmasq(DhcpLocalProcess): continue parts = l.strip().split() (iaid, ip, client_id) = parts[1], parts[2], parts[4] + ip = ip.strip('[]') if netaddr.IPAddress(ip).version == constants.IP_VERSION_4: continue leases[ip] = {'iaid': iaid, diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index f9e2662cf12..5f91553872d 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -1856,11 +1856,11 @@ class TestDnsmasq(TestBase): "1472673289 aa:bb:cc:00:00:01 192.168.1.3 host-192-168-1-3 *", "1472673289 aa:bb:cc:00:00:01 192.168.1.4 host-192-168-1-4 *", "duid 00:01:00:01:02:03:04:05:06:07:08:09:0a:0b", - "1472597740 1044800001 2001:DB8::a host-2001-db8--a " + "1472597740 1044800001 [2001:DB8::a] host-2001-db8--a " "00:04:4a:d0:d2:34:19:2b:49:08:84:e8:34:bd:0c:dc:b9:3b", - "1472597823 1044800002 2001:DB8::b host-2001-db8--b " + "1472597823 1044800002 [2001:DB8::b] host-2001-db8--b " "00:04:ce:96:53:3d:f2:c2:4c:4c:81:7d:db:c9:8d:d2:74:22:3b:0a", - "1472599048 1044800003 2001:DB8::c host-2001-db8--c " + "1472599048 1044800003 [2001:DB8::c] host-2001-db8--c " "00:04:4f:f0:cd:ca:5e:77:41:bc:9d:7f:5c:33:31:37:5d:80:77:b4" ] mock_open = self.useFixture(