Loading src/pathcomp/frontend/tests/test_ero_path.py +14 −0 Original line number Original line Diff line number Diff line # Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. import logging import logging from typing import Any, Dict, List, Tuple from typing import Any, Dict, List, Tuple #from common.proto.context_pb2 import Link #from common.proto.context_pb2 import Link Loading src/service/.gitlab-ci.yml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -136,7 +136,6 @@ unit_test service: # Service preparation # Service preparation - > - > docker run --name $IMAGE_NAME -d -p 3030:3030 docker run --name $IMAGE_NAME -d -p 3030:3030 --env "LOG_LEVEL=DEBUG" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" Loading src/service/service/ServiceServiceServicerImpl.py +7 −7 Original line number Original line Diff line number Diff line Loading @@ -102,9 +102,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if constraint.WhichOneof('constraint') != 'endpoint_location': continue if constraint.WhichOneof('constraint') != 'endpoint_location': continue location_aware = True location_aware = True LOGGER.warning('location_aware={:s}'.format(str(location_aware))) LOGGER.debug('location_aware={:s}'.format(str(location_aware))) if _service is not None and location_aware: if _service is not None and location_aware: LOGGER.warning('removing previous service') LOGGER.debug(' Removing previous service') tasks_scheduler = TasksScheduler(self.service_handler_factory) tasks_scheduler = TasksScheduler(self.service_handler_factory) tasks_scheduler.compose_from_service(_service, is_delete=True) tasks_scheduler.compose_from_service(_service, is_delete=True) tasks_scheduler.execute_all() tasks_scheduler.execute_all() Loading @@ -122,7 +122,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_list = context_client.ListDevices(Empty()) device_list = context_client.ListDevices(Empty()) LOGGER.warning('[before] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[before] request={:s}'.format(grpc_message_to_json_string(request))) for constraint in request.service_constraints: for constraint in request.service_constraints: if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED: if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED: # Field action is new; assume if not set, it means SET # Field action is new; assume if not set, it means SET Loading Loading @@ -150,8 +150,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if closer_endpoint_id not in service_endpoint_ids: if closer_endpoint_id not in service_endpoint_ids: service.service_endpoint_ids.append(closer_endpoint_id) service.service_endpoint_ids.append(closer_endpoint_id) LOGGER.warning('[after] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[after] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.warning('[after] service={:s}'.format(grpc_message_to_json_string(service))) LOGGER.debug('[after] service={:s}'.format(grpc_message_to_json_string(service))) del service.service_constraints[:] # pylint: disable=no-member del service.service_constraints[:] # pylint: disable=no-member for constraint in request.service_constraints: for constraint in request.service_constraints: Loading Loading @@ -187,11 +187,11 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): else: else: pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member LOGGER.warning('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request))) LOGGER.debug('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request))) pathcomp = PathCompClient() pathcomp = PathCompClient() pathcomp_reply = pathcomp.Compute(pathcomp_request) pathcomp_reply = pathcomp.Compute(pathcomp_request) pathcomp.close() pathcomp.close() LOGGER.warning('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply))) LOGGER.debug('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply))) # Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among # Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among # the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be # the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be Loading src/service/tests/test_unitary.py +2 −4 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # See the License for the specific language governing permissions and # limitations under the License. # limitations under the License. import copy, grpc, json, logging, pytest import copy, grpc, logging, pytest from common.proto.context_pb2 import ( from common.proto.context_pb2 import ( Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId) Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId) from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import Loading Loading @@ -47,9 +47,7 @@ class TestServiceHandlers: for context in contexts: context_client.SetContext(Context(**context)) for context in contexts: context_client.SetContext(Context(**context)) for topology in topologies: context_client.SetTopology(Topology(**topology)) for topology in topologies: context_client.SetTopology(Topology(**topology)) for device in devices: for device in devices: device_client.AddDevice(Device(**device)) LOGGER.warning('device: {:s}'.format(json.dumps(device))) device_client.AddDevice(Device(**device)) for link in links: context_client.SetLink(Link(**link)) for link in links: context_client.SetLink(Link(**link)) Loading Loading
src/pathcomp/frontend/tests/test_ero_path.py +14 −0 Original line number Original line Diff line number Diff line # Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. import logging import logging from typing import Any, Dict, List, Tuple from typing import Any, Dict, List, Tuple #from common.proto.context_pb2 import Link #from common.proto.context_pb2 import Link Loading
src/service/.gitlab-ci.yml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -136,7 +136,6 @@ unit_test service: # Service preparation # Service preparation - > - > docker run --name $IMAGE_NAME -d -p 3030:3030 docker run --name $IMAGE_NAME -d -p 3030:3030 --env "LOG_LEVEL=DEBUG" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" Loading
src/service/service/ServiceServiceServicerImpl.py +7 −7 Original line number Original line Diff line number Diff line Loading @@ -102,9 +102,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if constraint.WhichOneof('constraint') != 'endpoint_location': continue if constraint.WhichOneof('constraint') != 'endpoint_location': continue location_aware = True location_aware = True LOGGER.warning('location_aware={:s}'.format(str(location_aware))) LOGGER.debug('location_aware={:s}'.format(str(location_aware))) if _service is not None and location_aware: if _service is not None and location_aware: LOGGER.warning('removing previous service') LOGGER.debug(' Removing previous service') tasks_scheduler = TasksScheduler(self.service_handler_factory) tasks_scheduler = TasksScheduler(self.service_handler_factory) tasks_scheduler.compose_from_service(_service, is_delete=True) tasks_scheduler.compose_from_service(_service, is_delete=True) tasks_scheduler.execute_all() tasks_scheduler.execute_all() Loading @@ -122,7 +122,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_list = context_client.ListDevices(Empty()) device_list = context_client.ListDevices(Empty()) LOGGER.warning('[before] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[before] request={:s}'.format(grpc_message_to_json_string(request))) for constraint in request.service_constraints: for constraint in request.service_constraints: if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED: if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED: # Field action is new; assume if not set, it means SET # Field action is new; assume if not set, it means SET Loading Loading @@ -150,8 +150,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if closer_endpoint_id not in service_endpoint_ids: if closer_endpoint_id not in service_endpoint_ids: service.service_endpoint_ids.append(closer_endpoint_id) service.service_endpoint_ids.append(closer_endpoint_id) LOGGER.warning('[after] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[after] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.warning('[after] service={:s}'.format(grpc_message_to_json_string(service))) LOGGER.debug('[after] service={:s}'.format(grpc_message_to_json_string(service))) del service.service_constraints[:] # pylint: disable=no-member del service.service_constraints[:] # pylint: disable=no-member for constraint in request.service_constraints: for constraint in request.service_constraints: Loading Loading @@ -187,11 +187,11 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): else: else: pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member LOGGER.warning('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request))) LOGGER.debug('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request))) pathcomp = PathCompClient() pathcomp = PathCompClient() pathcomp_reply = pathcomp.Compute(pathcomp_request) pathcomp_reply = pathcomp.Compute(pathcomp_request) pathcomp.close() pathcomp.close() LOGGER.warning('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply))) LOGGER.debug('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply))) # Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among # Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among # the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be # the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be Loading
src/service/tests/test_unitary.py +2 −4 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # See the License for the specific language governing permissions and # limitations under the License. # limitations under the License. import copy, grpc, json, logging, pytest import copy, grpc, logging, pytest from common.proto.context_pb2 import ( from common.proto.context_pb2 import ( Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId) Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId) from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import Loading Loading @@ -47,9 +47,7 @@ class TestServiceHandlers: for context in contexts: context_client.SetContext(Context(**context)) for context in contexts: context_client.SetContext(Context(**context)) for topology in topologies: context_client.SetTopology(Topology(**topology)) for topology in topologies: context_client.SetTopology(Topology(**topology)) for device in devices: for device in devices: device_client.AddDevice(Device(**device)) LOGGER.warning('device: {:s}'.format(json.dumps(device))) device_client.AddDevice(Device(**device)) for link in links: context_client.SetLink(Link(**link)) for link in links: context_client.SetLink(Link(**link)) Loading