Commit 3e8ae19b authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

PathComp component - FrontEnd:

- Fixed sub-service composition
parent 308c8457
Loading
Loading
Loading
Loading
+19 −16
Original line number Diff line number Diff line
@@ -115,11 +115,14 @@ def convert_explicit_path_hops_to_connections(
            # entering domain of a device controller, create underlying connection
            LOGGER.debug('  entering domain of a device controller, create underlying connection')

            if len(connection_stack.queue) > 0:
                prv_service_type = connection_stack.queue[-1].service_type
            else:
                prv_service_type = None
            if len(connection_stack.queue) == 0:
                LOGGER.debug('  synthetic path ingress')
                connection_entry = ConnectionEntry(
                    uuid=main_service_uuid, service_type=main_service_type, path_hops=[]
                )
                connection_stack.put(connection_entry)
            
            prv_service_type = connection_stack.queue[-1].service_type
            service_type = get_service_type(res_class[1], prv_service_type)
            connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
            connection_stack.put(connection_entry)
@@ -129,7 +132,6 @@ def convert_explicit_path_hops_to_connections(
            connection = connection_stack.get()
            connections.append(connection)

            if len(connection_stack.queue) > 0:
            connection_stack.queue[-1].dependencies.append(connection)
            connection_stack.queue[-1].path_hops.append(path_hop)
        elif prv_res_class[2] is not None and res_class[2] is not None:
@@ -142,15 +144,9 @@ def convert_explicit_path_hops_to_connections(
                LOGGER.debug('  switching to different device controller, chain connections')
                connection = connection_stack.get()
                connections.append(connection)

                if len(connection_stack.queue) > 0:
                connection_stack.queue[-1].dependencies.append(connection)

                if len(connection_stack.queue) > 0:
                prv_service_type = connection_stack.queue[-1].service_type
                else:
                    prv_service_type = None

                service_type = get_service_type(res_class[1], prv_service_type)
                connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
                connection_stack.put(connection_entry)
@@ -197,6 +193,13 @@ def convert_explicit_path_hops_to_connections(
        prv_device_uuid = device_uuid
        prv_res_class = res_class


    while len(connection_stack.queue) > 1:
        LOGGER.debug('  synthetic path egress')
        connection = connection_stack.get()
        connections.append(connection)
        connection_stack.queue[-1].dependencies.append(connection)

    # path egress
    LOGGER.debug('  path egress')
    connections.append(connection_stack.get())
+2 −6
Original line number Diff line number Diff line
@@ -49,21 +49,17 @@ SERVICE_TYPE_LXNM = {ServiceTypeEnum.SERVICETYPE_L3NM, ServiceTypeEnum.SERVICETY
SERVICE_TYPE_TAPI = {ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE}

def get_service_type(
    device_type : DeviceTypeEnum, prv_service_type : ServiceTypeEnum = None
    device_type : DeviceTypeEnum, prv_service_type : ServiceTypeEnum
) -> ServiceTypeEnum:
    if device_type is DeviceTypeEnum.NCE: return ServiceTypeEnum.SERVICETYPE_L3NM
    if device_type is DeviceTypeEnum.TERAFLOWSDN_CONTROLLER: return ServiceTypeEnum.SERVICETYPE_L3NM
    if (
        device_type in PACKET_DEVICE_TYPES and
        prv_service_type is not None and
        prv_service_type in SERVICE_TYPE_LXNM
    ): return prv_service_type
    if device_type in L2_DEVICE_TYPES: return ServiceTypeEnum.SERVICETYPE_L2NM
    if device_type in OPTICAL_DEVICE_TYPES: return ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE
    if (
        device_type in NETWORK_DEVICE_TYPES and
        prv_service_type is not None
    ): return prv_service_type
    if device_type in NETWORK_DEVICE_TYPES: return prv_service_type

    str_fields = ', '.join([
        'device_type={:s}'.format(str(device_type)),