本文整理汇总了Python中dm_utils.DMUtils.dynamic_tunnel_name方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.dynamic_tunnel_name方法的具体用法?Python DMUtils.dynamic_tunnel_name怎么用?Python DMUtils.dynamic_tunnel_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.dynamic_tunnel_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_dynamic_tunnels
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import dynamic_tunnel_name [as 别名]
def add_dynamic_tunnels(self, tunnel_source_ip,
ip_fabric_nets, bgp_router_ips):
dynamic_tunnel = DynamicTunnel(name=DMUtils.dynamic_tunnel_name(self.get_asn()),
source_address=tunnel_source_ip, gre='')
if ip_fabric_nets is not None:
for subnet in ip_fabric_nets.get("subnet", []):
dest_net = subnet['ip_prefix'] + '/' + str(subnet['ip_prefix_len'])
dynamic_tunnel.add_destination_networks(
DestinationNetworks(name=dest_net,
comment=DMUtils.ip_fabric_subnet_comment()))
for r_name, bgp_router_ip in bgp_router_ips.items():
dynamic_tunnel.add_destination_networks(
DestinationNetworks(name=bgp_router_ip + '/32',
comment=DMUtils.bgp_router_subnet_comment(r_name)))
dynamic_tunnels = DynamicTunnels()
dynamic_tunnels.add_dynamic_tunnel(dynamic_tunnel)
if self.global_routing_options_config is None:
self.global_routing_options_config = RoutingOptions(comment=DMUtils.routing_options_comment())
self.global_routing_options_config.set_dynamic_tunnels(dynamic_tunnels)