diff --git a/src/common/tools/object_factory/EndPoint.py b/src/common/tools/object_factory/EndPoint.py index 0e754be9f5861277e3a7044d030e7622a0a0f665..a776dfebb42cea5b51bf0a2566038859ffc02fa5 100644 --- a/src/common/tools/object_factory/EndPoint.py +++ b/src/common/tools/object_factory/EndPoint.py @@ -20,9 +20,12 @@ def json_endpoint_descriptor( sample_types : List[int] = [], location : Optional[Dict] = None ) -> Dict: result = {'uuid': endpoint_uuid, 'type': endpoint_type} - if endpoint_name is not None: result['name'] = endpoint_name - if sample_types is not None and len(sample_types) > 0: result['sample_types'] = sample_types - if location is not None and len(location) > 0: result['location'] = location + if endpoint_name is not None: + result['name'] = endpoint_name + if sample_types is not None and len(sample_types) > 0: + result['sample_types'] = sample_types + if location is not None and len(location) > 0: + result['location'] = location return result def json_endpoint_id(device_id : Dict, endpoint_uuid : str, topology_id : Optional[Dict] = None): @@ -47,8 +50,10 @@ def json_endpoint( 'endpoint_id': json_endpoint_id(device_id, endpoint_uuid, topology_id=topology_id), 'endpoint_type': endpoint_type, } - if len(kpi_sample_types) > 0: result['kpi_sample_types'] = copy.deepcopy(kpi_sample_types) - if location: result['endpoint_location'] = copy.deepcopy(location) + if kpi_sample_types is not None and len(kpi_sample_types) > 0: + result['kpi_sample_types'] = copy.deepcopy(kpi_sample_types) + if location is not None: + result['endpoint_location'] = copy.deepcopy(location) return result def json_endpoints( diff --git a/src/service/.gitlab-ci.yml b/src/service/.gitlab-ci.yml index c9ff94ac915386ac05d91661fc2cb1a53bb0e65d..b1657dd9fd823441cc218eda8dd21f6e40fcf66a 100644 --- a/src/service/.gitlab-ci.yml +++ b/src/service/.gitlab-ci.yml @@ -136,6 +136,7 @@ unit_test service: # Service preparation - > docker run --name $IMAGE_NAME -d -p 3030:3030 + --env "LOG_LEVEL=DEBUG" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" diff --git a/src/service/service/ServiceServiceServicerImpl.py b/src/service/service/ServiceServiceServicerImpl.py index 84a856e5e9e4e6a35f55ccd9f20d4b417d61de2f..fe66c04e27dfe5023b2eaa5721adf0484c91e70f 100644 --- a/src/service/service/ServiceServiceServicerImpl.py +++ b/src/service/service/ServiceServiceServicerImpl.py @@ -106,6 +106,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): for endpoint_id in request.service_endpoint_ids: service.service_endpoint_ids.add().CopyFrom(endpoint_id) # pylint: disable=no-member + LOGGER.warning('[before] request={:s}'.format(grpc_message_to_json_string(request))) for constraint in request.service_constraints: if constraint.action != ConstraintActionEnum.CONSTRAINTACTION_SET: continue if constraint.WhichOneof('constraint') != 'endpoint_location': continue @@ -130,6 +131,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ] if closer_endpoint_id not in service_endpoint_ids: service.service_endpoint_ids.append(closer_endpoint_id) + LOGGER.warning('[after] request={:s}'.format(grpc_message_to_json_string(request))) + LOGGER.warning('[after] service={:s}'.format(grpc_message_to_json_string(service))) del service.service_constraints[:] # pylint: disable=no-member for constraint in request.service_constraints: