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

Simap Connector component:

- Corrected logic to delegate SIMAP physical links and associated synthesizers to appropriate controllers
parent cac5074d
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
# Copyright 2022-2025 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.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ALLOWED_LINKS_PER_CONTROLLER = {
    'e2e'      : {'L1', 'L2', 'L3', 'L4'},
    'agg'      : {'L7ab', 'L7ba', 'L8ab', 'L8ba', 'L11ab', 'L11ba',
                  'L12ab', 'L12ba', 'L13', 'L14'},
    'trans-pkt': {'L5', 'L6', 'L9', 'L10'},
}
+9 −3
Original line number Diff line number Diff line
@@ -24,13 +24,16 @@ from common.tools.grpc.BaseEventCollector import BaseEventCollector
from common.tools.grpc.BaseEventDispatcher import BaseEventDispatcher
from common.tools.grpc.Tools import grpc_message_to_json_string
from context.client.ContextClient import ContextClient
from simap_connector.service.simap_updater.MockSimaps import delete_mock_simap, set_mock_simap
from simap_connector.service.telemetry.worker.data.Resources import ResourceLink, Resources, SyntheticSampler
from simap_connector.service.telemetry.worker.data.Resources import (
    ResourceLink, Resources, SyntheticSampler
)
from simap_connector.service.telemetry.worker._Worker import WorkerTypeEnum
from simap_connector.service.telemetry.TelemetryPool import TelemetryPool
from .AllowedLinks import ALLOWED_LINKS_PER_CONTROLLER
from .MockSimaps import delete_mock_simap, set_mock_simap
from .ObjectCache import CachedEntities, ObjectCache
from .SimapClient import SimapClient
from .Tools import get_device_endpoint, get_link_endpoint, get_service_endpoint
from .Tools import get_device_endpoint, get_link_endpoint #, get_service_endpoint


LOGGER = logging.getLogger(__name__)
@@ -290,6 +293,9 @@ class EventDispatcher(BaseEventDispatcher):
        te_topo = self._simap_client.network(topology_name)
        te_topo.update()

        allowed_link_names = ALLOWED_LINKS_PER_CONTROLLER.get(topology_name)
        if link_name not in allowed_link_names: return False

        src_device   = self._object_cache.get(CachedEntities.DEVICE,   endpoint_uuids[0][0], force_update =True )
        src_endpoint = self._object_cache.get(CachedEntities.ENDPOINT, *(endpoint_uuids[0]), auto_retrieve=False)
        dst_device   = self._object_cache.get(CachedEntities.DEVICE,   endpoint_uuids[1][0], force_update =True )