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