Commit 1ec3e35f authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component - L3NM - IETF ACTN Service Handler:

- Added pre-loading of device config rules in SettingsHandler
parent 45870572
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -43,11 +43,19 @@ class L3NM_IETFACTN_ServiceHandler(_ServiceHandler):
    ) -> Tuple[Device, EndPoint, Dict]:
        device_uuid, endpoint_uuid = get_device_endpoint_uuids(endpoint)
        device_obj = self.__task_executor.get_device(DeviceId(**json_device_id(device_uuid)))
        device_name = device_obj.name
        device_prefix = '/device[{:s}]/'.format(device_name)
        for config_rule in device_obj.device_config.config_rules:
            self.__settings_handler.update_config_rule(config_rule)
            if config_rule.WhichOneof('config_rule') != 'custom': continue
            rw_config_rule = ConfigRule()
            rw_config_rule.CopyFrom(config_rule)
            resource_key = str(config_rule.custom.resource_key)
            if resource_key.startswith('/endpoints/endpoint['):
                resource_key = resource_key.replace('/endpoints/', device_prefix)
            rw_config_rule.custom.resource_key = resource_key
            self.__settings_handler.update_config_rule(rw_config_rule)
        endpoint_obj = get_endpoint_matching(device_obj, endpoint_uuid)
        endpoint_settings = self.__settings_handler.get_endpoint_settings(device_obj, endpoint_obj)
        device_name = device_obj.name
        endpoint_name = endpoint_obj.name
        if endpoint_settings is None:
            MSG = 'Settings not found for Endpoint(device=[uuid={:s}, name={:s}], endpoint=[uuid={:s}, name={:s}])'