From 6d9323aa265a23297e3147aa493bfbc31d550de2 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Tue, 2 May 2023 15:39:27 +0000 Subject: [PATCH] Device component: - Minor code cleanup before merging --- src/device/service/Tools.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/device/service/Tools.py b/src/device/service/Tools.py index 149b4d532..f8b1113e4 100644 --- a/src/device/service/Tools.py +++ b/src/device/service/Tools.py @@ -21,8 +21,6 @@ from common.proto.device_pb2 import MonitoringSettings from common.proto.kpi_sample_types_pb2 import KpiSampleType from common.tools.grpc.ConfigRules import update_config_rule_custom from common.tools.grpc.Tools import grpc_message_to_json -from context.client.ContextClient import ContextClient -from google.protobuf import json_format from .driver_api._Driver import _Driver, RESOURCE_ENDPOINTS from .monitoring.MonitoringLoops import MonitoringLoops from .ErrorMessages import ( @@ -195,9 +193,9 @@ def populate_endpoints( device_endpoint.kpi_sample_types.append(kpi_sample_type) monitoring_loops.add_resource_key(device_uuid, endpoint_uuid, kpi_sample_type, monitor_resource_key) - location = resource_value.get('location', {}) - if location: - json_format.Parse(json.dumps(location), device_endpoint.endpoint_location) + location = resource_value.get('location', None) + if location is not None: + device_endpoint.endpoint_location.MergeFrom(Location(**location)) elif resource_key.startswith('/links/link'): # create sub-link -- GitLab