Commit 4770a2c9 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'release/2.0.1' of https://labs.etsi.org/rep/tfs/controller into feat/slice-grouping

parents f6315c3c 3091a572
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ def upsert_constraints(
) -> bool:
    uuids_to_upsert : Dict[str, int] = dict()
    rules_to_upsert : List[Dict] = list()
    if not is_delete:
    for constraint in constraints:
        constraint_uuid = constraint['constraint_uuid']
        position = uuids_to_upsert.get(constraint_uuid)
@@ -100,11 +99,10 @@ def upsert_constraints(

    # Delete all constraints not in uuids_to_upsert
    delete_affected = False
    if is_delete or len(uuids_to_upsert) > 0:
    if len(uuids_to_upsert) > 0:
        stmt = delete(ConstraintModel)
        if service_uuid is not None: stmt = stmt.where(ConstraintModel.service_uuid == service_uuid)
        if slice_uuid   is not None: stmt = stmt.where(ConstraintModel.slice_uuid   == slice_uuid  )
        if not is_delete:
        stmt = stmt.where(ConstraintModel.constraint_uuid.not_in(set(uuids_to_upsert.keys())))
        #str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})
        #LOGGER.warning('delete stmt={:s}'.format(str(str_stmt)))
+2 −0
Original line number Diff line number Diff line
@@ -26,3 +26,5 @@ ENDPOINT_COMPATIBILITY = {
    'PHOTONIC_MEDIA:FLEX:G_6_25GHZ:INPUT': 'PHOTONIC_MEDIA:FLEX:G_6_25GHZ:OUTPUT',
    'PHOTONIC_MEDIA:DWDM:G_50GHZ:INPUT'  : 'PHOTONIC_MEDIA:DWDM:G_50GHZ:OUTPUT',
}

MAX_WORKER_THREADS = 10
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -230,9 +230,9 @@ class RequestGenerator:
        ]

        if request_type == RequestType.SERVICE_L2NM:
            availability  = int(random.uniform(00.0, 99.99) * 100.0) / 100.0
            capacity_gbps = int(random.uniform(0.1, 100.0) * 100.0) / 100.0
            e2e_latency_ms = int(random.uniform(5.0, 100.0) * 100.0) / 100.0
            availability   = round(random.uniform(0.0,  99.99), ndigits=2)
            capacity_gbps  = round(random.uniform(0.1, 100.00), ndigits=2)
            e2e_latency_ms = round(random.uniform(5.0, 100.00), ndigits=2)

            constraints = [
                json_constraint_sla_availability(1, True, availability),
@@ -275,9 +275,9 @@ class RequestGenerator:
                request_uuid, endpoint_ids=endpoint_ids, constraints=constraints, config_rules=config_rules)

        elif request_type == RequestType.SERVICE_L3NM:
            availability  = int(random.uniform(00.0, 99.99) * 100.0) / 100.0
            capacity_gbps = int(random.uniform(0.1, 100.0) * 100.0) / 100.0
            e2e_latency_ms = int(random.uniform(5.0, 100.0) * 100.0) / 100.0
            availability   = round(random.uniform(0.0,  99.99), ndigits=2)
            capacity_gbps  = round(random.uniform(0.1, 100.00), ndigits=2)
            e2e_latency_ms = round(random.uniform(5.0, 100.00), ndigits=2)

            constraints = [
                json_constraint_sla_availability(1, True, availability),
@@ -380,9 +380,9 @@ class RequestGenerator:
            json_endpoint_id(json_device_id(dst_device_uuid), dst_endpoint_uuid),
        ]

        availability  = int(random.uniform(00.0, 99.99) * 100.0) / 100.0
        capacity_gbps = int(random.uniform(0.1, 100.0) * 100.0) / 100.0
        e2e_latency_ms = int(random.uniform(5.0, 100.0) * 100.0) / 100.0
        availability   = round(random.uniform(0.0,  99.99), ndigits=2)
        capacity_gbps  = round(random.uniform(0.1, 100.00), ndigits=2)
        e2e_latency_ms = round(random.uniform(5.0, 100.00), ndigits=2)
        constraints = [
            json_constraint_sla_availability(1, True, availability),
            json_constraint_sla_capacity(capacity_gbps),
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ from typing import Dict, Optional
from common.proto.context_pb2 import Service, ServiceId, Slice, SliceId
from service.client.ServiceClient import ServiceClient
from slice.client.SliceClient import SliceClient
from .Constants import MAX_WORKER_THREADS
from .DltTools import explore_entities_to_record, record_entities
from .Parameters import Parameters
from .RequestGenerator import RequestGenerator
@@ -37,7 +38,7 @@ class RequestScheduler:
        self._scheduler = scheduler_class()
        self._scheduler.configure(
            jobstores = {'default': MemoryJobStore()},
            executors = {'default': ThreadPoolExecutor(max_workers=10)},
            executors = {'default': ThreadPoolExecutor(max_workers=MAX_WORKER_THREADS)},
            job_defaults = {
                'coalesce': False,
                'max_instances': 100,
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ def create_app(use_config=None, web_app_root=None):
    app.jinja_env.globals.update({              # pylint: disable=no-member
        'enumerate'           : enumerate,
        'json_to_list'        : json_to_list,
        'round'               : round,
        'get_working_context' : get_working_context,
        'get_working_topology': get_working_topology,
    })
Loading