diff --git a/src/load_generator/load_gen/RequestGenerator.py b/src/load_generator/load_gen/RequestGenerator.py index 974ce6f130e9c81f273f418b0a1440d148fcfb74..fdd400a2110fd4a75d6f9e8cc4820bc943eef423 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) diff --git a/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py b/src/pathcomp/frontend/service/algorithms/tools/ResourceGroups.py index 53c89cd124cb7d3431b37a50596b0b793cfa83eb..e56d436dd006197497d7774be598a480a134320c 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, diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py index 96751e83770e1b98df4770cf74bb453f6a0519ef..acda45ce80a62a4a3723744546968e3195799b59 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) + ) + )