]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove _check_ip_in_allocation_pool
authorPavel Bondar <pbondar@infoblox.com>
Wed, 17 Jun 2015 15:47:11 +0000 (18:47 +0300)
committerPavel Bondar <pbondar@infoblox.com>
Fri, 19 Jun 2015 08:33:26 +0000 (11:33 +0300)
_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

index 8dcd27554a4fa3bcf620f8b5a1acea2fb0a859a9..cd8240bebc76fe8713ea417abd8a6e68c659cb70 100644 (file)
@@ -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.