def filter_full_prefixes(self):
"""Remove /32 (or /128) prefixes from the queryset. Often useful to
reduce noise, as these are of little or no value to most network
planning operations.
Returns:
A lazy iterator of all filtered prefixes
"""
def _filter_full_prefixes(q):
for prefix in q:
ip = IP(prefix.net_address)
if ip.version() == 4 and ip.prefixlen() < 32:
yield prefix
continue
if ip.version() == 6 and ip.prefixlen() < 128:
yield prefix
continue
self.post_hooks.append(_filter_full_prefixes)
return self
评论列表
文章目录