Merge "IPAM: fix 'enable-dhcp' with internal driver"
This commit is contained in:
commit
c1bbc0e45e
@ -451,16 +451,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
if ((ip_ver == 4 and subnet_prefixlen > 30) or
|
||||
(ip_ver == 6 and subnet_prefixlen > 126)):
|
||||
raise n_exc.InvalidInput(error_message=error_message)
|
||||
else:
|
||||
# NOTE(watanabe.isao): The following restriction is necessary
|
||||
# only when updating subnet.
|
||||
if cur_subnet:
|
||||
range_qry = context.session.query(models_v2.
|
||||
IPAvailabilityRange).join(models_v2.IPAllocationPool)
|
||||
ip_range = range_qry.filter_by(subnet_id=s['id']).first()
|
||||
if not ip_range:
|
||||
raise n_exc.IpAddressGenerationFailure(
|
||||
net_id=cur_subnet.network_id)
|
||||
|
||||
net = netaddr.IPNetwork(s['cidr'])
|
||||
if net.is_multicast():
|
||||
error_message = _("Multicast IP subnet is not supported "
|
||||
|
@ -4361,36 +4361,6 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPConflict.code)
|
||||
|
||||
def _test_subnet_update_enable_dhcp_no_ip_available_returns_409(
|
||||
self, allocation_pools, cidr):
|
||||
ip_version = netaddr.IPNetwork(cidr).version
|
||||
with self.network() as network:
|
||||
with self.subnet(network=network,
|
||||
allocation_pools=allocation_pools,
|
||||
enable_dhcp=False,
|
||||
cidr=cidr,
|
||||
ip_version=ip_version) as subnet:
|
||||
id = subnet['subnet']['network_id']
|
||||
self._create_port(self.fmt, id)
|
||||
data = {'subnet': {'enable_dhcp': True}}
|
||||
req = self.new_update_request('subnets', data,
|
||||
subnet['subnet']['id'])
|
||||
res = req.get_response(self.api)
|
||||
self.assertEqual(res.status_int,
|
||||
webob.exc.HTTPConflict.code)
|
||||
|
||||
def test_subnet_update_enable_dhcp_no_ip_available_returns_409_ipv4(self):
|
||||
allocation_pools = [{'start': '10.0.0.2', 'end': '10.0.0.2'}]
|
||||
cidr = '10.0.0.0/30'
|
||||
self._test_subnet_update_enable_dhcp_no_ip_available_returns_409(
|
||||
allocation_pools, cidr)
|
||||
|
||||
def test_subnet_update_enable_dhcp_no_ip_available_returns_409_ipv6(self):
|
||||
allocation_pools = [{'start': '2001:db8::2', 'end': '2001:db8::2'}]
|
||||
cidr = '2001:db8::/126'
|
||||
self._test_subnet_update_enable_dhcp_no_ip_available_returns_409(
|
||||
allocation_pools, cidr)
|
||||
|
||||
def test_show_subnet(self):
|
||||
with self.network() as network:
|
||||
with self.subnet(network=network) as subnet:
|
||||
|
Loading…
Reference in New Issue
Block a user