本文整理汇总了Python中dm_utils.DMUtils.dci_bgp_group_comment方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.dci_bgp_group_comment方法的具体用法?Python DMUtils.dci_bgp_group_comment怎么用?Python DMUtils.dci_bgp_group_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.dci_bgp_group_comment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_dci_bgp_config
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import dci_bgp_group_comment [as 别名]
def build_dci_bgp_config(self):
if not self.physical_router.has_rb_role("DCI-Gateway"):
return
self.physical_router.evaluate_dci_ip_map()
dci_list = self.physical_router.get_dci_list()
for dci_uuid in dci_list or []:
params = self.physical_router.get_dci_bgp_params(dci_uuid)
if not params:
continue
asn = params.get("asn")
ip = params.get("ip")
name = params.get("name")
typ = params.get("type")
bgp = Bgp(name=name,
ip_address=ip,
autonomous_system=asn,
type_=typ)
bgp.set_comment(DMUtils.dci_bgp_group_comment(bgp))
bgp.set_hold_time(params.get('hold_time'))
for family in params.get("families") or []:
if family in ['e-vpn', 'e_vpn']:
family = 'evpn'
bgp.add_families(family)
bgp_name = name
neigh_list = self.physical_router.get_dci_bgp_neighbours(dci_uuid)
peers = {}
for neigh in neigh_list or []:
asn = neigh.get("asn")
ip = neigh.get("ip")
name = neigh.get("name")
typ = neigh.get("type")
peer = Bgp(name=name,
ip_address=ip,
autonomous_system=asn, type_=typ)
peers[name] = peer
peer.set_hold_time(neigh.get('hold_time'))
for family in neigh.get("families") or []:
if family in ['e-vpn', 'e_vpn']:
family = 'evpn'
peer.add_families(family)
if peers:
bgp.set_peers(self.get_values_sorted_by_key(peers))
self.bgp_map[bgp_name] = bgp