Commit 1e877950 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component:

- Corrected composition of pathcomp request
- Minor cosmetic improvements
parent 7536c5f8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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:
+6 −6
Original line number Diff line number Diff line
@@ -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)