def _create_integer_pool(pool, blocks, fabric=None): for block in blocks: start = int(block[START]) end = int(block[END]) for value in range(start, end + 1): entry = PoolEntry() entry.pool = pool entry.fabric = fabric entry.value = str(value) entry.save()
def _create_ipv6_pool(pool, blocks, fabric=None): for block in blocks: start = IPNetwork(block[START]) end = IPNetwork(block[END]) for ip in range(start.ip, end.ip + 1): entry = PoolEntry() entry.pool = pool entry.fabric = fabric entry.value = str(IPAddress(ip)) + "/" + str(start.prefixlen) entry.save()