diff --git a/src/context/service/database/Constraint.py b/src/context/service/database/Constraint.py index 3b77670a702825360bea26ed0191be117b554861..6869b7b71c9913a46b09135cce0c588dc7092adb 100644 --- a/src/context/service/database/Constraint.py +++ b/src/context/service/database/Constraint.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import datetime, logging +import datetime, logging, json from sqlalchemy import delete #from sqlalchemy.dialects import postgresql from sqlalchemy.dialects.postgresql import insert @@ -24,7 +24,6 @@ from .models.ConstraintModel import ConstraintKindEnum, ServiceConstraintModel, from .models.enums.ConstraintAction import ORM_ConstraintActionEnum, grpc_to_enum__constraint_action from .uuids._Builder import get_uuid_from_string from .uuids.EndPoint import endpoint_get_uuid -import json LOGGER = logging.getLogger(__name__) diff --git a/src/service/service/ServiceServiceServicerImpl.py b/src/service/service/ServiceServiceServicerImpl.py index 8326e15d9f68b7352e576e9c6a60e92f6f15147f..11d191d4b08d642c228bbfc5ce33c45bd587021a 100644 --- a/src/service/service/ServiceServiceServicerImpl.py +++ b/src/service/service/ServiceServiceServicerImpl.py @@ -135,22 +135,6 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): for config_rule in request.service_config.config_rules: service.service_config.config_rules.add().CopyFrom(config_rule) # pylint: disable=no-member - """ - for constraint in request.service_constraints: - if constraint.WhichOneof('constraint') == 'endpoint_location': - device_list = context_client.ListDevices(Empty()) - service_location = constraint.endpoint_location.location - distances = {} - for device in device_list.devices: - for endpoint in device.device_endpoints: - if not endpoint.endpoint_location.HasField('gps_position'): continue - distance = gps_distance(service_location.gps_position, endpoint.endpoint_location.gps_position) - distances[distance] = endpoint.endpoint_id - - closer_endpoint_uuid = distances[min(distances)] - service.service_endpoint_ids.append(closer_endpoint_uuid) - """ - service_id_with_uuids = context_client.SetService(service) # PathComp requires endpoints, constraints and config rules diff --git a/src/service/tests/CommonObjects.py b/src/service/tests/CommonObjects.py index c69844d0724467983841e91303a8f6c95cc83135..6b7fa86f1e6aadb27533a92bbc0c78525a70a304 100644 --- a/src/service/tests/CommonObjects.py +++ b/src/service/tests/CommonObjects.py @@ -19,12 +19,12 @@ from common.tools.object_factory.Topology import json_topology, json_topology_id from context.service.database.uuids._Builder import get_uuid_from_string # ----- Context -------------------------------------------------------------------------------------------------------- -CONTEXT_ID = json_context_id(get_uuid_from_string(DEFAULT_CONTEXT_NAME)) -CONTEXT = json_context(get_uuid_from_string(DEFAULT_CONTEXT_NAME)) +CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) +CONTEXT = json_context(DEFAULT_CONTEXT_NAME) # ----- Topology ------------------------------------------------------------------------------------------------------- -TOPOLOGY_ID = json_topology_id(get_uuid_from_string(DEFAULT_TOPOLOGY_NAME), context_id=CONTEXT_ID) -TOPOLOGY = json_topology(get_uuid_from_string(DEFAULT_TOPOLOGY_NAME), context_id=CONTEXT_ID) +TOPOLOGY_ID = json_topology_id(DEFAULT_TOPOLOGY_NAME, context_id=CONTEXT_ID) +TOPOLOGY = json_topology(DEFAULT_TOPOLOGY_NAME, context_id=CONTEXT_ID) # ----- Monitoring Samples --------------------------------------------------------------------------------------------- PACKET_PORT_SAMPLE_TYPES = [ diff --git a/src/service/tests/ServiceHandlersToTest.py b/src/service/tests/ServiceHandlersToTest.py index 18a45ca9802b5531120bd0b719810a86ada90d85..c50a0b45774f15497578a9c5b365e1e331d6d95e 100644 --- a/src/service/tests/ServiceHandlersToTest.py +++ b/src/service/tests/ServiceHandlersToTest.py @@ -21,10 +21,9 @@ try: SERVICE_HANDLERS_TO_TEST.append(TEST_SERVICE_HANDLER) except ImportError: pass -""" + try: from service.tests.ServiceHandler_L3NM_OC import TEST_SERVICE_HANDLER SERVICE_HANDLERS_TO_TEST.append(TEST_SERVICE_HANDLER) except ImportError: pass -""" diff --git a/src/service/tests/test_unitary.py b/src/service/tests/test_unitary.py index 5847129aa2bed6b9b87209714912b748bd9b07d2..0779a1f3cff287f68ed4752e6f86d067cadc96c1 100644 --- a/src/service/tests/test_unitary.py +++ b/src/service/tests/test_unitary.py @@ -170,9 +170,6 @@ class TestServiceHandlers: service_with_settings = copy.deepcopy(service_descriptor) service_with_settings['service_config']['config_rules'].extend(service_config_rules) service_with_settings['service_constraints'].extend(service_constraints_location) - LOGGER.warning('---------------------------------------------------------') - LOGGER.warning(service_with_settings) - LOGGER.warning('---------------------------------------------------------') service_client.UpdateService(Service(**service_with_settings)) for endpoint_id in service_endpoint_ids: