本文整理汇总了Python中dm_utils.DMUtils.vn_evpn_comment方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.vn_evpn_comment方法的具体用法?Python DMUtils.vn_evpn_comment怎么用?Python DMUtils.vn_evpn_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.vn_evpn_comment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_routing_instance
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import vn_evpn_comment [as 别名]
#.........这里部分代码省略.........
if restrict_proxy_arp:
intf_unit.set_proxy_arp(ProxyArp(restricted=''))
inet = FamilyInet()
inet.set_filter(InetFilter(input=DMUtils.make_private_vrf_filter_name(ri_name)))
intf_unit.set_family(Family(inet=inet))
irb_intf.add_unit(intf_unit)
# add L2 EVPN and BD config
bd_config = None
interfaces_config = self.interfaces_config
proto_config = self.proto_config
if (is_l2 and vni is not None and
self.is_family_configured(self.bgp_params, "e-vpn")):
ri.set_vtep_source_interface("lo0.0")
if highest_enapsulation_priority == "VXLAN":
bd_config = BridgeDomains()
ri.set_bridge_domains(bd_config)
bd = Domain(name=DMUtils.make_bridge_name(vni), vlan_id='none', vxlan=VXLan(vni=vni))
bd.set_comment(DMUtils.vn_bd_comment(vn, "VXLAN"))
bd_config.add_domain(bd)
for interface in interfaces:
bd.add_interface(Interface(name=interface.name))
if is_l2_l3:
# network_id is unique, hence irb
bd.set_routing_interface("irb." + str(network_id))
ri.set_protocols(RoutingInstanceProtocols(
evpn=Evpn(encapsulation='vxlan', extended_vni_list='all')))
elif highest_enapsulation_priority in ["MPLSoGRE", "MPLSoUDP"]:
ri.set_vlan_id('none')
if is_l2_l3:
# network_id is unique, hence irb
ri.set_routing_interface("irb." + str(network_id))
evpn = Evpn()
evpn.set_comment(DMUtils.vn_evpn_comment(vn, highest_enapsulation_priority))
for interface in interfaces:
evpn.add_interface(Interface(name=interface.name))
ri.set_protocols(RoutingInstanceProtocols(evpn=evpn))
interfaces_config = self.interfaces_config or Interfaces(comment=DMUtils.interfaces_comment())
if is_l2_l3:
irb_intf = Interface(name='irb', gratuitous_arp_reply='')
interfaces_config.add_interface(irb_intf)
if gateways is not None:
intf_unit = Unit(name=str(network_id),
comment=DMUtils.vn_irb_comment(vn, False, is_l2_l3))
irb_intf.add_unit(intf_unit)
family = Family()
intf_unit.set_family(family)
inet = None
inet6 = None
for (irb_ip, gateway) in gateways:
if ':' in irb_ip:
if not inet6:
inet6 = FamilyInet6()
family.set_inet6(inet6)
addr = Address()
inet6.add_address(addr)
else:
if not inet:
inet = FamilyInet()
family.set_inet(inet)
addr = Address()
inet.add_address(addr)
addr.set_name(irb_ip)
addr.set_comment(DMUtils.irb_ip_comment(irb_ip))
if len(gateway) and gateway != '0.0.0.0':
示例2: add_routing_instance
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import vn_evpn_comment [as 别名]
#.........这里部分代码省略.........
irb_intf, li_map = self.set_default_pi('irb', 'irb')
intf_name = 'irb.' + str(network_id)
intf_unit = self.set_default_li(li_map, intf_name, network_id)
intf_unit.set_comment(DMUtils.vn_irb_fip_inet_comment(vn))
intf_unit.set_family("inet")
intf_unit.add_firewall_filters(
DMUtils.make_private_vrf_filter_name(ri_name))
self.add_ref_to_list(ri.get_routing_interfaces(), intf_name)
if gateways is not None:
for (ip, gateway) in gateways:
ri.add_gateways(GatewayRoute(
ip_address=self.get_subnet_for_cidr(ip),
gateway=self.get_subnet_for_cidr(gateway)))
# add L2 EVPN and BD config
if (is_l2 and vni is not None and
self.is_family_configured(self.bgp_params, "e-vpn")):
vlan = None
if encapsulation_priorities[0] == "VXLAN":
vlan = Vlan(name=DMUtils.make_bridge_name(vni), vxlan_id=vni)
vlan.set_comment(DMUtils.vn_bd_comment(vn, "VXLAN"))
self.vlan_map[vlan.get_name()] = vlan
for interface in interfaces:
self.add_ref_to_list(vlan.get_interfaces(), interface.name)
if is_l2_l3:
# network_id is unique, hence irb
irb_intf = "irb." + str(network_id)
self.add_ref_to_list(vlan.get_interfaces(), irb_intf)
elif (any(x in encapsulation_priorities for x in ["MPLSoGRE", "MPLSoUDP"])):
self.init_evpn_config(encapsulation_priorities[1])
self.evpn.set_comment(
DMUtils.vn_evpn_comment(vn, encapsulation_priorities[1]))
for interface in interfaces:
self.add_ref_to_list(self.evpn.get_interfaces(), interface.name)
self.build_l2_evpn_interface_config(interfaces, vn, vlan)
if (not is_l2 and vni is not None and
self.is_family_configured(self.bgp_params, "e-vpn")):
self.init_evpn_config()
if not is_internal_vn and not is_dci_vn:
# add vlans
self.add_ri_vlan_config(ri_name, vni)
if (not is_l2 and not is_l2_l3 and gateways):
ifl_num = 1000 + int(network_id)
lo_intf, li_map = self.set_default_pi('lo0', 'loopback')
intf_name = 'lo0.' + str(ifl_num)
intf_unit = self.set_default_li(li_map, intf_name, ifl_num)
intf_unit.set_comment(DMUtils.l3_lo_intf_comment(vn))
for (lo_ip, _) in gateways:
subnet = lo_ip
(ip, _) = lo_ip.split('/')
if ':' in lo_ip:
lo_ip = ip + '/' + '128'
else:
lo_ip = ip + '/' + '32'
self.add_ip_address(intf_unit, lo_ip)
self.add_ref_to_list(ri.get_loopback_interfaces(), intf_name)
# fip services config
if fip_map is not None:
nat_rules = NatRules(allow_overlapping_nat_pools=True,
name=DMUtils.make_services_set_name(ri_name),