From 735f193668d61dd7c09f710e555ab91d1d91abe6 Mon Sep 17 00:00:00 2001 From: Pavel Bondar Date: Wed, 17 Jun 2015 18:47:11 +0300 Subject: [PATCH] Remove _check_ip_in_allocation_pool _check_ip_in_allocation_pool is not used anywhere in neutron. Cleaning up unused code from db_base_plugin_v2.py. Caller was removed over a year ago in change Ib31550fa9000fc75768a327cb6cc1c419e06568f Partially-Implements: blueprint neutron-ipam Change-Id: I41b7254835c308dda679ee2a5ebbccba528fd108 --- neutron/db/db_base_plugin_v2.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index 8dcd27554..cd8240beb 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -97,31 +97,6 @@ class NeutronDbPluginV2(ipam_non_pluggable_backend.IpamNonPluggableBackend, event.listen(models_v2.Port.status, 'set', self.nova_notifier.record_port_status_changed) - @staticmethod - def _check_ip_in_allocation_pool(context, subnet_id, gateway_ip, - ip_address): - """Validate IP in allocation pool. - - Validates that the IP address is either the default gateway or - in the allocation pools of the subnet. - """ - # Check if the IP is the gateway - if ip_address == gateway_ip: - # Gateway is not in allocation pool - return False - - # Check if the requested IP is in a defined allocation pool - pool_qry = context.session.query(models_v2.IPAllocationPool) - allocation_pools = pool_qry.filter_by(subnet_id=subnet_id) - ip = netaddr.IPAddress(ip_address) - for allocation_pool in allocation_pools: - allocation_pool_range = netaddr.IPRange( - allocation_pool['first_ip'], - allocation_pool['last_ip']) - if ip in allocation_pool_range: - return True - return False - def _validate_subnet_cidr(self, context, network, new_subnet_cidr): """Validate the CIDR for a subnet. -- 2.45.2