'Generate index for DVR snat rules and route tables.
The index value has to be 32 bits or less but more than the system
generated entries i.e. 32768. For IPv4 use the numeric value of the
cidr. For IPv6 generate a crc32 bit hash and xor-fold to 30 bits.
Use the freed range to extend smaller values so that they become
greater than system generated entries.'

@staticmethod
def _get_snat_idx(ip_cidr):

    net = netaddr.IPNetwork(ip_cidr)
    if (net.version == 6):
        if isinstance(ip_cidr, six.text_type):
            ip_cidr = ip_cidr.encode()
        snat_idx = (binascii.crc32(ip_cidr) & 4294967295)
        snat_idx = ((snat_idx >> 30) ^ (snat_idx & MASK_30))
        if (snat_idx < 32768):
            snat_idx = (snat_idx + MASK_30)
    else:
        snat_idx = net.value
    return snat_idx
