From cbbcc2d3727df6e6e34b88f22eed3b48d9e1aef2 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 3 May 2023 09:00:03 +0000 Subject: [PATCH 1/3] Service component: - Added log message in service handler selection when no suitable handler is found --- .../service/task_scheduler/TaskExecutor.py | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py index 96751e837..acda45ce8 100644 --- a/src/service/service/task_scheduler/TaskExecutor.py +++ b/src/service/service/task_scheduler/TaskExecutor.py @@ -12,23 +12,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json +import json, logging from enum import Enum from typing import TYPE_CHECKING, Any, Dict, Optional, Union from common.method_wrappers.ServiceExceptions import NotFoundException -from common.proto.context_pb2 import Connection, ConnectionId, Device, DeviceId, Service, ServiceId +from common.proto.context_pb2 import Connection, ConnectionId, Device, DeviceDriverEnum, DeviceId, Service, ServiceId from common.tools.context_queries.Connection import get_connection_by_id from common.tools.context_queries.Device import get_device from common.tools.context_queries.Service import get_service_by_id +from common.tools.grpc.Tools import grpc_message_list_to_json_string from common.tools.object_factory.Device import json_device_id from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient +from service.service.service_handler_api.Exceptions import ( + UnsatisfiedFilterException, UnsupportedFilterFieldException, UnsupportedFilterFieldValueException) from service.service.service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory, get_service_handler_class from service.service.tools.ObjectKeys import get_connection_key, get_device_key, get_service_key if TYPE_CHECKING: from service.service.service_handler_api._ServiceHandler import _ServiceHandler +LOGGER = logging.getLogger(__name__) + CacheableObject = Union[Connection, Device, Service] class CacheableObjectType(Enum): @@ -169,5 +174,21 @@ class TaskExecutor: self, connection : Connection, service : Service, **service_handler_settings ) -> '_ServiceHandler': connection_devices = self.get_devices_from_connection(connection, exclude_managed_by_controller=True) - service_handler_class = get_service_handler_class(self._service_handler_factory, service, connection_devices) - return service_handler_class(service, self, **service_handler_settings) + try: + service_handler_class = get_service_handler_class( + self._service_handler_factory, service, connection_devices) + return service_handler_class(service, self, **service_handler_settings) + except (UnsatisfiedFilterException, UnsupportedFilterFieldException, UnsupportedFilterFieldValueException): + dict_connection_devices = { + cd_data.name : (cd_uuid, cd_data.name, { + (device_driver, DeviceDriverEnum.Name(device_driver)) + for device_driver in cd_data.device_drivers + }) + for cd_uuid,cd_data in connection_devices.items() + } + LOGGER.exception( + 'Unable to select service handler. service={:s} connection={:s} connection_devices={:s}'.format( + grpc_message_list_to_json_string(service), grpc_message_list_to_json_string(connection), + str(dict_connection_devices) + ) + ) -- GitLab From 8140e08a6904641c35d63bd45acaed149922d35f Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 3 May 2023 14:17:01 +0000 Subject: [PATCH 2/3] PathComp component - FrontEnd: - Corrected Resource Groups used to extrapolate SubServices --- .../frontend/service/algorithms/tools/ResourceGroups.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py b/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py index 53c89cd12..e56d436dd 100644 --- a/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py +++ b/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py @@ -33,12 +33,12 @@ DEVICE_TYPE_TO_DEEPNESS = { DeviceTypeEnum.EMULATED_P4_SWITCH.value : 60, DeviceTypeEnum.P4_SWITCH.value : 60, - DeviceTypeEnum.EMULATED_MICROWAVE_RADIO_SYSTEM.value : 40, - DeviceTypeEnum.MICROWAVE_RADIO_SYSTEM.value : 40, - DeviceTypeEnum.EMULATED_XR_CONSTELLATION.value : 40, DeviceTypeEnum.XR_CONSTELLATION.value : 40, + DeviceTypeEnum.EMULATED_MICROWAVE_RADIO_SYSTEM.value : 30, + DeviceTypeEnum.MICROWAVE_RADIO_SYSTEM.value : 30, + DeviceTypeEnum.EMULATED_OPEN_LINE_SYSTEM.value : 30, DeviceTypeEnum.OPEN_LINE_SYSTEM.value : 30, -- GitLab From 0534b0613535cff2983c29f330056c4dd37b334c Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 3 May 2023 14:45:48 +0000 Subject: [PATCH 3/3] Load Generator component: - Code cleanup --- src/load_generator/load_gen/RequestGenerator.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/load_generator/load_gen/RequestGenerator.py b/src/load_generator/load_gen/RequestGenerator.py index 974ce6f13..fdd400a21 100644 --- a/src/load_generator/load_gen/RequestGenerator.py +++ b/src/load_generator/load_gen/RequestGenerator.py @@ -39,14 +39,6 @@ ROUTER_ID = { 'R149': '5.5.5.5', 'R155': '5.5.5.1', 'R199': '5.5.5.6', - -} - -VIRTUAL_CIRCUIT = { - 'R149': '5.5.5.5', - 'R155': '5.5.5.1', - 'R199': '5.5.5.6', - } class RequestGenerator: @@ -269,8 +261,8 @@ class RequestGenerator: src_device_name = self._device_data[src_device_uuid]['name'] src_endpoint_name = self._device_endpoint_data[src_device_uuid][src_endpoint_uuid]['name'] - src_router_id = ROUTER_ID.get(src_device_name) src_router_num = int(re.findall(r'^\D*(\d+)', src_device_name)[0]) + src_router_id = ROUTER_ID.get(src_device_name) if src_router_id is None: src_router_id = '10.0.0.{:d}'.format(src_router_num) dst_device_name = self._device_data[dst_device_uuid]['name'] @@ -322,8 +314,8 @@ class RequestGenerator: src_device_name = self._device_data[src_device_uuid]['name'] src_endpoint_name = self._device_endpoint_data[src_device_uuid][src_endpoint_uuid]['name'] - src_router_id = ROUTER_ID.get(src_device_name) src_router_num = int(re.findall(r'^\D*(\d+)', src_device_name)[0]) + src_router_id = ROUTER_ID.get(src_device_name) if src_router_id is None: src_router_id = '10.0.0.{:d}'.format(src_router_num) src_address_ip = '10.{:d}.{:d}.{:d}'.format(x, y, src_router_num) -- GitLab