def allocation_pools(self):
_cache = self.get("_allocation_pool_cache")
if _cache:
pools = json.loads(_cache)
return pools
else:
if self["ip_policy"]:
ip_policy_cidrs = self["ip_policy"].get_cidrs_ip_set()
else:
ip_policy_cidrs = netaddr.IPSet([])
cidr = netaddr.IPSet([netaddr.IPNetwork(self["cidr"])])
allocatable = cidr - ip_policy_cidrs
pools = _pools_from_cidr(allocatable)
return pools
评论列表
文章目录