Commit 57e30257 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Refactor service handling: remove unnecessary code, enhance logging, and...

Refactor service handling: remove unnecessary code, enhance logging, and streamline service type definitions
parent f22e882f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -580,7 +580,6 @@ class MockServicerImpl_Context(ContextServiceServicer):
                if exclude_config_rules: del reply_service.service_config.config_rules[:] # pylint: disable=no-member
                services.append(reply_service)


        reply = ServiceList(services=services)
        LOGGER.debug('[SelectService] reply={:s}'.format(grpc_message_to_json_string(reply)))
        return reply
+0 −3
Original line number Diff line number Diff line
@@ -47,9 +47,6 @@ def compose_resource_endpoint(endpoint_data : Dict[str, Any]) -> Optional[Tuple[
        process_optional_string_field(endpoint_data, 'context_uuid', endpoint_resource_value)
        process_optional_string_field(endpoint_data, 'topology_uuid', endpoint_resource_value)

        if 'name' not in endpoint_resource_value:
            endpoint_resource_value['name'] = endpoint_uuid

        # Check endpoint sample types (optional)
        endpoint_sample_types = chk_attribute('sample_types', endpoint_data, 'endpoint_data', default=[])
        chk_type('endpoint_data.sample_types', endpoint_sample_types, list)
+1 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ class OpticalTfsDriver(_Driver):
        with self.__lock:
            self.tac.check_credentials()
            for resource in resources:
                LOGGER.info('resource = {:s}'.format(str(resource)))
                resource_key, resource_value = resource
                try:
                    resource_value = json.loads(resource_value)
+0 −7
Original line number Diff line number Diff line
@@ -38,19 +38,12 @@ class YangHandler:
        network = networks.create_path(f'network[network-id="{te_topology_name}"]')
        network.create_path('network-id', te_topology_name)

        network_types = network.create_path('network-types')
        network_types.create_path('ietf-l3-unicast-topology:l3-unicast-topology')

        name_mappings = NameMappings()

        for device in topology_details.devices:
            if device.name=="TFS-OPTICAL" or device.name=="TFS-PACKET":
                continue
            self.compose_node(device, name_mappings, network)

        for link in topology_details.links:
            if "TFS" in link.name:
                continue
            self.compose_link(link, name_mappings, network)

        return json.loads(networks.print_mem('json'))
+6 −7
Original line number Diff line number Diff line
@@ -47,9 +47,8 @@ SERVICE_TYPE_L2NM = {ServiceTypeEnum.SERVICETYPE_L2NM}
SERVICE_TYPE_L3NM     = {ServiceTypeEnum.SERVICETYPE_L3NM}
SERVICE_TYPE_LXNM     = {ServiceTypeEnum.SERVICETYPE_L3NM, ServiceTypeEnum.SERVICETYPE_L2NM}
SERVICE_TYPE_TAPI     = {ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE}
SERVICE_TYPE_IPOWDM = {ServiceTypeEnum.SERVICETYPE_IPOWDM}
SERVICE_TYPE_IP_LINK  = {ServiceTypeEnum.SERVICETYPE_IP_LINK}

SERVICE_TYPE_IPOWDM   = {ServiceTypeEnum.SERVICETYPE_IPOWDM}
SERVICE_TYPE_TAPI_LSP = {ServiceTypeEnum.SERVICETYPE_TAPI_LSP}

def get_service_type(device_type : DeviceTypeEnum, prv_service_type : ServiceTypeEnum) -> ServiceTypeEnum: