def _validate_allocation_pools(self):
ip_pools = self._alloc_pools<EOL>subnet_cidr = self._subnet_cidr<EOL>LOG.debug(_("<STR_LIT>"))<EOL>ip_sets = []<EOL>for ip_pool in ip_pools:<EOL><INDENT>try:<EOL><INDENT>start_ip = netaddr.IPAddress(ip_pool['<STR_LIT:start>'])<EOL>end_ip = netaddr.IPAddress(ip_pool['<STR_LIT:end>'])<EOL><DEDENT>except netaddr.AddrFormatError:<EOL><INDENT>LOG.info(_("<STR_LIT>"<EOL>"<STR_LIT>"),<EOL>{'<STR_LIT:start>': ip_pool['<STR_LIT:start>'],<EOL>'<STR_LIT:end>': ip_pool['<STR_LIT:end>']})<EOL>raise n_exc_ext.InvalidAllocationPool(pool=ip_pool)<EOL><DEDENT>if (start_ip.version != self._subnet_cidr.version or<EOL>end_ip.version != self._subnet_cidr.version):<EOL><INDENT>LOG.info(_("<STR_LIT>"<EOL>"<STR_LIT>"))<EOL>raise n_exc_ext.InvalidAllocationPool(pool=ip_pool)<EOL><DEDENT>if end_ip < start_ip:<EOL><INDENT>LOG.info(_("<STR_LIT>"<EOL>"<STR_LIT>"),<EOL>{'<STR_LIT:start>': ip_pool['<STR_LIT:start>'], '<STR_LIT:end>': ip_pool['<STR_LIT:end>']})<EOL>raise n_exc_ext.InvalidAllocationPool(pool=ip_pool)<EOL><DEDENT>if (start_ip < self._subnet_first_ip or<EOL>end_ip > self._subnet_last_ip):<EOL><INDENT>LOG.info(_("<STR_LIT>"<EOL>"<STR_LIT>"),<EOL>{'<STR_LIT:start>': ip_pool['<STR_LIT:start>'],<EOL>'<STR_LIT:end>': ip_pool['<STR_LIT:end>']})<EOL>raise n_exc_ext.OutOfBoundsAllocationPool(<EOL>pool=ip_pool,<EOL>subnet_cidr=subnet_cidr)<EOL><DEDENT>ip_sets.append(netaddr.IPSet(netaddr.IPRange(<EOL>ip_pool['<STR_LIT:start>'],<EOL>ip_pool['<STR_LIT:end>']).cidrs()))<EOL><DEDENT>LOG.debug(_("<STR_LIT>"<EOL>"<STR_LIT>"))<EOL>ip_ranges = ip_pools[:]<EOL>for l_cursor in xrange(len(ip_sets)):<EOL><INDENT>for r_cursor in xrange(l_cursor + <NUM_LIT:1>, len(ip_sets)):<EOL><INDENT>if ip_sets[l_cursor] & ip_sets[r_cursor]:<EOL><INDENT>l_range = ip_ranges[l_cursor]<EOL>r_range = ip_ranges[r_cursor]<EOL>LOG.info(_("<STR_LIT>"<EOL>"<STR_LIT>"),<EOL>{'<STR_LIT>': l_range, '<STR_LIT>': r_range})<EOL>raise n_exc_ext.OverlappingAllocationPools(<EOL>pool_1=l_range,<EOL>pool_2=r_range,<EOL>subnet_cidr=subnet_cidr)<EOL><DEDENT><DEDENT><DEDENT>
Validate IP allocation pools.

        Verify start and end address for each allocation pool are valid,
        ie: constituted by valid and appropriately ordered IP addresses.
        Also, verify pools do not overlap among themselves.
        Finally, verify that each range fall within the subnet's CIDR.