Commit f37d8e2c authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent 20087abe
Loading
Loading
Loading
Loading
+1 −1
Changes for src/common/Constants.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class ServiceNameEnum(Enum):
    QOSPROFILE             = 'qos-profile'
    OSMCLIENT              = 'osm-client'
    PLUGGABLES             = 'dscm-pluggable'
    LOGICALRESOURCES       = 'logical-resources'
    LOGICAL_RESOURCES      = 'logical-resources'

    # Used for test and debugging only
    DLT_GATEWAY    = 'dltgateway'
+9 −9
Changes for src/common/tools/descriptor/Loader.py: 9 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ from common.proto.logical_resources_pb2 import ConfigParameters
from common.tools.object_factory.Context import json_context_id
from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient
from logical_resources.client.Logicalresourceclient import LogicalResourceClient
from logical_resources.client.LogicalResourcesClient import LogicalResourcesClient
from service.client.ServiceClient import ServiceClient
from slice.client.SliceClient import SliceClient
from vnt_manager.client.VNTManagerClient import VNTManagerClient
@@ -117,7 +117,7 @@ class DescriptorLoader:
        self, descriptors : Optional[Union[str, Dict]] = None, descriptors_file : Optional[str] = None,
        num_workers : int = 1,
        context_client : Optional[ContextClient] = None, device_client : Optional[DeviceClient] = None,
        logical_resources_client : Optional[LogicalResourceClient] = None,
        logical_resources_client : Optional[LogicalResourcesClient] = None,
        service_client : Optional[ServiceClient] = None, slice_client : Optional[SliceClient] = None,
        vntm_client : Optional[VNTManagerClient] = None
    ) -> None:
@@ -198,12 +198,13 @@ class DescriptorLoader:
        self.__services_add   = None
        self.__slices_add     = None

        self.__ctx_cli = ContextClient()    if context_client is None else context_client
        self.__dev_cli = DeviceClient()     if device_client  is None else device_client
        self.__lrs_cli = LogicalResourceClient() if logical_resources_client is None else logical_resources_client
        self.__svc_cli = ServiceClient()    if service_client is None else service_client
        self.__slc_cli = SliceClient()      if slice_client   is None else slice_client
        self.__vnt_cli = VNTManagerClient() if vntm_client    is None else vntm_client
        self.__ctx_cli = context_client           or ContextClient()
        self.__dev_cli = device_client            or DeviceClient()
        self.__lrs_cli = logical_resources_client or LogicalResourcesClient()
        self.__svc_cli = service_client           or ServiceClient()
        self.__slc_cli = slice_client             or SliceClient()
        self.__vnt_cli = vntm_client              or VNTManagerClient()

        self.__fabric_name_to_id: Dict[str, str] = {}

        self.__results : TypeResults = list()
@@ -460,7 +461,6 @@ class DescriptorLoader:
        if len(self.__logical_resources) == 0:
            return


        num_ok, error_list = 0, []
        for fabric in self.__logical_resources:
            fabric_name = str(fabric.get('fabric_name', fabric.get('fabric_id', '')))
+6 −6
Changes for src/logical_resources/Dockerfile: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2026 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -54,11 +54,11 @@ RUN rm *.proto
RUN find . -type f -exec sed -i -E 's/^(import\ .*)_pb2/from . \1_pb2/g' {} \;

# Create component sub-folders, get specific Python packages
#RUN mkdir -p /var/teraflow/logical_resources
#WORKDIR /var/teraflow/logical_resources
#COPY src/logical_resources/requirements.in requirements.in
#RUN pip-compile --quiet --output-file=requirements.txt requirements.in
#RUN python3 -m pip install -r requirements.txt
RUN mkdir -p /var/teraflow/logical_resources
WORKDIR /var/teraflow/logical_resources
COPY src/logical_resources/requirements.in requirements.in
RUN pip-compile --quiet --output-file=requirements.txt requirements.in
RUN python3 -m pip install -r requirements.txt

# Add component files into working directory
WORKDIR /var/teraflow
+4 −4
Changes for src/logical_resources/client/LogicalResourcesClient.py: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2026 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,10 +27,10 @@ MAX_RETRIES = 15
DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0)
RETRY_DECORATOR = retry(max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect')

class LogicalResourceClient:
class LogicalResourcesClient:
    def __init__(self, host=None, port=None):
        if not host: host = get_service_host(ServiceNameEnum.LOGICALRESOURCES)
        if not port: port = get_service_port_grpc(ServiceNameEnum.LOGICALRESOURCES)
        if not host: host = get_service_host(ServiceNameEnum.LOGICAL_RESOURCES)
        if not port: port = get_service_port_grpc(ServiceNameEnum.LOGICAL_RESOURCES)
        self.endpoint = '{:s}:{:s}'.format(str(host), str(port))
        LOGGER.debug('Creating channel to {:s}...'.format(str(self.endpoint)))
        self.channel = None
+1 −1
Changes for src/logical_resources/client/__init__.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
# Copyright 2022-2026 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Loading