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
This commit is contained in:
Brian Haley
2016-09-01 16:49:59 -04:00
parent e8b0d77f0f
commit 2d67b68cc4
2 changed files with 4 additions and 3 deletions

View File

@@ -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,

View File

@@ -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(