本文整理汇总了Python中dm_utils.DMUtils.extract_lr_uuid_from_internal_vn_name方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.extract_lr_uuid_from_internal_vn_name方法的具体用法?Python DMUtils.extract_lr_uuid_from_internal_vn_name怎么用?Python DMUtils.extract_lr_uuid_from_internal_vn_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.extract_lr_uuid_from_internal_vn_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_internal_vn_irb_config
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import extract_lr_uuid_from_internal_vn_name [as 别名]
def set_internal_vn_irb_config(self):
if self.internal_vn_ris and self.irb_interfaces:
for int_ri in self.internal_vn_ris:
lr_uuid = DMUtils.extract_lr_uuid_from_internal_vn_name(int_ri.name)
lr = LogicalRouterDM.get(lr_uuid)
if not lr:
continue
vn_list = lr.get_connected_networks(include_internal=False)
for vn in vn_list:
vn_obj = VirtualNetworkDM.get(vn)
if vn_obj is None or vn_obj.vn_network_id is None:
continue
irb_name = "irb." + str(vn_obj.vn_network_id)
if irb_name in self.irb_interfaces:
self.add_ref_to_list(int_ri.get_routing_interfaces(), irb_name)
示例2: build_ri_config
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import extract_lr_uuid_from_internal_vn_name [as 别名]
def build_ri_config(self):
vn_dict = self.get_vn_li_map()
vn_irb_ip_map = None
if self.is_gateway():
self.physical_router.evaluate_vn_irb_ip_map(set(vn_dict.keys()), 'l2_l3', 'irb', False)
self.physical_router.evaluate_vn_irb_ip_map(set(vn_dict.keys()), 'l3', 'lo0', True)
vn_irb_ip_map = self.physical_router.get_vn_irb_ip_map()
for vn_id, interfaces in self.get_sorted_key_value_pairs(vn_dict):
vn_obj = VirtualNetworkDM.get(vn_id)
if (vn_obj is None or
vn_obj.get_vxlan_vni() is None or
vn_obj.vn_network_id is None):
continue
export_set = None
import_set = None
for ri_id in vn_obj.routing_instances:
# Find the primary RI by matching the name
ri_obj = RoutingInstanceDM.get(ri_id)
if ri_obj is None:
continue
if ri_obj.fq_name[-1] == vn_obj.fq_name[-1]:
vrf_name_l2 = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
vn_obj.vn_network_id, 'l2')
vrf_name_l3 = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
vn_obj.vn_network_id, 'l3')
if vn_obj.route_targets:
export_set = vn_obj.route_targets & ri_obj.export_targets
import_set = vn_obj.route_targets & ri_obj.import_targets
else:
export_set = copy.copy(ri_obj.export_targets)
import_set = copy.copy(ri_obj.import_targets)
for ri2_id in ri_obj.routing_instances:
ri2 = RoutingInstanceDM.get(ri2_id)
if ri2 is None:
continue
import_set |= ri2.export_targets
if vn_obj.get_forwarding_mode() in ['l2', 'l2_l3']:
irb_ips = None
if vn_obj.get_forwarding_mode() == 'l2_l3' and self.is_gateway():
irb_ips = vn_irb_ip_map['irb'].get(vn_id, [])
ri_conf = {'ri_name': vrf_name_l2, 'vn': vn_obj,
'is_l2': True, 'is_l2_l3': (
vn_obj.get_forwarding_mode() == 'l2_l3'),
'import_targets': import_set,
'export_targets': export_set,
'prefixes': vn_obj.get_prefixes(),
'gateways': irb_ips,
'router_external': vn_obj.router_external,
'interfaces': interfaces,
'vni': vn_obj.get_vxlan_vni(),
'network_id': vn_obj.vn_network_id,
'encapsulation_priorities':
GlobalVRouterConfigDM.
global_encapsulation_priorities}
self.add_routing_instance(ri_conf)
if vn_obj.get_forwarding_mode() in ['l3', 'l2_l3']:
interfaces = []
lo0_ips = None
if vn_obj.get_forwarding_mode() == 'l2_l3':
interfaces = [
JunosInterface(
'irb.' + str(vn_obj.vn_network_id),
'l3', 0)]
elif self.is_gateway():
lo0_ips = vn_irb_ip_map['lo0'].get(vn_id, [])
is_internal_vn = True if '_contrail_lr_internal_vn_' in vn_obj.name else False
is_dci_vn = True if '_contrail_dci_internal_vn_' in vn_obj.name else False
ri_conf = {'ri_name': vrf_name_l3, 'vn': vn_obj,
'is_l2': False,
'is_l2_l3': vn_obj.get_forwarding_mode() ==
'l2_l3',
'import_targets': import_set,
'export_targets': export_set,
'prefixes': vn_obj.get_prefixes(),
'router_external': vn_obj.router_external,
'interfaces': interfaces,
'gateways': lo0_ips,
'network_id': vn_obj.vn_network_id}
if is_dci_vn:
ri_conf["prefixes"] = vn_obj.get_prefixes(self.physical_router.uuid)
ri_conf['vni'] = vn_obj.get_vxlan_vni(is_dci_vn = is_dci_vn)
ri_conf['is_dci_network'] = True
elif is_internal_vn:
ri_conf['vni'] = vn_obj.get_vxlan_vni(is_internal_vn = is_internal_vn)
lr_uuid = DMUtils.extract_lr_uuid_from_internal_vn_name(vrf_name_l3)
lr = LogicalRouterDM.get(lr_uuid)
if lr:
ri_conf['router_external'] = lr.logical_router_gateway_external
if lr.data_center_interconnect:
ri_conf['connected_dci_network'] = lr.data_center_interconnect
self.add_routing_instance(ri_conf)
break
if export_set and\
self.physical_router.is_junos_service_ports_enabled() and\
#.........这里部分代码省略.........