diff --git a/src/service/service/ServiceServiceServicerImpl.py b/src/service/service/ServiceServiceServicerImpl.py index f65d5b59a0d9a81c44f4d04683eb87e7773efa4a..173b49f343c13802b210e372dc90d8979c654f0f 100644 --- a/src/service/service/ServiceServiceServicerImpl.py +++ b/src/service/service/ServiceServiceServicerImpl.py @@ -245,9 +245,6 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): num_expected_endpoints = num_disjoint_paths * 2 tasks_scheduler = TasksScheduler(self.service_handler_factory) - if len(service_with_uuids.service_endpoint_ids) >= num_expected_endpoints: - pathcomp_request = PathCompRequest() - pathcomp_request.services.append(service_with_uuids) # pylint: disable=no-member if service.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: context_id_x = json_context_id(DEFAULT_CONTEXT_NAME) @@ -309,6 +306,10 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): tasks_scheduler.compose_from_pathcompreply( optical_reply, is_delete=False) else: + if len(service_with_uuids.service_endpoint_ids) >= num_expected_endpoints: + pathcomp_request = PathCompRequest() + pathcomp_request.services.append(service_with_uuids) # pylint: disable=no-member + if num_disjoint_paths is None or num_disjoint_paths in {0, 1} : pathcomp_request.shortest_path.Clear() # pylint: disable=no-member else: diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py index 53796263200b398ca512b44180accc1a269bfa2f..5c5747970c6accf3c76da6d4ffb60de48edbcdac 100644 --- a/src/service/service/task_scheduler/TaskExecutor.py +++ b/src/service/service/task_scheduler/TaskExecutor.py @@ -119,22 +119,22 @@ class TaskExecutor: # New function Andrea for Optical Devices def configure_optical_device(self, device : Device, settings : str, flows : list, is_opticalband : bool): device_key = get_device_key(device.device_id) - myid = OpticalConfigId() - myid.opticalconfig_uuid = device.device_id.device_uuid.uuid - opticalconfig = OpticalConfig() + optical_config_id = OpticalConfigId() + optical_config_id.opticalconfig_uuid = device.device_id.device_uuid.uuid + optical_config = OpticalConfig() setting = settings.value if settings else "" new_config = {} try: - result = self._context_client.SelectOpticalConfig(myid) + result = self._context_client.SelectOpticalConfig(optical_config_id) new_config = json.loads(result.config) if result is not None : new_config["new_config"] = setting new_config["is_opticalband"] = is_opticalband new_config["flow"] = flows result.config = str(new_config) - opticalconfig.CopyFrom(result) - self._device_client.ConfigureOpticalDevice(opticalconfig) + optical_config.CopyFrom(result) + self._device_client.ConfigureOpticalDevice(optical_config) self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device) except Exception as e: LOGGER.info("error in config my config %s",e)