Loading src/pathcomp/frontend/service/algorithms/_Algorithm.py +19 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,9 @@ from common.proto.context_pb2 import ( ConfigRule, Connection, Device, DeviceList, EndPointId, Link, LinkList, Service, ServiceStatusEnum, ServiceTypeEnum ) from common.proto.pathcomp_pb2 import PathCompReply, PathCompRequest from common.tools.context_queries.Device import get_device from common.tools.grpc.Tools import grpc_message_list_to_json from context.client.ContextClient import ContextClient from pathcomp.frontend.Config import BACKEND_URL from .tools.EroPathToHops import eropath_to_hops from .tools.ComposeConfigRules import ( Loading Loading @@ -205,24 +207,30 @@ class _Algorithm: config_rules, service.service_config.config_rules, path_hops, self.device_uuid_mapping, self.endpoint_uuid_mapping) context_client = ContextClient() device_cache : Dict[str, Device] = dict() for path_hop in path_hops: path_hop_device_id = path_hop['device'] path_hop_ingress_ep_id = path_hop['ingress_ep'] path_hop_egress_ep_id = path_hop['egress_ep'] path_hop_device_uuid = self.device_uuid_mapping[path_hop_device_id] path_hop_ingress_ep_uuid = self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_ingress_ep_id)] path_hop_egress_ep_uuid = self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_egress_ep_id )] path_hop_ingress_ep_name = self.endpoint_name_mapping[(path_hop_device_id, path_hop_ingress_ep_id)] path_hop_egress_ep_name = self.endpoint_name_mapping[(path_hop_device_id, path_hop_egress_ep_id )] target_endpoint_ids = set() target_endpoint_ids.add(path_hop_ingress_ep_uuid) target_endpoint_ids.add(path_hop_egress_ep_uuid) target_endpoint_ids.add(path_hop_ingress_ep_name) target_endpoint_ids.add(path_hop_egress_ep_name) path_hop_device = self.device_dict[path_hop_device_uuid][1] if path_hop_device_uuid in device_cache: path_hop_device = device_cache[path_hop_device_uuid] else: path_hop_device = get_device( context_client, path_hop_device_uuid, include_components=False, include_endpoints=False, include_config_rules=True ) device_cache[path_hop_device_uuid] = path_hop_device target_endpoint_ids = { self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_ingress_ep_id)], self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_egress_ep_id )], self.endpoint_name_mapping[(path_hop_device_id, path_hop_ingress_ep_id)], self.endpoint_name_mapping[(path_hop_device_id, path_hop_egress_ep_id )], } path_hop_device_name = path_hop_device.name RE_ENDPOINT_SETTINGS = re.compile(r'\/endpoints\/endpoint\[([^\]]+)\](\/settings)?') Loading Loading
src/pathcomp/frontend/service/algorithms/_Algorithm.py +19 −11 Original line number Diff line number Diff line Loading @@ -19,7 +19,9 @@ from common.proto.context_pb2 import ( ConfigRule, Connection, Device, DeviceList, EndPointId, Link, LinkList, Service, ServiceStatusEnum, ServiceTypeEnum ) from common.proto.pathcomp_pb2 import PathCompReply, PathCompRequest from common.tools.context_queries.Device import get_device from common.tools.grpc.Tools import grpc_message_list_to_json from context.client.ContextClient import ContextClient from pathcomp.frontend.Config import BACKEND_URL from .tools.EroPathToHops import eropath_to_hops from .tools.ComposeConfigRules import ( Loading Loading @@ -205,24 +207,30 @@ class _Algorithm: config_rules, service.service_config.config_rules, path_hops, self.device_uuid_mapping, self.endpoint_uuid_mapping) context_client = ContextClient() device_cache : Dict[str, Device] = dict() for path_hop in path_hops: path_hop_device_id = path_hop['device'] path_hop_ingress_ep_id = path_hop['ingress_ep'] path_hop_egress_ep_id = path_hop['egress_ep'] path_hop_device_uuid = self.device_uuid_mapping[path_hop_device_id] path_hop_ingress_ep_uuid = self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_ingress_ep_id)] path_hop_egress_ep_uuid = self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_egress_ep_id )] path_hop_ingress_ep_name = self.endpoint_name_mapping[(path_hop_device_id, path_hop_ingress_ep_id)] path_hop_egress_ep_name = self.endpoint_name_mapping[(path_hop_device_id, path_hop_egress_ep_id )] target_endpoint_ids = set() target_endpoint_ids.add(path_hop_ingress_ep_uuid) target_endpoint_ids.add(path_hop_egress_ep_uuid) target_endpoint_ids.add(path_hop_ingress_ep_name) target_endpoint_ids.add(path_hop_egress_ep_name) path_hop_device = self.device_dict[path_hop_device_uuid][1] if path_hop_device_uuid in device_cache: path_hop_device = device_cache[path_hop_device_uuid] else: path_hop_device = get_device( context_client, path_hop_device_uuid, include_components=False, include_endpoints=False, include_config_rules=True ) device_cache[path_hop_device_uuid] = path_hop_device target_endpoint_ids = { self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_ingress_ep_id)], self.endpoint_uuid_mapping[(path_hop_device_id, path_hop_egress_ep_id )], self.endpoint_name_mapping[(path_hop_device_id, path_hop_ingress_ep_id)], self.endpoint_name_mapping[(path_hop_device_id, path_hop_egress_ep_id )], } path_hop_device_name = path_hop_device.name RE_ENDPOINT_SETTINGS = re.compile(r'\/endpoints\/endpoint\[([^\]]+)\](\/settings)?') Loading