Commit 1b2eef22 authored by Carlos Manso's avatar Carlos Manso
Browse files

Update scalability

parent c47c372f
Loading
Loading
Loading
Loading
+177 −131

File changed.

Preview size limit exceeded, changes collapsed.

+27 −27
Changes for src/context/service/database/EndPointModel.py: 27 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -99,30 +99,30 @@ def set_kpi_sample_types(database : Database, db_endpoint : EndPointModel, grpc_
        db_endpoint_kpi_sample_type.kpi_sample_type = orm_kpi_sample_type
        db_endpoint_kpi_sample_type.save()
"""
def get_endpoint(
    database : Database, grpc_endpoint_id : EndPointId,
    validate_topology_exists : bool = True, validate_device_in_topology : bool = True
) -> Tuple[str, EndPointModel]:
    endpoint_uuid                  = grpc_endpoint_id.endpoint_uuid.uuid
    endpoint_device_uuid           = grpc_endpoint_id.device_id.device_uuid.uuid
    endpoint_topology_uuid         = grpc_endpoint_id.topology_id.topology_uuid.uuid
    endpoint_topology_context_uuid = grpc_endpoint_id.topology_id.context_id.context_uuid.uuid
    str_endpoint_key = key_to_str([endpoint_device_uuid, endpoint_uuid])

    if len(endpoint_topology_context_uuid) > 0 and len(endpoint_topology_uuid) > 0:
        # check topology exists
        str_topology_key = key_to_str([endpoint_topology_context_uuid, endpoint_topology_uuid])
        if validate_topology_exists:
            from .TopologyModel import TopologyModel
            get_object(database, TopologyModel, str_topology_key)

        # check device is in topology
        str_topology_device_key = key_to_str([str_topology_key, endpoint_device_uuid], separator='--')
        if validate_device_in_topology:
            from .RelationModels import TopologyDeviceModel
            get_object(database, TopologyDeviceModel, str_topology_device_key)

        str_endpoint_key = key_to_str([str_endpoint_key, str_topology_key], separator=':')

    db_endpoint : EndPointModel = get_object(database, EndPointModel, str_endpoint_key)
    return str_endpoint_key, db_endpoint
# def get_endpoint(
#     database : Database, grpc_endpoint_id : EndPointId,
#     validate_topology_exists : bool = True, validate_device_in_topology : bool = True
# ) -> Tuple[str, EndPointModel]:
#     endpoint_uuid                  = grpc_endpoint_id.endpoint_uuid.uuid
#     endpoint_device_uuid           = grpc_endpoint_id.device_id.device_uuid.uuid
#     endpoint_topology_uuid         = grpc_endpoint_id.topology_id.topology_uuid.uuid
#     endpoint_topology_context_uuid = grpc_endpoint_id.topology_id.context_id.context_uuid.uuid
#     str_endpoint_key = key_to_str([endpoint_device_uuid, endpoint_uuid])
#
#     if len(endpoint_topology_context_uuid) > 0 and len(endpoint_topology_uuid) > 0:
#         # check topology exists
#         str_topology_key = key_to_str([endpoint_topology_context_uuid, endpoint_topology_uuid])
#         if validate_topology_exists:
#             from .TopologyModel import TopologyModel
#             get_object(database, TopologyModel, str_topology_key)
#
#         # check device is in topology
#         str_topology_device_key = key_to_str([str_topology_key, endpoint_device_uuid], separator='--')
#         if validate_device_in_topology:
#             from .RelationModels import TopologyDeviceModel
#             get_object(database, TopologyDeviceModel, str_topology_device_key)
#
#         str_endpoint_key = key_to_str([str_endpoint_key, str_topology_key], separator=':')
#
#     db_endpoint : EndPointModel = get_object(database, EndPointModel, str_endpoint_key)
#     return str_endpoint_key, db_endpoint
+37 −24

File changed.

Preview size limit exceeded, changes collapsed.

+91 −20

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Changes for src/context/tests/Objects.py: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -128,11 +128,11 @@ LINK_R1_R3 = json_link(LINK_R1_R3_UUID, LINK_R1_R3_EPIDS)


# ----- Service --------------------------------------------------------------------------------------------------------
SERVICE_R1_R2_UUID  = 'SVC:R1/EP100-R2/EP100'
SERVICE_R1_R2_UUID  = 'f0432e7b-bb83-4880-9c5d-008c4925ce7d'
SERVICE_R1_R2_ID    = json_service_id(SERVICE_R1_R2_UUID, context_id=CONTEXT_ID)
SERVICE_R1_R2_EPIDS = [
    json_endpoint_id(DEVICE_R1_ID, 'EP100', topology_id=TOPOLOGY_ID),
    json_endpoint_id(DEVICE_R2_ID, 'EP100', topology_id=TOPOLOGY_ID),
    json_endpoint_id(DEVICE_R1_ID, EP100, topology_id=TOPOLOGY_ID),
    json_endpoint_id(DEVICE_R2_ID, EP100, topology_id=TOPOLOGY_ID),
]
SERVICE_R1_R2_CONST = [
    json_constraint('latency_ms', '15.2'),
@@ -148,7 +148,7 @@ SERVICE_R1_R2 = json_service_l3nm_planned(
    config_rules=SERVICE_R1_R2_RULES)


SERVICE_R1_R3_UUID  = 'SVC:R1/EP100-R3/EP100'
SERVICE_R1_R3_UUID  = 'fab21cef-542a-4948-bb4a-a0468abfa925'
SERVICE_R1_R3_ID    = json_service_id(SERVICE_R1_R3_UUID, context_id=CONTEXT_ID)
SERVICE_R1_R3_EPIDS = [
    json_endpoint_id(DEVICE_R1_ID, 'EP100', topology_id=TOPOLOGY_ID),
@@ -168,7 +168,7 @@ SERVICE_R1_R3 = json_service_l3nm_planned(
    config_rules=SERVICE_R1_R3_RULES)


SERVICE_R2_R3_UUID  = 'SVC:R2/EP100-R3/EP100'
SERVICE_R2_R3_UUID  = '1f2a808f-62bb-4eaa-94fb-448ed643e61a'
SERVICE_R2_R3_ID    = json_service_id(SERVICE_R2_R3_UUID, context_id=CONTEXT_ID)
SERVICE_R2_R3_EPIDS = [
    json_endpoint_id(DEVICE_R2_ID, 'EP100', topology_id=TOPOLOGY_ID),
Loading