コード例 #1
0
def create_end_of_rib_update():
    """Construct end-of-rib (EOR) Update instance."""
    mpunreach_attr = BGPPathAttributeMpUnreachNLRI(RF_IPv4_VPN.afi,
                                                   RF_IPv4_VPN.safi,
                                                   [])
    eor = BGPUpdate(path_attributes=[mpunreach_attr])
    return eor
コード例 #2
0
ファイル: bmp.py プロジェクト: evanscottgray/ryu
    def _construct_update(self, path):
        # Get copy of path's path attributes.
        new_pathattr = [attr for attr in path.pathattr_map.itervalues()]

        if path.is_withdraw:
            if isinstance(path, Ipv4Path):
                return BGPUpdate(withdrawn_routes=[path.nlri],
                                 path_attributes=new_pathattr)
            else:
                mpunreach_attr = BGPPathAttributeMpUnreachNLRI(
                    path.route_family.afi, path.route_family.safi, [path.nlri]
                )
                new_pathattr.append(mpunreach_attr)
        else:
            if isinstance(path, Ipv4Path):
                nexthop_attr = BGPPathAttributeNextHop(path.nexthop)
                new_pathattr.append(nexthop_attr)
                return BGPUpdate(nlri=[path.nlri],
                                 path_attributes=new_pathattr)
            else:
                mpnlri_attr = BGPPathAttributeMpReachNLRI(
                    path.route_family.afi,
                    path.route_family.safi,
                    path.nexthop,
                    [path.nlri]
                )
                new_pathattr.append(mpnlri_attr)

        return BGPUpdate(path_attributes=new_pathattr)