'Validate the CIDR for a subnet.
Verifies the specified CIDR does not overlap with the ones defined
for the other subnets specified for this network, or with any other
CIDR if overlapping IPs are disabled. Does not apply to subnets with
temporary IPv6 Prefix Delegation CIDRs (::/64).'

def _validate_subnet_cidr(self, context, network, new_subnet_cidr):

    new_subnet_ipset = netaddr.IPSet([new_subnet_cidr])
    for cidr in new_subnet_ipset.iter_cidrs():
        if (cidr.prefixlen == 0):
            err_msg = _('0    is    not    allowed    as    CIDR    prefix    length')
            raise exc.InvalidInput(error_message=err_msg)
    if cfg.CONF.allow_overlapping_ips:
        subnet_list = network.subnets
    else:
        subnet_list = self._get_all_subnets(context)
    for subnet in subnet_list:
        if ((netaddr.IPSet([subnet.cidr]) & new_subnet_ipset) and (subnet.cidr != constants.PROVISIONAL_IPV6_PD_PREFIX)):
            err_msg = (_('Requested    subnet    with    cidr:    %(cidr)s    for    network:    %(network_id)s    overlaps    with    another    subnet') % {'cidr': new_subnet_cidr, 'network_id': network.id})
            LOG.info(_LI('Validation    for    CIDR:    %(new_cidr)s    failed    -    overlaps    with    subnet    %(subnet_id)s    (CIDR:    %(cidr)s)'), {'new_cidr': new_subnet_cidr, 'subnet_id': subnet.id, 'cidr': subnet.cidr})
            raise exc.InvalidInput(error_message=err_msg)
