bgp.py 文件源码

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

项目:openbmp-mrt 作者: OpenBMP 项目源码 文件源码
def encode_attr_cluster_list(cluster_list):
    """ Encode string cluster_list into a BGP CLUSTER_LIST attribute TLV

        :param cluster_list:      String space delimited list of cluster id's

        :return: BGP attribute TLV ready to be written
    """
    encode_cluster_list = ""

    try:
        for cluster_id in cluster_list.split(' '):
            encode_cluster_list += socket.inet_pton(socket.AF_INET, cluster_id)

        return ATTR_TYPE_CLUSTER_LIST + pack('!B', len(encode_cluster_list)) + encode_cluster_list

    except:
        return ''
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号