Skip to content
Snippets Groups Projects
Commit 1dbb33d2 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component:

- implemented support to compose resulting rules considering previous values
parent ba9ab833
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!43CI pipeline and multiple module fixes
......@@ -19,6 +19,7 @@ from common.method_wrappers.ServiceExceptions import InvalidArgumentException
from common.proto.context_pb2 import ConfigActionEnum, Device, DeviceConfig
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 .driver_api._Driver import _Driver, RESOURCE_ENDPOINTS
from .monitoring.MonitoringLoops import MonitoringLoops
......@@ -117,11 +118,8 @@ def _raw_config_rules_to_grpc(
errors.append(error_template.format(device_uuid, str(resource_key), str(resource_value)))
continue
config_rule = device_config.config_rules.add()
config_rule.action = config_action
config_rule.custom.resource_key = resource_key
config_rule.custom.resource_value = \
resource_value if isinstance(resource_value, str) else json.dumps(resource_value, sort_keys=True)
resource_value = json.loads(resource_value) if isinstance(resource_value, str) else resource_value
update_config_rule_custom(device_config.config_rules, resource_key, resource_value, new_action=config_action)
return errors
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment