util.py 文件源码

python
阅读 67 收藏 0 点赞 0 评论 0

项目:nav 作者: UNINETT 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号