From 0b823f6522c34bb1e99c70a4b195e3781a268ca0 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Mon, 14 Aug 2023 14:56:47 -0700 Subject: [PATCH 01/13] combined duplicate methods, renamed functions to use the right verb, added access control restriction on agent config initialization method --- volttron/platform/store.py | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/volttron/platform/store.py b/volttron/platform/store.py index fd966b7e6b..2786bf7ac4 100644 --- a/volttron/platform/store.py +++ b/volttron/platform/store.py @@ -162,19 +162,20 @@ def _onstart(self, sender, **kwargs): @RPC.export @RPC.allow('edit_config_store') - def manage_store(self, identity, config_name, raw_contents, config_type="raw"): + def set_config(self, identity, config_name, raw_contents, config_type="raw", trigger_callback=True, + send_update=True): contents = process_raw_config(raw_contents, config_type) self._add_config_to_store(identity, config_name, raw_contents, contents, config_type, - trigger_callback=True) + trigger_callback=trigger_callback, send_update=send_update) @RPC.export @RPC.allow('edit_config_store') - def manage_delete_config(self, identity, config_name): - self.delete(identity, config_name, trigger_callback=True) + def delete_config(self, identity, config_name, trigger_callback=True, send_update=True): + self.delete(identity, config_name, trigger_callback=trigger_callback, send_update=send_update) @RPC.export @RPC.allow('edit_config_store') - def manage_delete_store(self, identity): + def delete_store(self, identity): agent_store = self.store.get(identity) if agent_store is None: return @@ -211,19 +212,19 @@ def manage_delete_store(self, identity): self.store.pop(identity, None) @RPC.export - def manage_list_configs(self, identity): + def list_configs(self, identity): result = list(self.store.get(identity, {}).get("store", {}).keys()) result.sort() return result @RPC.export - def manage_list_stores(self): + def list_stores(self): result = list(self.store.keys()) result.sort() return result @RPC.export - def manage_get(self, identity, config_name, raw=True): + def get_config(self, identity, config_name, raw=True): agent_store = self.store.get(identity) if agent_store is None: raise KeyError('No configuration file "{}" for VIP IDENTIY {}'.format(config_name, identity)) @@ -246,7 +247,7 @@ def manage_get(self, identity, config_name, raw=True): return agent_configs[real_config_name] @RPC.export - def manage_get_metadata(self, identity, config_name): + def get_metadata(self, identity, config_name): agent_store = self.store.get(identity) if agent_store is None: raise KeyError('No configuration file "{}" for VIP IDENTIY {}'.format(config_name, identity)) @@ -270,21 +271,15 @@ def manage_get_metadata(self, identity, config_name): return real_config + @RPC.allow('initialize_agent_config') @RPC.export - def set_config(self, config_name, contents, trigger_callback=False, send_update=True): - identity = self.vip.rpc.context.vip_message.peer - self.store_config(identity, config_name, contents, trigger_callback=trigger_callback, send_update=send_update) - - - @RPC.export - def get_configs(self): + def initialize_configs(self, identity): """ Called by an Agent at startup to trigger initial configuration state push. """ - identity = self.vip.rpc.context.vip_message.peer - #We need to create store and lock if it doesn't exist in case someone + # We need to create store and lock if it doesn't exist in case someone # tries to add a configuration while we are sending the initial state. agent_store = self.store.get(identity) @@ -321,13 +316,6 @@ def get_configs(self): if not agent_disk_store: self.store.pop(identity, None) - @RPC.export - def delete_config(self, config_name, trigger_callback=False, send_update=True): - """Called by an Agent to delete a configuration.""" - identity = self.vip.rpc.context.vip_message.peer - self.delete(identity, config_name, trigger_callback=trigger_callback, - send_update=send_update) - # Helper method to allow the local services to delete configs before message # bus in online. def delete(self, identity, config_name, trigger_callback=False, send_update=True): From f177c3c690d92ff84e72f132f96bf5a6ead1e5a2 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Mon, 14 Aug 2023 17:07:15 -0700 Subject: [PATCH 02/13] calling configstore method that go through auth validations. minor pep8 updates --- .../vip/agent/subsystems/configstore.py | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/volttron/platform/vip/agent/subsystems/configstore.py b/volttron/platform/vip/agent/subsystems/configstore.py index fad44330cc..fb60cc20bb 100644 --- a/volttron/platform/vip/agent/subsystems/configstore.py +++ b/volttron/platform/vip/agent/subsystems/configstore.py @@ -46,6 +46,7 @@ from volttron.platform.storeutils import list_unique_links, check_for_config_link from volttron.platform.vip.agent import errors from volttron.platform.agent.known_identities import CONFIGURATION_STORE +from volttron.platform import jsonapi from collections import defaultdict from copy import deepcopy @@ -60,14 +61,15 @@ _log = logging.getLogger(__name__) -VALID_ACTIONS = set(["NEW", "UPDATE", "DELETE"]) +VALID_ACTIONS = ("NEW", "UPDATE", "DELETE") + class ConfigStore(SubsystemBase): def __init__(self, owner, core, rpc): self._core = weakref.ref(core) self._rpc = weakref.ref(rpc) - self._ref_map = {} #For triggering callbacks. + self._ref_map = {} # For triggering callbacks. self._reverse_ref_map = defaultdict(set) # For triggering callbacks. self._store = {} self._default_store = {} @@ -79,6 +81,7 @@ def __init__(self, owner, core, rpc): self._initial_callbacks_called = False self._process_callbacks_code_object = self._process_callbacks.__code__ + self.vip_identity = self._core().identity def sub_factory(): return defaultdict(set) @@ -95,7 +98,7 @@ def onsetup(sender, **kwargs): def _onconfig(self, sender, **kwargs): if not self._initialized: try: - self._rpc().call(CONFIGURATION_STORE, "get_configs").get() + self._rpc().call(CONFIGURATION_STORE, "initialize_configs", self.vip_identity).get() except errors.Unreachable as e: _log.error("Connected platform does not support the Configuration Store feature.") return @@ -103,7 +106,6 @@ def _onconfig(self, sender, **kwargs): _log.error("Error retrieving agent configurations: {}".format(e)) return - affected_configs = {} for config_name in self._store: affected_configs[config_name] = "NEW" @@ -125,9 +127,8 @@ def _update_refs(self, config_name, contents): self._add_refs(config_name, contents) - def _delete_refs(self, config_name): - #Delete refs if they exist. + # Delete refs if they exist. old_refs = self._ref_map.pop(config_name, set()) for ref in old_refs: @@ -136,7 +137,6 @@ def _delete_refs(self, config_name): if not reverse_ref_set: del self._reverse_ref_map[ref] - def _initial_update(self, configs, reset_name_map=True): self._initialized = True self._store = {key.lower(): value for (key, value) in configs.items()} @@ -150,7 +150,6 @@ def _initial_update(self, configs, reset_name_map=True): if config_name not in self._store: self._add_refs(config_name, config_contents) - def _process_links(self, config_contents, already_gathered): if isinstance(config_contents, dict): for key, value in config_contents.items(): @@ -184,7 +183,6 @@ def _gather_child_configs(self, config_name, already_gathered): return config_contents - def _gather_config(self, config_name): config_contents = self._store.get(config_name) if config_contents is None: @@ -197,8 +195,6 @@ def _gather_config(self, config_name): return self._gather_child_configs(config_name, already_configured) - - def _gather_affected(self, config_name, seen_dict): reverse_refs = self._reverse_ref_map[config_name] for ref in reverse_refs: @@ -206,16 +202,15 @@ def _gather_affected(self, config_name, seen_dict): seen_dict[ref] = "UPDATE" self._gather_affected(ref, seen_dict) - def _update_config(self, action, config_name, contents=None, trigger_callback=False): """Called by the platform to push out configuration changes.""" - #If we haven't yet grabbed the initial callback state we just bail. + # If we haven't yet grabbed the initial callback state we just bail. if not self._initialized: return affected_configs = {} - #Update local store. + # Update local store. if action == "DELETE": config_name_lower = config_name.lower() if config_name_lower in self._store: @@ -233,7 +228,7 @@ def _update_config(self, action, config_name, contents=None, trigger_callback=Fa if action == "DELETE_ALL": for name in self._store: affected_configs[name] = "DELETE" - #Just assume all default stores updated. + # Just assume all default stores updated. for name in self._default_store: affected_configs[name] = "UPDATE" self._ref_map = {} @@ -250,7 +245,6 @@ def _update_config(self, action, config_name, contents=None, trigger_callback=Fa self._update_refs(config_name_lower, self._store[config_name_lower]) self._gather_affected(config_name_lower, affected_configs) - if trigger_callback and self._initial_callbacks_called: self._process_callbacks(affected_configs) @@ -260,13 +254,11 @@ def _update_config(self, action, config_name, contents=None, trigger_callback=Fa if action == "DELETE_ALL": self._name_map.clear() - - def _process_callbacks(self, affected_configs): _log.debug("Processing callbacks for affected files: {}".format(affected_configs)) all_map = self._default_name_map.copy() all_map.update(self._name_map) - #Always process "config" first. + # Always process "config" first. if "config" in affected_configs: self._process_callbacks_one_config("config", affected_configs["config"], all_map) @@ -275,7 +267,6 @@ def _process_callbacks(self, affected_configs): continue self._process_callbacks_one_config(config_name, action, all_map) - def _process_callbacks_one_config(self, config_name, action, name_map): callbacks = set() for pattern, actions in self._subscriptions.items(): @@ -306,7 +297,7 @@ def list(self): # Handle case were we are called during "onstart". if not self._initialized: try: - self._rpc().call(CONFIGURATION_STORE, "get_configs").get() + self._rpc().call(CONFIGURATION_STORE, "initialize_configs", self.vip_identity).get() except errors.Unreachable as e: _log.error("Connected platform does not support the Configuration Store feature.") except errors.VIPError as e: @@ -332,13 +323,13 @@ def get(self, config_name="config"): :Return Values: The contents of the configuration specified. """ - #Handle case were we are called during "onstart". + # Handle case were we are called during "onstart". - #If we fail to initialize we don't raise an exception as there still - #may be a default configuration to grab. + # If we fail to initialize we don't raise an exception as there still + # may be a default configuration to grab. if not self._initialized: try: - self._rpc().call(CONFIGURATION_STORE, "get_configs").get() + self._rpc().call(CONFIGURATION_STORE, "initialize_configs", self.vip_identity).get() except errors.Unreachable as e: _log.error("Connected platform does not support the Configuration Store feature.") except errors.VIPError as e: @@ -351,14 +342,13 @@ def get(self, config_name="config"): def _check_call_from_process_callbacks(self): frame_records = inspect.stack() try: - #Don't create any unneeded references to frame objects. + # Don't create any unneeded references to frame objects. for frame, *_ in frame_records: if self._process_callbacks_code_object is frame.f_code: raise RuntimeError("Cannot request changes to the config store from a configuration callback.") finally: del frame_records - def set(self, config_name, contents, trigger_callback=False, send_update=True): """Called to set the contents of a configuration. @@ -369,6 +359,8 @@ def set(self, config_name, contents, trigger_callback=False, send_update=True): :param config_name: Name of configuration to add to store. :param contents: Contents of the configuration. May be a string, dictionary, or list. :param trigger_callback: Tell the platform to trigger callbacks on the agent for this change. + :param send_update: Boolean flag to tell the server if it should call config.update on this agent + after server side update is done :type config_name: str :type contents: str, dict, list @@ -376,9 +368,17 @@ def set(self, config_name, contents, trigger_callback=False, send_update=True): """ self._check_call_from_process_callbacks() - self._rpc().call(CONFIGURATION_STORE, "set_config", config_name, contents, - trigger_callback=trigger_callback, - send_update=send_update).get(timeout=10.0) + if isinstance(contents, (dict, list)): + config_type = 'json' + raw_data = jsonapi.dumps(contents) + elif isinstance(contents, str): + config_type = 'raw' + raw_data = contents + else: + raise ValueError("Unsupported configuration content type: {}".format(str(type(contents)))) + + self._rpc().call(CONFIGURATION_STORE, "set_config", self.vip_identity, config_name, raw_data, + config_type, trigger_callback=trigger_callback, send_update=send_update).get(timeout=10.0) def set_default(self, config_name, contents): """Called to set the contents of a default configuration file. Default configurations are used if the @@ -426,7 +426,6 @@ def delete_default(self, config_name): self._update_refs(config_name_lower, self._store[config_name_lower]) - def delete(self, config_name, trigger_callback=False, send_update=True): """Delete a configuration by name. May not be called from a callback as this will cause deadlock with the platform. Will produce a runtime error if done so. @@ -438,7 +437,7 @@ def delete(self, config_name, trigger_callback=False, send_update=True): """ self._check_call_from_process_callbacks() - self._rpc().call(CONFIGURATION_STORE, "delete_config", config_name, + self._rpc().call(CONFIGURATION_STORE, "delete_config", self.vip_identity, config_name, trigger_callback=trigger_callback, send_update=send_update).get(timeout=10.0) @@ -446,7 +445,8 @@ def subscribe(self, callback, actions=VALID_ACTIONS, pattern="*"): """Subscribe to changes to a configuration. :param callback: Function to call in response to changes to a configuration. - :param actions: Change actions to respond to. Valid values are "NEW", "UPDATE", and "DELETE". May be a single action or a list of actions. + :param actions: Change actions to respond to. Valid values are "NEW", "UPDATE", and "DELETE". + May be a single action or a list of actions. :param pattern: Configuration name pattern to match to. Uses Unix style filename pattern matching. :type callback: str @@ -458,9 +458,9 @@ def subscribe(self, callback, actions=VALID_ACTIONS, pattern="*"): actions = set(action.upper() for action in actions) - invalid_actions = actions - VALID_ACTIONS + invalid_actions = actions - set(VALID_ACTIONS) if invalid_actions: - raise ValueError("Invalid actions: " + list(invalid_actions)) + raise ValueError(f"Invalid actions: {invalid_actions}") pattern = pattern.lower() From 7e625d9f9842e1ca0ee759b3ad7005eb73dbfc5c Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Mon, 14 Aug 2023 17:07:44 -0700 Subject: [PATCH 03/13] Added auth restrictions to config update methods --- volttron/platform/vip/agent/subsystems/configstore.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/volttron/platform/vip/agent/subsystems/configstore.py b/volttron/platform/vip/agent/subsystems/configstore.py index fb60cc20bb..975ef6a257 100644 --- a/volttron/platform/vip/agent/subsystems/configstore.py +++ b/volttron/platform/vip/agent/subsystems/configstore.py @@ -90,7 +90,9 @@ def sub_factory(): def onsetup(sender, **kwargs): rpc.export(self._update_config, 'config.update') + rpc.allow('config.update', 'sync_agent_config') rpc.export(self._initial_update, 'config.initial_update') + rpc.allow('config.initial_update', 'sync_agent_config') core.onsetup.connect(onsetup, self) core.configuration.connect(self._onconfig, self) From 9e1930751fb6543562cd40056f31baa0b3a8fce3 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Mon, 14 Aug 2023 17:43:39 -0700 Subject: [PATCH 04/13] config store auth updates --- .../tests/test_dnp3_driver.py | 4 +- .../tests/test_config_actuation.py | 2 +- examples/ConfigActuation/update_config.py | 6 +- scripts/extract_config_store.py | 4 +- scripts/install_platform_driver_configs.py | 8 +- .../tests/test_influxdb_historian.py | 2 +- .../core/DNP3Agent/tests/test_dnp3_agent.py | 2 +- .../core/DNP3Agent/tests/test_mesa_agent.py | 4 +- .../tests/test_IEEE2030_5_agent.py | 6 +- .../tests/test_IEEE2030_5_driver.py | 6 +- .../tests/test_chargepoint_driver.py | 8 +- .../platform_driver/interfaces/ecobee.py | 4 +- .../modbus_tk/tests/test_battery_meter.py | 8 +- .../modbus_tk/tests/test_ion6200.py | 8 +- .../modbus_tk/tests/test_mixed_endian.py | 12 +- .../modbus_tk/tests/test_modbus_tk_driver.py | 12 +- .../modbus_tk/tests/test_scale_reg.py | 12 +- .../modbus_tk/tests/test_scale_reg_pow_10.py | 8 +- .../modbus_tk/tests/test_scrape_all.py | 12 +- .../modbus_tk/tests/test_watts_on.py | 8 +- .../tests/test_write_single_registers.py | 8 +- .../platform_driver/interfaces/universal.py | 2 +- .../PlatformDriverAgent/tests/test_bacnet.py | 6 +- .../tests/test_device_groups.py | 8 +- .../tests/test_device_groups_p2.py | 8 +- .../PlatformDriverAgent/tests/test_eagle.py | 6 +- .../tests/test_ecobee_driver.py | 4 +- .../tests/test_global_override.py | 10 +- .../tests/test_global_settings.py | 6 +- .../tests/test_modbus_driver.py | 6 +- .../tests/test_rest_driver.py | 6 +- .../tests/test_vc_autoregister.py | 4 +- .../tests/test_platform_agent_rpc.py | 4 +- .../vcplatform/agent.py | 14 +-- .../tests/test_threshold_detection.py | 10 +- volttron/platform/control/control_config.py | 16 +-- volttron/platform/web/topic_tree.py | 6 +- volttron/platform/web/vui_endpoints.py | 14 +-- .../fixtures/volttron_platform_fixtures.py | 4 +- .../test_multiplatform_pubsub.py | 4 +- .../security/SecurityAgent/security/agent.py | 6 +- .../platform/web/test_topic_tree.py | 6 +- .../platform/web/test_vui_endpoints.py | 14 +-- .../test_aggregate_historian.py | 14 +-- .../services/historian/test_base_historian.py | 2 +- .../subsystems/test_config_store.py | 119 ++++++++++-------- 46 files changed, 226 insertions(+), 217 deletions(-) diff --git a/deprecated/OldDnp3/OldDnp3Driver/PlatformDriverAgent/tests/test_dnp3_driver.py b/deprecated/OldDnp3/OldDnp3Driver/PlatformDriverAgent/tests/test_dnp3_driver.py index f0a12f4dfb..44fc8d0b06 100644 --- a/deprecated/OldDnp3/OldDnp3Driver/PlatformDriverAgent/tests/test_dnp3_driver.py +++ b/deprecated/OldDnp3/OldDnp3Driver/PlatformDriverAgent/tests/test_dnp3_driver.py @@ -80,7 +80,7 @@ def agent(request, volttron_instance): test_agent = volttron_instance.build_agent() def update_config(agent_id, name, value, cfg_type): - test_agent.vip.rpc.call('config.store', 'manage_store', agent_id, name, value, config_type=cfg_type) + test_agent.vip.rpc.call('config.store', 'set_config', agent_id, name, value, config_type=cfg_type) capabilities = {'edit_config_store': {'identity': PLATFORM_DRIVER}} volttron_instance.add_capabilities(test_agent.core.publickey, capabilities) @@ -95,7 +95,7 @@ def update_config(agent_id, name, value, cfg_type): # Build and start PlatformDriverAgent - test_agent.vip.rpc.call('config.store', 'manage_delete_store', PLATFORM_DRIVER) + test_agent.vip.rpc.call('config.store', 'delete_store', PLATFORM_DRIVER) platform_uuid = volttron_instance.install_agent(agent_dir=get_services_core("PlatformDriverAgent"), config_file={}, diff --git a/examples/ConfigActuation/tests/test_config_actuation.py b/examples/ConfigActuation/tests/test_config_actuation.py index ecbd3abe33..c134d5e38a 100644 --- a/examples/ConfigActuation/tests/test_config_actuation.py +++ b/examples/ConfigActuation/tests/test_config_actuation.py @@ -157,7 +157,7 @@ def test_thing(publish_agent): assert value == 10.0 publish_agent.vip.rpc.call(CONFIGURATION_STORE, - "manage_store", + "set_config", "config_actuation", "fakedriver", jsonapi.dumps({"SampleWritableFloat1": 42.0}), diff --git a/examples/ConfigActuation/update_config.py b/examples/ConfigActuation/update_config.py index abf1ebc774..f8e7624c4c 100644 --- a/examples/ConfigActuation/update_config.py +++ b/examples/ConfigActuation/update_config.py @@ -97,21 +97,21 @@ def main(): agent = build_agent(**get_keys()) files = agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_list_configs', + 'list_configs', vip_id).get(timeout=10) if filename not in files: config = {key: value} else: config = agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_get', + 'get_config', vip_id, filename).get(timeout=10) config = jsonapi.loads(config) config[key] = value agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', vip_id, filename, jsonapi.dumps(config), diff --git a/scripts/extract_config_store.py b/scripts/extract_config_store.py index 5e56afa817..583feebb2b 100644 --- a/scripts/extract_config_store.py +++ b/scripts/extract_config_store.py @@ -74,7 +74,7 @@ def get_configs(config_id, output_directory): event.wait() config_list = agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_list_configs', + 'list_configs', config_id).get(timeout=10) if not config_list: @@ -88,7 +88,7 @@ def get_configs(config_id, output_directory): for config in config_list: print("Retrieving configuration", config) raw_config = agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_get', + 'get_config', config_id, config, raw=True).get(timeout=10) diff --git a/scripts/install_platform_driver_configs.py b/scripts/install_platform_driver_configs.py index 9bdf02ed86..43816cca4c 100644 --- a/scripts/install_platform_driver_configs.py +++ b/scripts/install_platform_driver_configs.py @@ -89,13 +89,13 @@ def install_configs(input_directory, keep=False): if not keep: print("Deleting old Platform Driver store") agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get(timeout=10) with open("config") as f: print("Storing main configuration") agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'config', f.read(), @@ -105,7 +105,7 @@ def install_configs(input_directory, keep=False): with open(name) as f: print("Storing configuration:", name) agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, name, f.read(), @@ -117,7 +117,7 @@ def install_configs(input_directory, keep=False): with open(name) as f: print("Storing configuration:", name) agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, name, f.read(), diff --git a/services/contrib/InfluxdbHistorian/tests/test_influxdb_historian.py b/services/contrib/InfluxdbHistorian/tests/test_influxdb_historian.py index 17d82b4a57..b6218d58a5 100644 --- a/services/contrib/InfluxdbHistorian/tests/test_influxdb_historian.py +++ b/services/contrib/InfluxdbHistorian/tests/test_influxdb_historian.py @@ -1332,7 +1332,7 @@ def test_update_config_store(volttron_instance, influxdb_client): publish_some_fake_data(publisher, 5) # Update config store - publisher.vip.rpc.call('config.store', 'manage_store', 'influxdb.historian', 'config', + publisher.vip.rpc.call('config.store', 'set_config', 'influxdb.historian', 'config', jsonapi.dumps(updated_influxdb_config), config_type="json").get(timeout=10) publish_some_fake_data(publisher, 5) diff --git a/services/core/DNP3Agent/tests/test_dnp3_agent.py b/services/core/DNP3Agent/tests/test_dnp3_agent.py index e497beb30b..65214e5681 100644 --- a/services/core/DNP3Agent/tests/test_dnp3_agent.py +++ b/services/core/DNP3Agent/tests/test_dnp3_agent.py @@ -118,7 +118,7 @@ def add_definitions_to_config_store(test_agent): """Add PointDefinitions to the mesaagent's config store.""" with open(POINT_DEFINITIONS_PATH, 'r') as f: points_json = jsonapi.loads(strip_comments(f.read())) - test_agent.vip.rpc.call('config.store', 'manage_store', DNP3_AGENT_ID, + test_agent.vip.rpc.call('config.store', 'set_config', DNP3_AGENT_ID, 'mesa_points.config', points_json, config_type='raw') diff --git a/services/core/DNP3Agent/tests/test_mesa_agent.py b/services/core/DNP3Agent/tests/test_mesa_agent.py index bfe4687c8f..c92604b3c2 100644 --- a/services/core/DNP3Agent/tests/test_mesa_agent.py +++ b/services/core/DNP3Agent/tests/test_mesa_agent.py @@ -100,11 +100,11 @@ def add_definitions_to_config_store(test_agent): """Add PointDefinitions and FunctionDefinitions to the mesaagent's config store.""" with open(POINT_DEFINITIONS_PATH, 'r') as f: points_json = jsonapi.loads(strip_comments(f.read())) - test_agent.vip.rpc.call('config.store', 'manage_store', MESA_AGENT_ID, + test_agent.vip.rpc.call('config.store', 'set_config', MESA_AGENT_ID, 'mesa_points.config', points_json, config_type='raw') with open(FUNCTION_DEFINITIONS_PATH, 'r') as f: functions_json = yaml.safe_load(f.read()) - test_agent.vip.rpc.call('config.store', 'manage_store', MESA_AGENT_ID, + test_agent.vip.rpc.call('config.store', 'set_config', MESA_AGENT_ID, 'mesa_functions.config', functions_json, config_type='raw') diff --git a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py index f1d94b8ce3..5b931a0b65 100644 --- a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py +++ b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_agent.py @@ -106,8 +106,8 @@ def agent(request, volttron_instance_module_web): capabilities = {'edit_config_store': {'identity': PLATFORM_DRIVER}} volttron_instance_module_web.add_capabilities(test_agent.core.publickey, capabilities) # Configure a IEEE 2030.5 device in the Platform Driver - test_agent.vip.rpc.call('config.store', 'manage_delete_store', PLATFORM_DRIVER).get(timeout=10) - test_agent.vip.rpc.call('config.store', 'manage_store', PLATFORM_DRIVER, + test_agent.vip.rpc.call('config.store', 'delete_store', PLATFORM_DRIVER).get(timeout=10) + test_agent.vip.rpc.call('config.store', 'set_config', PLATFORM_DRIVER, 'devices/{}'.format(DRIVER_NAME), """{ "driver_config": { @@ -124,7 +124,7 @@ def agent(request, volttron_instance_module_web): "heart_beat_point": "Heartbeat" }""", 'json').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'manage_store', PLATFORM_DRIVER, + test_agent.vip.rpc.call('config.store', 'set_config', PLATFORM_DRIVER, 'IEEE2030_5.csv', REGISTRY_CONFIG_STRING, 'csv').get(timeout=10) diff --git a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py index 40e76206ac..ced543a8be 100644 --- a/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py +++ b/services/core/IEEE2030_5Agent/tests/test_IEEE2030_5_driver.py @@ -130,8 +130,8 @@ def agent(request, volttron_instance_module_web): test_agent = volttron_instance_module_web.build_agent() # Configure a IEEE 2030.5 device in the Platform Driver - test_agent.vip.rpc.call('config.store', 'manage_delete_store', 'platform.driver').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'manage_store', 'platform.driver', + test_agent.vip.rpc.call('config.store', 'delete_store', 'platform.driver').get(timeout=10) + test_agent.vip.rpc.call('config.store', 'set_config', 'platform.driver', 'devices/{}'.format(DRIVER_NAME), """{ "driver_config": { @@ -148,7 +148,7 @@ def agent(request, volttron_instance_module_web): "heart_beat_point": "Heartbeat" }""", 'json').get(timeout=10) - test_agent.vip.rpc.call('config.store', 'manage_store', 'platform.driver', + test_agent.vip.rpc.call('config.store', 'set_config', 'platform.driver', 'IEEE2030_5.csv', REGISTRY_CONFIG_STRING, 'csv').get(timeout=10) diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/chargepoint/tests/test_chargepoint_driver.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/chargepoint/tests/test_chargepoint_driver.py index 7851d675e4..ccd6197c9b 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/chargepoint/tests/test_chargepoint_driver.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/chargepoint/tests/test_chargepoint_driver.py @@ -157,7 +157,7 @@ def agent(request, volttron_instance): md_agent = volttron_instance.build_agent() # Clean out platform driver configurations. md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', 'platform.driver').get(timeout=10) driver1_config = DRIVER1_CONFIG_STRING % os.environ.get('CHARGEPOINT_PASSWORD', 'Must set a password') @@ -166,21 +166,21 @@ def agent(request, volttron_instance): # Add test configurations. md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'devices/chargepoint1', driver1_config, 'json').get(timeout=10) md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'devices/chargepoint2', driver2_config, 'json').get(timeout=10) md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'chargepoint.csv', REGISTRY_CONFIG_STRING, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/ecobee.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/ecobee.py index 6b2ceb6901..1e81a01d26 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/ecobee.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/ecobee.py @@ -287,10 +287,10 @@ def get_auth_config_from_store(self): :return: Fetch currently stored auth configuration info from config store, returns empty dict if none is present """ - configs = self.vip.rpc.call(CONFIGURATION_STORE, "manage_list_configs", PLATFORM_DRIVER).get(timeout=3) + configs = self.vip.rpc.call(CONFIGURATION_STORE, "list_configs", PLATFORM_DRIVER).get(timeout=3) if self.auth_config_path in configs: return jsonapi.loads(self.vip.rpc.call( - CONFIGURATION_STORE, "manage_get", PLATFORM_DRIVER, self.auth_config_path).get(timeout=3)) + CONFIGURATION_STORE, "get_config", PLATFORM_DRIVER, self.auth_config_path).get(timeout=3)) else: _log.warning("No Ecobee auth file found in config store") return {} diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_battery_meter.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_battery_meter.py index 43313652e2..9c890fd779 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_battery_meter.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_battery_meter.py @@ -282,12 +282,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', jsonapi.dumps(DRIVER_CONFIG), @@ -295,14 +295,14 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', REGISTER_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_ion6200.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_ion6200.py index e4c91934f2..6215d688c0 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_ion6200.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_ion6200.py @@ -88,12 +88,12 @@ def ion_driver_agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/ion6200', ION6200_DRIVER_CONFIG, @@ -101,14 +101,14 @@ def ion_driver_agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'ion6200.csv', ION6200_CSV_CONFIG, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'ion6200_map.csv', ION6200_CSV_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_mixed_endian.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_mixed_endian.py index b4201a6189..e90d1df07f 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_mixed_endian.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_mixed_endian.py @@ -87,19 +87,19 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus', ORIGINAL_DRIVER_CONFIG, config_type='json') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', NEW_DRIVER_CONFIG, @@ -107,21 +107,21 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus.csv', ORIGINAL_REGISTRY_CONFIG, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', NEW_REGISTRY_CONFIG, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', NEW_REGISTER_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_modbus_tk_driver.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_modbus_tk_driver.py index b422962f3f..c13d00079b 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_modbus_tk_driver.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_modbus_tk_driver.py @@ -111,19 +111,19 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', jsonapi.dumps(DRIVER_CONFIG), config_type='json') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus', jsonapi.dumps(OLD_VOLTTRON_DRIVER_CONFIG), @@ -131,21 +131,21 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', REGISTER_MAP, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus.csv', OLD_VOLTTRON_REGISTRY_CONFIG, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg.py index 17d9f3fe92..c93d3a00e7 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg.py @@ -58,12 +58,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', DRIVER_CONFIG_STRING, @@ -71,22 +71,22 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', REGISTER_MAP, config_type='csv') platform_uuid = volttron_instance.install_agent(agent_dir=get_services_core("PlatformDriverAgent"), - config_file={}, - start=True) + config_file={}, + start=True) gevent.sleep(10) # wait for the agent to start and start the devices diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg_pow_10.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg_pow_10.py index 673b7ae88d..329f6b9732 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg_pow_10.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scale_reg_pow_10.py @@ -58,12 +58,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', DRIVER_CONFIG_STRING, @@ -71,14 +71,14 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', REGISTER_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scrape_all.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scrape_all.py index 9c8dcb318d..6ab19d5c17 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scrape_all.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_scrape_all.py @@ -101,19 +101,19 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus_tk', jsonapi.dumps(DRIVER_CONFIG), config_type='json') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus', jsonapi.dumps(OLD_VOLTTRON_DRIVER_CONFIG), @@ -121,21 +121,21 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus_tk_map.csv', REGISTER_MAP, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus.csv', OLD_VOLTTRON_REGISTRY_CONFIG, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_watts_on.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_watts_on.py index efb8f15515..45aba42e9a 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_watts_on.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_watts_on.py @@ -66,12 +66,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'devices/watts_on', DRIVER_CONFIG_STRING, @@ -79,14 +79,14 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'watts_on.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', 'platform.driver', 'watts_on_map.csv', REGISTRY_CONFIG_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_write_single_registers.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_write_single_registers.py index b6027ee010..178dc2d4bf 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_write_single_registers.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/modbus_tk/tests/test_write_single_registers.py @@ -56,12 +56,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/write_single_registers', DRIVER_CONFIG_STRING, @@ -69,14 +69,14 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'write_single_registers.csv', REGISTRY_CONFIG_STRING, config_type='csv') md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'write_single_registers_map.csv', REGISTRY_CONFIG_MAP, diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/universal.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/universal.py index 100d6314e2..702b2183a6 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/universal.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/universal.py @@ -112,7 +112,7 @@ def configure(self, config_dict, registry_config_str): which calls volttron/platform/store.py: def get_configs(self): self.vip.rpc.call(identity, "config.initial_update" sets list of registry_configs - scripts/install_platform_driver_configs.py calls 'manage_store' rpc, which is in volttron/platform/store.py + scripts/install_platform_driver_configs.py calls 'set_config' rpc, which is in volttron/platform/store.py which calls process_raw_config(), which stores it as a dict. process_raw_config() is also called by process_store() in store.py when the platform starts ( class ConfigStoreService): diff --git a/services/core/PlatformDriverAgent/tests/test_bacnet.py b/services/core/PlatformDriverAgent/tests/test_bacnet.py index 2eef334f90..2058de7ad0 100644 --- a/services/core/PlatformDriverAgent/tests/test_bacnet.py +++ b/services/core/PlatformDriverAgent/tests/test_bacnet.py @@ -184,7 +184,7 @@ def config_store(config_store_connection): # registry config config_store_connection.call( - "manage_store", + "set_config", PLATFORM_DRIVER, registry_config, registry_string, @@ -201,7 +201,7 @@ def config_store(config_store_connection): } config_store_connection.call( - "manage_store", + "set_config", PLATFORM_DRIVER, BACNET_DEVICE_TOPIC, driver_config, @@ -210,5 +210,5 @@ def config_store(config_store_connection): yield config_store_connection print("Wiping out store.") - config_store_connection.call("manage_delete_store", PLATFORM_DRIVER) + config_store_connection.call("delete_store", PLATFORM_DRIVER) gevent.sleep(0.1) diff --git a/services/core/PlatformDriverAgent/tests/test_device_groups.py b/services/core/PlatformDriverAgent/tests/test_device_groups.py index 4f4a801610..aa35fc055f 100644 --- a/services/core/PlatformDriverAgent/tests/test_device_groups.py +++ b/services/core/PlatformDriverAgent/tests/test_device_groups.py @@ -136,12 +136,12 @@ def test_agent(volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config - md_agent.vip.rpc.call("config.store", "manage_delete_store", PLATFORM_DRIVER).get() + md_agent.vip.rpc.call("config.store", "delete_store", PLATFORM_DRIVER).get() # Add a fake.csv to the config store md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, "fake.csv", registry_config_string, @@ -166,7 +166,7 @@ def setup_config(test_agent, config_name, config_string, **kwargs): print("Adding", config_name, "to store") test_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, config_name, config, @@ -177,7 +177,7 @@ def setup_config(test_agent, config_name, config_string, **kwargs): def remove_config(test_agent, config_name): print("Removing", config_name, "from store") test_agent.vip.rpc.call( - "config.store", "manage_delete_config", PLATFORM_DRIVER, config_name + "config.store", "delete_config", PLATFORM_DRIVER, config_name ).get() diff --git a/services/core/PlatformDriverAgent/tests/test_device_groups_p2.py b/services/core/PlatformDriverAgent/tests/test_device_groups_p2.py index 652b26f3f8..9a519b3604 100644 --- a/services/core/PlatformDriverAgent/tests/test_device_groups_p2.py +++ b/services/core/PlatformDriverAgent/tests/test_device_groups_p2.py @@ -195,12 +195,12 @@ def test_agent(volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config - md_agent.vip.rpc.call("config.store", "manage_delete_store", PLATFORM_DRIVER).get() + md_agent.vip.rpc.call("config.store", "delete_store", PLATFORM_DRIVER).get() # Add a fake.csv to the config store md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, "fake.csv", registry_config_string, @@ -225,7 +225,7 @@ def setup_config(test_agent, config_name, config_string, **kwargs): print("Adding", config_name, "to store") test_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, config_name, config, @@ -236,5 +236,5 @@ def setup_config(test_agent, config_name, config_string, **kwargs): def remove_config(test_agent, config_name): print("Removing", config_name, "from store") test_agent.vip.rpc.call( - "config.store", "manage_delete_config", PLATFORM_DRIVER, config_name + "config.store", "delete_config", PLATFORM_DRIVER, config_name ).get() diff --git a/services/core/PlatformDriverAgent/tests/test_eagle.py b/services/core/PlatformDriverAgent/tests/test_eagle.py index 8856236739..59ac050895 100644 --- a/services/core/PlatformDriverAgent/tests/test_eagle.py +++ b/services/core/PlatformDriverAgent/tests/test_eagle.py @@ -202,19 +202,19 @@ def agent(volttron_instance): volttron_instance.add_capabilities(agent.core.publickey, capabilities) # Clean out platform driver configurations. agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get(timeout=10) # Add test configurations. agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, "devices/campus/building/unit", driver_config_string, "json").get(timeout=10) agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, "eagle.json", register_config_string, diff --git a/services/core/PlatformDriverAgent/tests/test_ecobee_driver.py b/services/core/PlatformDriverAgent/tests/test_ecobee_driver.py index 984e7fe264..827ec0c491 100644 --- a/services/core/PlatformDriverAgent/tests/test_ecobee_driver.py +++ b/services/core/PlatformDriverAgent/tests/test_ecobee_driver.py @@ -578,14 +578,14 @@ def test_scrape_all_trigger_refresh(mock_ecobee): # } # ecobee_driver_config = jsonapi.load(get_examples("configurations/drivers/ecobee.config")) # ecobee_driver_config["interval"] = 3 -# query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", PLATFORM_DRIVER, +# query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", PLATFORM_DRIVER, # "devices/campus/building/test_ecobee", driver_config) # # with open("configurations/drivers/ecobee.csv") as registry_file: # registry_string = registry_file.read() # registry_path = re.search("(?!config:\/\/)[a-zA-z]+\.csv", ecobee_driver_config.get("registry_config")) # -# query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", PLATFORM_DRIVER, registry_path, registry_string, +# query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", PLATFORM_DRIVER, registry_path, registry_string, # config_type="csv") # # ecobee_driver_config.update(driver_config) diff --git a/services/core/PlatformDriverAgent/tests/test_global_override.py b/services/core/PlatformDriverAgent/tests/test_global_override.py index 4c0f3a17c7..0bcb5956f2 100644 --- a/services/core/PlatformDriverAgent/tests/test_global_override.py +++ b/services/core/PlatformDriverAgent/tests/test_global_override.py @@ -88,12 +88,12 @@ def test_agent(volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config - md_agent.vip.rpc.call("config.store", "manage_delete_store", PLATFORM_DRIVER).get() + md_agent.vip.rpc.call("config.store", "delete_store", PLATFORM_DRIVER).get() # Add configuration for platform driver md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, "config", jsonapi.dumps(PLATFORM_DRIVER_CONFIG), @@ -108,7 +108,7 @@ def test_agent(volttron_instance): registry_config_string = f.read() md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, "fake.csv", registry_config_string, @@ -120,7 +120,7 @@ def test_agent(volttron_instance): config_name = f"devices/fakedriver{i}" md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, config_name, jsonapi.dumps(FAKE_DEVICE_CONFIG), @@ -790,7 +790,7 @@ def test_override_pattern(test_agent): config_name = config_path.format(camel_device_path) test_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, config_name, jsonapi.dumps(FAKE_DEVICE_CONFIG), diff --git a/services/core/PlatformDriverAgent/tests/test_global_settings.py b/services/core/PlatformDriverAgent/tests/test_global_settings.py index 67a245019e..780035e39c 100644 --- a/services/core/PlatformDriverAgent/tests/test_global_settings.py +++ b/services/core/PlatformDriverAgent/tests/test_global_settings.py @@ -167,12 +167,12 @@ def test_agent(volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config - md_agent.vip.rpc.call("config.store", "manage_delete_store", PLATFORM_DRIVER).get() + md_agent.vip.rpc.call("config.store", "delete_store", PLATFORM_DRIVER).get() # Add a fake.csv to the config store md_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, "fake.csv", registry_config_string, @@ -197,7 +197,7 @@ def setup_config(test_agent, config_name, config_string, **kwargs): print("Adding", config_name, "to store") test_agent.vip.rpc.call( "config.store", - "manage_store", + "set_config", PLATFORM_DRIVER, config_name, config, diff --git a/services/core/PlatformDriverAgent/tests/test_modbus_driver.py b/services/core/PlatformDriverAgent/tests/test_modbus_driver.py index b70491ab6b..41320a1f0a 100644 --- a/services/core/PlatformDriverAgent/tests/test_modbus_driver.py +++ b/services/core/PlatformDriverAgent/tests/test_modbus_driver.py @@ -80,12 +80,12 @@ def agent(request, volttron_instance): # Clean out platform driver configurations # wait for it to return before adding new config md_agent.vip.rpc.call('config.store', - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get() # Add driver configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'devices/modbus', jsonapi.dumps(DRIVER_CONFIG), @@ -93,7 +93,7 @@ def agent(request, volttron_instance): # Add csv configurations md_agent.vip.rpc.call('config.store', - 'manage_store', + 'set_config', PLATFORM_DRIVER, 'modbus.csv', REGISTRY_CONFIG_STRING, diff --git a/services/core/PlatformDriverAgent/tests/test_rest_driver.py b/services/core/PlatformDriverAgent/tests/test_rest_driver.py index f93c4a3cb8..6a50ce3a28 100644 --- a/services/core/PlatformDriverAgent/tests/test_rest_driver.py +++ b/services/core/PlatformDriverAgent/tests/test_rest_driver.py @@ -82,19 +82,19 @@ def agent(request, volttron_instance): capabilities = {'edit_config_store': {'identity': PLATFORM_DRIVER}} volttron_instance.add_capabilities(agent.core.publickey, capabilities) agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_delete_store', + 'delete_store', PLATFORM_DRIVER).get(timeout=10) # Add test configurations. agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, "devices/campus/building/unit", driver_config_dict_string, "json").get(timeout=10) agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', PLATFORM_DRIVER, "restful.csv", restful_csv_string, diff --git a/services/core/VolttronCentral/tests/test_vc_autoregister.py b/services/core/VolttronCentral/tests/test_vc_autoregister.py index d50e752ba7..b7e7109089 100644 --- a/services/core/VolttronCentral/tests/test_vc_autoregister.py +++ b/services/core/VolttronCentral/tests/test_vc_autoregister.py @@ -32,12 +32,12 @@ def multi_messagebus_vc_vcp(volttron_multi_messagebus): # capabilities = {'edit_config_store': {'identity': VOLTTRON_CENTRAL_PLATFORM}} # vcp_instance.add_capabilities(vcp_instance.dynamic_agent.core.publickey, capabilities) vcp_instance.dynamic_agent.vip.rpc.call(CONFIGURATION_STORE, - "manage_store", + "set_config", VOLTTRON_CENTRAL_PLATFORM, "config", config, "json").get() - # "manage_store", opts.identity, opts.name, file_contents, config_type = opts.config_type + # "set_config", opts.identity, opts.name, file_contents, config_type = opts.config_type # Allows connections between platforms to be established. gevent.sleep(20) yield vcp_instance, vc_instance, vcp_uuid diff --git a/services/core/VolttronCentralPlatform/tests/test_platform_agent_rpc.py b/services/core/VolttronCentralPlatform/tests/test_platform_agent_rpc.py index f52594a398..1ec429ff20 100644 --- a/services/core/VolttronCentralPlatform/tests/test_platform_agent_rpc.py +++ b/services/core/VolttronCentralPlatform/tests/test_platform_agent_rpc.py @@ -226,7 +226,7 @@ def test_can_change_topic_map(setup_platform, vc_agent): # now update the config store for vcp vc.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', VOLTTRON_CENTRAL_PLATFORM, 'config', jsonapi.dumps(replace_map), @@ -247,7 +247,7 @@ def test_can_change_topic_map(setup_platform, vc_agent): # now update the config store for vcp vc.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', VOLTTRON_CENTRAL_PLATFORM, 'config', jsonapi.dumps(replace_map), diff --git a/services/core/VolttronCentralPlatform/vcplatform/agent.py b/services/core/VolttronCentralPlatform/vcplatform/agent.py index c17d023ee8..c8189cbeba 100644 --- a/services/core/VolttronCentralPlatform/vcplatform/agent.py +++ b/services/core/VolttronCentralPlatform/vcplatform/agent.py @@ -812,21 +812,21 @@ def list_agents(self): def store_agent_config(self, agent_identity, config_name, raw_contents, config_type='raw'): _log.debug("Storeing configuration file: {}".format(config_name)) - self.vip.rpc.call(CONFIGURATION_STORE, "manage_store", agent_identity, + self.vip.rpc.call(CONFIGURATION_STORE, "set_config", agent_identity, config_name, raw_contents, config_type) def list_agent_configs(self, agent_identity): - return self.vip.rpc.call(CONFIGURATION_STORE, "manage_list_configs", + return self.vip.rpc.call(CONFIGURATION_STORE, "list_configs", agent_identity).get(timeout=5) def get_agent_config(self, agent_identity, config_name, raw=True): - data = self.vip.rpc.call(CONFIGURATION_STORE, "manage_get", + data = self.vip.rpc.call(CONFIGURATION_STORE, "get_config", agent_identity, config_name, raw).get( timeout=5) return data or "" def delete_agent_config(self, agent_identity, config_name): - data = self.vip.rpc.call(CONFIGURATION_STORE, "manage_delete_config", + data = self.vip.rpc.call(CONFIGURATION_STORE, "delete_config", agent_identity, config_name).get( timeout=5) return data or "" @@ -977,7 +977,7 @@ def get_devices(self): devices = defaultdict(dict) for platform_driver_id in self._platform_driver_ids: config_list = self.vip.rpc.call(CONFIGURATION_STORE, - 'manage_list_configs', + 'list_configs', platform_driver_id).get(timeout=5) _log.debug('Config list is: {}'.format(config_list)) @@ -987,7 +987,7 @@ def get_devices(self): continue device_config = self.vip.rpc.call(CONFIGURATION_STORE, - 'manage_get', + 'get_config', platform_driver_id, cfg_name, raw=False).get(timeout=5) @@ -999,7 +999,7 @@ def get_devices(self): reg_cfg_name )) registry_config = self.vip.rpc.call(CONFIGURATION_STORE, - 'manage_get', + 'get_config', platform_driver_id, reg_cfg_name, raw=False).get(timeout=5) diff --git a/services/ops/ThresholdDetectionAgent/tests/test_threshold_detection.py b/services/ops/ThresholdDetectionAgent/tests/test_threshold_detection.py index ec99ac41df..4af809c103 100644 --- a/services/ops/ThresholdDetectionAgent/tests/test_threshold_detection.py +++ b/services/ops/ThresholdDetectionAgent/tests/test_threshold_detection.py @@ -109,7 +109,7 @@ def clear_keys(self): def reset_store(self): self.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', 'platform.thresholddetection', 'config', jsonapi.dumps(_test_config), @@ -137,7 +137,7 @@ def threshold_tester_agent(volttron_instance): agent.reset_store() # agent.vip.rpc.call(CONFIGURATION_STORE, - # 'manage_store', + # 'set_config', # 'platform.thresholddetection', # 'config', # jsonapi.dumps(_test_config), @@ -146,7 +146,7 @@ def threshold_tester_agent(volttron_instance): yield agent agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_delete_store', + 'delete_store', 'platform.thresholddetection').get() volttron_instance.remove_agent(threshold_detection_uuid) @@ -211,7 +211,7 @@ def test_update_config(threshold_tester_agent): # threshold_tester_agent.vip.pubsub.publish('pubsub', topic="alerts/woot", headers={"foo": "bar"}) # threshold_tester_agent.vip .config.set('config', updated_config, True) threshold_tester_agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', 'platform.thresholddetection', 'config', jsonapi.dumps(updated_config), @@ -254,7 +254,7 @@ def test_device_publish(threshold_tester_agent): def test_remove_from_config_store(threshold_tester_agent): threshold_tester_agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_delete_config', + 'delete_config', 'platform.thresholddetection', 'config').get() publish(threshold_tester_agent, _test_config, lambda x: x+1) diff --git a/volttron/platform/control/control_config.py b/volttron/platform/control/control_config.py index 5a8c028101..3518ac93e4 100644 --- a/volttron/platform/control/control_config.py +++ b/volttron/platform/control/control_config.py @@ -57,7 +57,7 @@ def add_config_to_store(opts): file_contents = opts.infile.read() call( - "manage_store", + "set_config", opts.identity, opts.name, file_contents, @@ -69,7 +69,7 @@ def delete_config_from_store(opts): opts.connection.peer = CONFIGURATION_STORE call = opts.connection.call if opts.delete_store: - call("manage_delete_store", opts.identity) + call("delete_store", opts.identity) return if opts.name is None: @@ -79,7 +79,7 @@ def delete_config_from_store(opts): ) return - call("manage_delete_config", opts.identity, opts.name) + call("delete_config", opts.identity, opts.name) def list_store(opts): @@ -87,9 +87,9 @@ def list_store(opts): call = opts.connection.call results = [] if opts.identity is None: - results = call("manage_list_stores") + results = call("list_stores") else: - results = call("manage_list_configs", opts.identity) + results = call("list_configs", opts.identity) for item in results: _stdout.write(item + "\n") @@ -98,7 +98,7 @@ def list_store(opts): def get_config(opts): opts.connection.peer = CONFIGURATION_STORE call = opts.connection.call - results = call("manage_get", opts.identity, opts.name, raw=opts.raw) + results = call("get_config", opts.identity, opts.name, raw=opts.raw) if opts.raw: _stdout.write(results) @@ -119,7 +119,7 @@ def edit_config(opts): raw_data = "" else: try: - results = call("manage_get_metadata", opts.identity, opts.name) + results = call("get_metadata", opts.identity, opts.name) config_type = results["type"] raw_data = results["data"] except RemoteError as e: @@ -159,7 +159,7 @@ def edit_config(opts): return call( - "manage_store", + "set_config", opts.identity, opts.name, new_raw_data, diff --git a/volttron/platform/web/topic_tree.py b/volttron/platform/web/topic_tree.py index 26a1c940a0..fedc0e6820 100644 --- a/volttron/platform/web/topic_tree.py +++ b/volttron/platform/web/topic_tree.py @@ -151,17 +151,17 @@ def devices(self, nid=None): def from_store(cls, platform, rpc_caller): # TODO: Duplicate logic for external_platform check from VUIEndpoints to remove reference to it from here. kwargs = {'external_platform': platform} if 'VUIEndpoints' in rpc_caller.__repr__() else {} - devices = rpc_caller(CONFIGURATION_STORE, 'manage_list_configs', 'platform.driver', **kwargs) + devices = rpc_caller(CONFIGURATION_STORE, 'list_configs', 'platform.driver', **kwargs) devices = devices if kwargs else devices.get(timeout=5) devices = [d for d in devices if re.match('^devices/.*', d)] device_tree = cls(devices) for d in devices: - dev_config = rpc_caller(CONFIGURATION_STORE, 'manage_get', 'platform.driver', d, raw=False, **kwargs) + dev_config = rpc_caller(CONFIGURATION_STORE, 'get_config', 'platform.driver', d, raw=False, **kwargs) # TODO: If not AsyncResponse instead of if kwargs dev_config = dev_config if kwargs else dev_config.get(timeout=5) reg_cfg_name = dev_config.pop('registry_config')[len('config://'):] device_tree.update_node(d, data=dev_config, segment_type='DEVICE') - registry_config = rpc_caller('config.store', 'manage_get', 'platform.driver', + registry_config = rpc_caller('config.store', 'get_config', 'platform.driver', f'{reg_cfg_name}', raw=False, **kwargs) registry_config = registry_config if kwargs else registry_config.get(timeout=5) for pnt in registry_config: diff --git a/volttron/platform/web/vui_endpoints.py b/volttron/platform/web/vui_endpoints.py index 50e1676c86..f27fbca646 100644 --- a/volttron/platform/web/vui_endpoints.py +++ b/volttron/platform/web/vui_endpoints.py @@ -331,15 +331,15 @@ def handle_platforms_agents_configs(self, env: dict, data: dict) -> Response: try: if no_config_name: if vip_identity != '-': - setting_list = self._rpc('config.store', 'manage_list_configs', vip_identity, + setting_list = self._rpc('config.store', 'list_configs', vip_identity, external_platform=platform) route_dict = self._links(path_info, setting_list) return Response(json.dumps(route_dict), 200, content_type='application/json') else: - list_of_agents = self._rpc('config.store', 'manage_list_stores', external_platform=platform) + list_of_agents = self._rpc('config.store', 'list_stores', external_platform=platform) return Response(json.dumps(list_of_agents), 200, content_type='application/json') elif not no_config_name: - setting_dict = self._rpc('config.store', 'manage_get', vip_identity, config_name, + setting_dict = self._rpc('config.store', 'get_config', vip_identity, config_name, external_platform=platform) return Response(json.dumps(setting_dict), 200, content_type='application/json') except RemoteError as e: @@ -356,7 +356,7 @@ def handle_platforms_agents_configs(self, env: dict, data: dict) -> Response: elif request_method == 'POST' and no_config_name: if config_type in ['application/json', 'text/csv', 'text/plain']: - setting_list = self._rpc('config.store', 'manage_list_configs', vip_identity, + setting_list = self._rpc('config.store', 'list_configs', vip_identity, external_platform=platform) if config_name in setting_list: e = {'Error': f'Configuration: "{config_name}" already exists for agent: "{vip_identity}"'} @@ -373,13 +373,13 @@ def handle_platforms_agents_configs(self, env: dict, data: dict) -> Response: elif request_method == 'DELETE': if no_config_name: try: - self._rpc('config.store', 'manage_delete_store', vip_identity, external_platform=platform) + self._rpc('config.store', 'delete_store', vip_identity, external_platform=platform) return Response(None, 204, content_type='application/json') except RemoteError as e: return Response(json.dumps({"Error": f"{e}"}), 400, content_type='application/json') else: try: - self._rpc('config.store', 'manage_delete_config', vip_identity, config_name, + self._rpc('config.store', 'delete_config', vip_identity, config_name, external_platform=platform) return Response(None, 204, content_type='application/json') except RemoteError as e: @@ -998,7 +998,7 @@ def _insert_config(self, config_type, data, vip_identity, config_name, platform) 'text/csv'] else 'raw' if config_type == 'json': data = json.dumps(data) - self._rpc('config.store', 'manage_store', vip_identity, config_name, data, config_type, + self._rpc('config.store', 'set_config', vip_identity, config_name, data, config_type, external_platform=platform) return None diff --git a/volttrontesting/fixtures/volttron_platform_fixtures.py b/volttrontesting/fixtures/volttron_platform_fixtures.py index edf6458983..b5cb55dbbd 100644 --- a/volttrontesting/fixtures/volttron_platform_fixtures.py +++ b/volttrontesting/fixtures/volttron_platform_fixtures.py @@ -116,8 +116,8 @@ def volttron_instance_module_web(request): @pytest.fixture(scope="module", params=[ dict(messagebus='zmq'), - pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif), - dict(messagebus='zmq', auth_enabled=False), + # pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif), + # dict(messagebus='zmq', auth_enabled=False), ]) def volttron_instance(request, **kwargs): """Fixture that returns a single instance of volttron platform for testing diff --git a/volttrontesting/multiplatform/test_multiplatform_pubsub.py b/volttrontesting/multiplatform/test_multiplatform_pubsub.py index a9a86cee18..f6145983e0 100644 --- a/volttrontesting/multiplatform/test_multiplatform_pubsub.py +++ b/volttrontesting/multiplatform/test_multiplatform_pubsub.py @@ -544,14 +544,14 @@ def test_multiplatform_configstore_rpc(request, get_volttron_instances): test_agent = p2.build_agent() kwargs = {"external_platform": p1.instance_name} test_agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_store', + 'set_config', 'platform.thresholddetection', 'config', jsonapi.dumps(updated_config), 'json', **kwargs).get(timeout=10) config = test_agent.vip.rpc.call(CONFIGURATION_STORE, - 'manage_get', + 'get_config', 'platform.thresholddetection', 'config', raw=True, diff --git a/volttrontesting/platform/security/SecurityAgent/security/agent.py b/volttrontesting/platform/security/SecurityAgent/security/agent.py index fd251b2bfa..404924c937 100644 --- a/volttrontesting/platform/security/SecurityAgent/security/agent.py +++ b/volttrontesting/platform/security/SecurityAgent/security/agent.py @@ -244,7 +244,7 @@ def verify_config_store_access(self, agent2_identity): """ error = None try: - self.vip.rpc.call('config.store', 'manage_store', "security_agent", 'config', + self.vip.rpc.call('config.store', 'set_config', "security_agent", 'config', json.dumps({"name": "value"}), config_type='json').get(timeout=2) except Exception as e: error = str(e) @@ -253,12 +253,12 @@ def verify_config_store_access(self, agent2_identity): return error try: - self.vip.rpc.call('config.store', 'manage_store', agent2_identity, 'config', + self.vip.rpc.call('config.store', 'set_config', agent2_identity, 'config', json.dumps({"test": "value"}), config_type='json').get(timeout=10) error = "Security agent is able to edit config store entry of security_agent2" except Exception as e: error = e.message - if error == "User can call method manage_store only with identity=security_agent " \ + if error == "User can call method set_config only with identity=security_agent " \ "but called with identity={}".format(agent2_identity): error = None diff --git a/volttrontesting/platform/web/test_topic_tree.py b/volttrontesting/platform/web/test_topic_tree.py index c411495e85..f9606d25a9 100644 --- a/volttrontesting/platform/web/test_topic_tree.py +++ b/volttrontesting/platform/web/test_topic_tree.py @@ -241,17 +241,17 @@ def test_devices(nid, expected): def _mock_rpc_caller(peer, method, agent, file_name=None, raw=False, external_platform=None): - if method == 'manage_list_configs': + if method == 'list_configs': return ['config', 'devices/Campus/Building1/Fake1', 'devices/Campus/Building2/Fake1', 'devices/Campus/Building3/Fake1', 'registry_configs/fake.csv'] - elif method == 'manage_get' and '.csv' in file_name: + elif method == 'get_config' and '.csv' in file_name: return [{'Point Name': 'SampleBool1', 'Volttron Point Name': 'SampleBool1', 'Units': 'On / Off', 'Units Details': 'on/off', 'Writable': 'FALSE', 'Starting Value': 'TRUE', 'Type': 'boolean', 'Notes': 'Status indidcator of cooling stage 1'}, {'Point Name': 'SampleWritableFloat1', 'Volttron Point Name': 'SampleWritableFloat1', 'Units': 'PPM', 'Units Details': '1000.00 (default)', 'Writable': 'TRUE', 'Starting Value': '10', 'Type': 'float', 'Notes': 'Setpoint to enable demand control ventilation'}] - elif method == 'manage_get' and '.csv' not in file_name: + elif method == 'get_config' and '.csv' not in file_name: return {'driver_config': {}, 'registry_config': 'config://registry_configs/fake.csv', 'interval': 60, 'timezone': 'US/Pacific', 'driver_type': 'fakedriver', 'publish_breadth_first_all': False, 'publish_depth_first': False, 'publish_breadth_first': False, 'campus': 'campus', diff --git a/volttrontesting/platform/web/test_vui_endpoints.py b/volttrontesting/platform/web/test_vui_endpoints.py index fc47becc94..fccc475f41 100644 --- a/volttrontesting/platform/web/test_vui_endpoints.py +++ b/volttrontesting/platform/web/test_vui_endpoints.py @@ -277,16 +277,16 @@ def _mock_agents_rpc(peer, meth, *args, external_platform=None, **kwargs): 'config2': {'setting1': 3, 'setting2': 4}}}, {'identity': 'run2', 'configs': {'config1': {'setting1': 5, 'setting2': 6}, 'config2': {'setting1': 7, 'setting2': 8}}}] - if peer == 'config.store' and meth == 'manage_get': + if peer == 'config.store' and meth == 'get_config': config_list = [a['configs'].get(args[1]) for a in config_definition_list if a['identity'] == args[0]] if not config_list or config_list == [None]: raise RemoteError(f'''builtins.KeyError('No configuration file \"{args[1]}\" for VIP IDENTIY {args[0]}')''', exc_info={"exc_type": '', "exc_args": []}) return config_list[0] if config_list else [] - elif peer == 'config.store' and meth == 'manage_list_configs': + elif peer == 'config.store' and meth == 'list_configs': config_list = [a['configs'].keys() for a in config_definition_list if a['identity'] == args[0]] return config_list[0] if config_list else [] - elif peer == 'config.store' and meth == 'manage_list_stores': + elif peer == 'config.store' and meth == 'list_stores': return [a['identity'] for a in config_definition_list] elif peer == 'control' and meth == 'list_agents': return list_of_agents @@ -458,7 +458,7 @@ def test_handle_platforms_agents_configs_config_put_response(mock_platform_web_s config_type = re.search(r'([^\/]+$)', config_type).group() if config_type in ['application/json', 'text/csv'] else 'raw' if status == '204': - vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'manage_store', vip_identity, config_name, + vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'set_config', vip_identity, config_name, data_passed, config_type, external_platform='my_instance_name')]) elif status == '400': assert json.loads(response.response[0]) == \ @@ -488,7 +488,7 @@ def test_handle_platforms_agents_configs_post_response(mock_platform_web_service response = vui_endpoints.handle_platforms_agents_configs(env, data_given) check_response_codes(response, status) if status == '204': - vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'manage_store', vip_identity, config_name, + vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'set_config', vip_identity, config_name, data_passed, config_type, external_platform='my_instance_name')]) elif status == '400': assert json.loads(response.response[0]) == \ @@ -510,7 +510,7 @@ def test_handle_platforms_agents_configs_delete_response(mock_platform_web_servi response = vui_endpoints.handle_platforms_agents_configs(env, {}) check_response_codes(response, status) if status == '204': - vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'manage_delete_store', vip_identity_passed, + vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'delete_store', vip_identity_passed, external_platform='my_instance_name')]) @@ -526,7 +526,7 @@ def test_handle_platforms_agents_configs_config_delete_response(mock_platform_we response = vui_endpoints.handle_platforms_agents_configs(env, {}) check_response_codes(response, status) if status == '204': - vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'manage_delete_config', vip_identity, + vui_endpoints._rpc.assert_has_calls([mock.call('config.store', 'delete_config', vip_identity, config_name_passed, external_platform='my_instance_name')]) diff --git a/volttrontesting/services/aggregate_historian/test_aggregate_historian.py b/volttrontesting/services/aggregate_historian/test_aggregate_historian.py index 62c58a317d..642b77ad5a 100644 --- a/volttrontesting/services/aggregate_historian/test_aggregate_historian.py +++ b/volttrontesting/services/aggregate_historian/test_aggregate_historian.py @@ -490,7 +490,7 @@ def test_get_supported_aggregations(aggregate_agent, query_agent): :param query_agent: fake agent used to query historian :return: """ - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", aggregate_agent).get() gevent.sleep(1) @@ -565,7 +565,7 @@ def test_single_topic_pattern(aggregate_agent, query_agent): ] } ] - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() gevent.sleep(1) @@ -668,7 +668,7 @@ def test_single_topic(aggregate_agent, query_agent): ] } ] - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() gevent.sleep(3 * 60) # sleep till we see two rows in aggregate table @@ -841,7 +841,7 @@ def test_multiple_topic_pattern(aggregate_agent, query_agent): } ] - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() gevent.sleep(1) @@ -914,7 +914,7 @@ def test_multiple_topic_list(aggregate_agent, query_agent): } ] - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() gevent.sleep(1) @@ -991,7 +991,7 @@ def test_topic_reconfiguration(aggregate_agent, query_agent): } ] - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() gevent.sleep(2) @@ -1037,7 +1037,7 @@ def test_topic_reconfiguration(aggregate_agent, query_agent): print("Before reinstall current time is {}".format(datetime.utcnow())) - query_agent.vip.rpc.call(CONFIGURATION_STORE, "manage_store", + query_agent.vip.rpc.call(CONFIGURATION_STORE, "set_config", AGG_AGENT_VIP, "config", new_config).get() diff --git a/volttrontesting/services/historian/test_base_historian.py b/volttrontesting/services/historian/test_base_historian.py index f3aab05432..fbc93b98a7 100644 --- a/volttrontesting/services/historian/test_base_historian.py +++ b/volttrontesting/services/historian/test_base_historian.py @@ -388,7 +388,7 @@ def test_time_tolerance_check(request, volttron_instance, client_agent): # Change config to modify topic for time tolerance check historian.publish_sleep = 0 json_config = """{"time_tolerance_topics":["record"]}""" - historian.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + historian.vip.rpc.call(CONFIGURATION_STORE, 'set_config', identity, "config", json_config, config_type="json").get() gevent.sleep(2) diff --git a/volttrontesting/subsystems/test_config_store.py b/volttrontesting/subsystems/test_config_store.py index 003cc17707..d941a8e2d6 100644 --- a/volttrontesting/subsystems/test_config_store.py +++ b/volttrontesting/subsystems/test_config_store.py @@ -66,6 +66,14 @@ def _module_config_test_agent(request, volttron_instance): agent = volttron_instance.build_agent(identity='config_test_agent', agent_class=_config_test_agent, enable_store=True) + # wait for config store's onconnect method to complete. onconnect calls handle_callback we don't want this + # to interfere with tests that test the trigger_callback mechanism + # Quote from config store documentation: + # + # As the configuration subsystem calls all callbacks in the onconfig phase and none are called beforehand + # the trigger_callback setting is effectively ignored if an agent sets a configuration or default configuration + # before the end of the onstart phase. + gevent.sleep(3) def cleanup(): agent.core.stop() @@ -78,7 +86,7 @@ def cleanup(): def config_test_agent(request, _module_config_test_agent, volttron_instance): def cleanup(): - _module_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', 'config_test_agent').get() + _module_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_store', 'config_test_agent').get() request.addfinalizer(cleanup) return _module_config_test_agent @@ -101,9 +109,9 @@ def cleanup(): @pytest.mark.config_store -def test_manage_store_json(default_config_test_agent): +def test_set_config_json(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() results = default_config_test_agent.callback_results @@ -113,9 +121,9 @@ def test_manage_store_json(default_config_test_agent): @pytest.mark.config_store -def test_manage_store_csv(default_config_test_agent): +def test_set_config_csv(default_config_test_agent): csv_config = "value\n1" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", csv_config, config_type="csv").get() results = default_config_test_agent.callback_results @@ -125,9 +133,9 @@ def test_manage_store_csv(default_config_test_agent): @pytest.mark.config_store -def test_manage_store_raw(default_config_test_agent): +def test_set_config_raw(default_config_test_agent): raw_config = "test_config_stuff" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", raw_config, config_type="raw").get() results = default_config_test_agent.callback_results @@ -137,9 +145,9 @@ def test_manage_store_raw(default_config_test_agent): @pytest.mark.config_store -def test_manage_update_config(default_config_test_agent): +def test_update_config(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() results = default_config_test_agent.callback_results @@ -148,7 +156,7 @@ def test_manage_update_config(default_config_test_agent): assert first == ("config", "NEW", {"value": 1}) json_config = """{"value":2}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() assert len(results) == 2 @@ -157,16 +165,16 @@ def test_manage_update_config(default_config_test_agent): @pytest.mark.config_store -def test_manage_delete_config(default_config_test_agent): +def test_delete_config(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() results = default_config_test_agent.callback_results assert len(results) == 1 first = results[0] assert first == ("config", "NEW", {"value": 1}) - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_config', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_config', "config_test_agent", "config").get() assert len(results) == 2 second = results[1] @@ -174,70 +182,70 @@ def test_manage_delete_config(default_config_test_agent): @pytest.mark.config_store -def test_manage_delete_store(default_config_test_agent): +def test_delete_store(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() results = default_config_test_agent.callback_results assert len(results) == 1 first = results[0] assert first == ("config", "NEW", {"value": 1}) - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', "config_test_agent").get() + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_store', "config_test_agent").get() assert len(results) == 2 second = results[1] assert second == ("config", "DELETE", None) @pytest.mark.config_store -def test_manage_get_config(config_test_agent): +def test_get_config(config_test_agent): json_config = """{"value":1}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() - config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'get_config', "config_test_agent", "config", raw=False).get() assert config == {"value": 1} @pytest.mark.config_store -def test_manage_get_raw_config(config_test_agent): +def test_get_raw_config(config_test_agent): json_config = """{"value":1}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() - config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'get_config', "config_test_agent", "config", raw=True).get() assert config == json_config @pytest.mark.config_store -def test_manage_list_config(config_test_agent): +def test_list_config(config_test_agent): json_config = """{"value":1}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config1", json_config, config_type="json").get() json_config = """{"value":2}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config2", json_config, config_type="json").get() json_config = """{"value":3}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config3", json_config, config_type="json").get() - config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_list_configs', + config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'list_configs', "config_test_agent").get() assert config_list == ['config1', 'config2', 'config3'] @pytest.mark.config_store -def test_manage_list_store(config_test_agent): +def test_list_store(config_test_agent): json_config = """{"value":1}""" - config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config1", json_config, config_type="json").get() - config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_list_stores').get() + config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'list_stores').get() assert "config_test_agent" in config_list @@ -245,13 +253,13 @@ def test_manage_list_store(config_test_agent): @pytest.mark.config_store def test_agent_list_config(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config1", json_config, config_type="json").get() json_config = """{"value":2}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config2", json_config, config_type="json").get() json_config = """{"value":3}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config3", json_config, config_type="json").get() config_list = default_config_test_agent.vip.config.list() @@ -262,7 +270,7 @@ def test_agent_list_config(default_config_test_agent): @pytest.mark.config_store def test_agent_get_config(default_config_test_agent): json_config = """{"value":1}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() config = default_config_test_agent.vip.config.get("config") @@ -273,7 +281,7 @@ def test_agent_get_config(default_config_test_agent): @pytest.mark.config_store def test_agent_reference_config_and_callback_order(default_config_test_agent): json_config = """{"config2":"config://config2", "config3":"config://config3"}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() config = default_config_test_agent.vip.config.get("config") @@ -281,7 +289,7 @@ def test_agent_reference_config_and_callback_order(default_config_test_agent): assert config == {"config2":None, "config3":None} json_config = """{"value":2}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config2", json_config, config_type="json").get() # Also use th to verify that the callback for "config" is called first. @@ -289,7 +297,7 @@ def test_agent_reference_config_and_callback_order(default_config_test_agent): default_config_test_agent.reset_results() json_config = """{"value":3}""" - default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config3", json_config, config_type="json").get() config = default_config_test_agent.vip.config.get("config") @@ -304,12 +312,13 @@ def test_agent_reference_config_and_callback_order(default_config_test_agent): second = results[1] assert second == ("config3", "NEW", {"value": 3}) + @pytest.mark.config_store -def test_agent_set_config(default_config_test_agent): - json_config = {"value":1} +def test_agent_set_config(default_config_test_agent, volttron_instance): + json_config = {"value": 1} default_config_test_agent.vip.config.set("config", json_config) - + gevent.sleep(5) # wait to avoid case where we are simply missing the callback results = default_config_test_agent.callback_results assert len(results) == 0 @@ -318,7 +327,7 @@ def test_agent_set_config(default_config_test_agent): assert config == {"value": 1} default_config_test_agent.vip.config.set("config", json_config, trigger_callback=True) - + gevent.sleep(5) results = default_config_test_agent.callback_results assert len(results) == 1 first = results[0] @@ -360,7 +369,7 @@ def test_agent_default_config(request, volttron_instance): def cleanup(): if agent: - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', 'test_default_agent').get() + agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_store', 'test_default_agent').get() agent.core.stop() request.addfinalizer(cleanup) @@ -383,14 +392,14 @@ def __init__(self, **kwargs): result = results[0] assert result == ("config", "NEW", {"value": 2}) - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "test_default_agent", "config", '{"value": 1}', config_type="json").get() assert len(results) == 2 result = results[-1] assert result == ("config", "UPDATE", {"value": 1}) - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_config', "test_default_agent", "config").get() + agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_config', "test_default_agent", "config").get() assert len(results) == 3 result = results[-1] @@ -401,7 +410,7 @@ def __init__(self, **kwargs): def test_agent_sub_options(request, volttron_instance): def cleanup(): - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', 'test_agent_sub_options').get() + agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_store', 'test_agent_sub_options').get() agent.core.stop() request.addfinalizer(cleanup) @@ -424,13 +433,13 @@ def __init__(self, **kwargs): update_json = """{"value": 2}""" for name in ("new/config", "update/config", "delete/config"): - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "test_agent_sub_options", name, new_json, config_type="json").get() - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "test_agent_sub_options", name, update_json, config_type="json").get() - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_config', + agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_config', "test_agent_sub_options", name).get() results = agent.callback_results @@ -456,9 +465,9 @@ def test_config_store_security(volttron_instance, default_config_test_agent): # By default agents should have access to edit their own config store json_config = """{"value":1}""" - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', "rpc_agent", "config", json_config, + agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "rpc_agent", "config", json_config, config_type="json").get() - config = agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', "rpc_agent", "config", raw=False).get() + config = agent.vip.rpc.call(CONFIGURATION_STORE, 'get_config', "rpc_agent", "config", raw=False).get() assert config == {"value": 1} @@ -466,20 +475,20 @@ def test_config_store_security(volttron_instance, default_config_test_agent): # default_config_test_agent unless explicitly granted permissions try: json_config = """{"value":1}""" - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', "config_test_agent", "config", + agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', "config_test_agent", "config", json_config, config_type="json").get() except jsonrpc.RemoteError as e: - assert e.message == "User rpc_agent can call method manage_store only with " \ + assert e.message == "User rpc_agent can call method set_config only with " \ "identity=rpc_agent but called with identity=config_test_agent" try: - agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', 'config_test_agent').get() + agent.vip.rpc.call(CONFIGURATION_STORE, 'delete_store', 'config_test_agent').get() except jsonrpc.RemoteError as e: - assert e.message == "User rpc_agent can call method manage_delete_store only with " \ + assert e.message == "User rpc_agent can call method delete_store only with " \ "identity=rpc_agent but called with identity=config_test_agent" # Should be able to view - result = agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_list_configs', "config_test_agent").get() + result = agent.vip.rpc.call(CONFIGURATION_STORE, 'list_configs', "config_test_agent").get() print(result) finally: From 670e0f2d72221fe2114c9700756d78518ae86d70 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 15 Aug 2023 17:41:44 -0700 Subject: [PATCH 05/13] Added auth restrictions to config update methods --- volttron/platform/store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volttron/platform/store.py b/volttron/platform/store.py index 2786bf7ac4..15c348db8b 100644 --- a/volttron/platform/store.py +++ b/volttron/platform/store.py @@ -271,7 +271,7 @@ def get_metadata(self, identity, config_name): return real_config - @RPC.allow('initialize_agent_config') + @RPC.allow('edit_config_store') @RPC.export def initialize_configs(self, identity): """ From a004c82376b66891e33e60831a609bba29912397 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:40:22 -0700 Subject: [PATCH 06/13] Added manage_* RPC method back in and marked as deprecated --- volttron/platform/store.py | 66 ++++++++- .../subsystems/test_config_store.py | 138 ++++++++++++++++++ 2 files changed, 202 insertions(+), 2 deletions(-) diff --git a/volttron/platform/store.py b/volttron/platform/store.py index 15c348db8b..8949ee9504 100644 --- a/volttron/platform/store.py +++ b/volttron/platform/store.py @@ -44,8 +44,8 @@ import errno from csv import DictReader from io import StringIO - import gevent +from deprecated import deprecated from volttron.platform import jsonapi from gevent.lock import Semaphore @@ -160,6 +160,18 @@ def _onstart(self, sender, **kwargs): except Exception as e: _log.error(f"Exception getting peerlist on startup of config store: {e}") + @RPC.export + @RPC.allow('edit_config_store') + @deprecated(reason="Use set_config") + def manage_store(self, identity, config_name, raw_contents, config_type="raw", trigger_callback=True, + send_update=True): + """ + This method is deprecated and will be removed in VOLTTRON 10. Please use set_config instead + """ + contents = process_raw_config(raw_contents, config_type) + self._add_config_to_store(identity, config_name, raw_contents, contents, config_type, + trigger_callback=trigger_callback, send_update=send_update) + @RPC.export @RPC.allow('edit_config_store') def set_config(self, identity, config_name, raw_contents, config_type="raw", trigger_callback=True, @@ -168,11 +180,29 @@ def set_config(self, identity, config_name, raw_contents, config_type="raw", tri self._add_config_to_store(identity, config_name, raw_contents, contents, config_type, trigger_callback=trigger_callback, send_update=send_update) + @RPC.export + @RPC.allow('edit_config_store') + @deprecated(reason="Use delete_config") + def manage_delete_config(self, identity, config_name, trigger_callback=True, send_update=True): + """ + This method is deprecated and will be removed in VOLTTRON 10. Please use delete_config instead + """ + self.delete(identity, config_name, trigger_callback=trigger_callback, send_update=send_update) + @RPC.export @RPC.allow('edit_config_store') def delete_config(self, identity, config_name, trigger_callback=True, send_update=True): self.delete(identity, config_name, trigger_callback=trigger_callback, send_update=send_update) + @RPC.export + @RPC.allow('edit_config_store') + @deprecated(reason="Use delete_store") + def manage_delete_store(self, identity): + """ + This method is deprecated and will be removed in VOLTTRON 10. Please use delete_store instead + """ + self.delete_store(identity) + @RPC.export @RPC.allow('edit_config_store') def delete_store(self, identity): @@ -211,18 +241,42 @@ def delete_store(self, identity): if not agent_disk_store: self.store.pop(identity, None) + @RPC.export + @deprecated(reason="Use list_configs") + def manage_list_configs(self, identity): + """ + This method is deprecated and will be removed in VOLTTRON 10. Use list_configs instead + """ + return self.list_configs(identity) + @RPC.export def list_configs(self, identity): result = list(self.store.get(identity, {}).get("store", {}).keys()) result.sort() return result + @RPC.export + @deprecated(reason="Use list_stores") + def manage_list_stores(self): + """ + This method is deprecated and will be removed in VOLTTRON 10. Use list_stores instead + """ + return self.list_stores() + @RPC.export def list_stores(self): result = list(self.store.keys()) result.sort() return result + @RPC.export + @deprecated(reason="Use get_config") + def manage_get(self, identity, config_name, raw=True): + """ + This method is deprecated and will be removed in VOLTTRON 10. Use get_config instead + """ + return self.get_config(identity, config_name, raw) + @RPC.export def get_config(self, identity, config_name, raw=True): agent_store = self.store.get(identity) @@ -246,6 +300,14 @@ def get_config(self, identity, config_name, raw=True): return agent_configs[real_config_name] + @RPC.export + @deprecated(reason="Use get_metadata") + def manage_get_metadata(self, identity, config_name): + """ + This method is deprecated and will be removed in VOLTTRON 10. Please use get_metadata instead + """ + return self.get_metadata(identity, config_name) + @RPC.export def get_metadata(self, identity, config_name): agent_store = self.store.get(identity) @@ -265,7 +327,7 @@ def get_metadata(self, identity, config_name): real_config = agent_disk_store[real_config_name] - #Set modified to none if we predate the modified flag. + # Set modified to none if we predate the modified flag. if real_config.get("modified") is None: real_config["modified"] = None diff --git a/volttrontesting/subsystems/test_config_store.py b/volttrontesting/subsystems/test_config_store.py index d941a8e2d6..b9315f0b54 100644 --- a/volttrontesting/subsystems/test_config_store.py +++ b/volttrontesting/subsystems/test_config_store.py @@ -120,6 +120,18 @@ def test_set_config_json(default_config_test_agent): assert first == ("config", "NEW", {"value": 1}) +@pytest.mark.config_store +def test_manage_store_json(default_config_test_agent): + json_config = """{"value":1}""" + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_store', + "config_test_agent", "config", json_config, config_type="json").get() + + results = default_config_test_agent.callback_results + assert len(results) == 1 + first = results[0] + assert first == ("config", "NEW", {"value": 1}) + + @pytest.mark.config_store def test_set_config_csv(default_config_test_agent): csv_config = "value\n1" @@ -181,6 +193,23 @@ def test_delete_config(default_config_test_agent): assert second == ("config", "DELETE", None) +@pytest.mark.config_store +def test_manage_delete_config(default_config_test_agent): + json_config = """{"value":1}""" + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + results = default_config_test_agent.callback_results + assert len(results) == 1 + first = results[0] + assert first == ("config", "NEW", {"value": 1}) + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_config', + "config_test_agent", "config").get() + assert len(results) == 2 + second = results[1] + assert second == ("config", "DELETE", None) + + @pytest.mark.config_store def test_delete_store(default_config_test_agent): json_config = """{"value":1}""" @@ -188,6 +217,7 @@ def test_delete_store(default_config_test_agent): "config_test_agent", "config", json_config, config_type="json").get() results = default_config_test_agent.callback_results + print(f"callback results is {results}") assert len(results) == 1 first = results[0] assert first == ("config", "NEW", {"value": 1}) @@ -197,6 +227,23 @@ def test_delete_store(default_config_test_agent): assert second == ("config", "DELETE", None) +@pytest.mark.config_store +def test_manage_delete_store(default_config_test_agent): + json_config = """{"value":1}""" + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + results = default_config_test_agent.callback_results + print(f"callback results is {results}") + assert len(results) == 1 + first = results[0] + assert first == ("config", "NEW", {"value": 1}) + default_config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_delete_store', "config_test_agent").get() + assert len(results) == 2 + second = results[1] + assert second == ("config", "DELETE", None) + + @pytest.mark.config_store def test_get_config(config_test_agent): json_config = """{"value":1}""" @@ -209,6 +256,56 @@ def test_get_config(config_test_agent): assert config == {"value": 1} +@pytest.mark.config_store +def test_manage_get_config(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', + "config_test_agent", "config", raw=False).get() + + assert config == {"value": 1} + + +@pytest.mark.config_store +def test_get_metadata(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'get_config', + "config_test_agent", "config", raw=False).get() + + assert config == {"value": 1} + + metadata = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'get_metadata', + "config_test_agent", "config").get() + print(f"Metadata {metadata}") + assert metadata["type"] == "json" + assert metadata["modified"] + assert metadata["data"] == '{"value":1}' + + +@pytest.mark.config_store +def test_manage_get_metadata(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', + "config_test_agent", "config", raw=False).get() + + assert config == {"value": 1} + + metadata = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get_metadata', + "config_test_agent", "config").get() + print(f"Metadata {metadata}") + assert metadata["type"] == "json" + assert metadata["modified"] + assert metadata["data"] == '{"value":1}' + + @pytest.mark.config_store def test_get_raw_config(config_test_agent): json_config = """{"value":1}""" @@ -221,6 +318,18 @@ def test_get_raw_config(config_test_agent): assert config == json_config +@pytest.mark.config_store +def test_manage_get_raw_config(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config", json_config, config_type="json").get() + + config = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_get', + "config_test_agent", "config", raw=True).get() + + assert config == json_config + + @pytest.mark.config_store def test_list_config(config_test_agent): json_config = """{"value":1}""" @@ -239,6 +348,24 @@ def test_list_config(config_test_agent): assert config_list == ['config1', 'config2', 'config3'] +@pytest.mark.config_store +def test_manage_list_config(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config1", json_config, config_type="json").get() + json_config = """{"value":2}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config2", json_config, config_type="json").get() + json_config = """{"value":3}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config3", json_config, config_type="json").get() + + config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_list_configs', + "config_test_agent").get() + + assert config_list == ['config1', 'config2', 'config3'] + + @pytest.mark.config_store def test_list_store(config_test_agent): json_config = """{"value":1}""" @@ -250,6 +377,17 @@ def test_list_store(config_test_agent): assert "config_test_agent" in config_list +@pytest.mark.config_store +def test_manage_list_store(config_test_agent): + json_config = """{"value":1}""" + config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'set_config', + "config_test_agent", "config1", json_config, config_type="json").get() + + config_list = config_test_agent.vip.rpc.call(CONFIGURATION_STORE, 'manage_list_stores').get() + + assert "config_test_agent" in config_list + + @pytest.mark.config_store def test_agent_list_config(default_config_test_agent): json_config = """{"value":1}""" From 18446852c9c77e91549ababb6f853403cddb50e7 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:41:20 -0700 Subject: [PATCH 07/13] Config store updates for handling non auth --- volttron/platform/auth/auth_entry.py | 6 +++--- volttron/platform/auth/auth_file.py | 8 ++++++- volttron/platform/main.py | 21 +++++++++++++------ .../vip/agent/subsystems/configstore.py | 7 +++++-- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/volttron/platform/auth/auth_entry.py b/volttron/platform/auth/auth_entry.py index 39c086d81e..43d3d3756d 100644 --- a/volttron/platform/auth/auth_entry.py +++ b/volttron/platform/auth/auth_entry.py @@ -39,7 +39,7 @@ import logging import re -from typing import Optional +from typing import Optional, Union import uuid from volttron.platform.vip.socket import BASE64_ENCODED_CURVE_KEY_LEN @@ -114,7 +114,7 @@ def __init__( identity=None, groups=None, roles=None, - capabilities: Optional[dict] = None, + capabilities: Optional[Union[dict, str, list[Union[str, dict]]]] = None, rpc_method_authorizations=None, comments=None, enabled=True, @@ -165,7 +165,7 @@ def _build_field(value): return List(String(elem) for elem in value) @staticmethod - def build_capabilities_field(value: Optional[dict]): + def build_capabilities_field(value: Union[dict, str, list[Union[str, dict]]]): # _log.debug("_build_capabilities {}".format(value)) if not value: diff --git a/volttron/platform/auth/auth_file.py b/volttron/platform/auth/auth_file.py index 2ac86f799d..d39b63be26 100644 --- a/volttron/platform/auth/auth_file.py +++ b/volttron/platform/auth/auth_file.py @@ -62,6 +62,7 @@ _log = logging.getLogger(__name__) + class AuthFile(object): def __init__(self, auth_file=None): self.auth_data = {} @@ -74,7 +75,7 @@ def __init__(self, auth_file=None): @property def version(self): - return {"major": 1, "minor": 3} + return {"major": 1, "minor": 4} def _check_for_upgrade(self): auth_data = self._read() @@ -268,6 +269,11 @@ def upgrade_1_2_to_1_3(allow_list): version["minor"] = 2 if version["major"] == 1 and version["minor"] == 2: allow_list = upgrade_1_2_to_1_3(allow_list) + version["minor"] = 3 + if version["major"] == 1 and version["minor"] == 3: + # on start a new entry for config.store should have got created automatically + # so just update version + version["minor"] = 4 allow_entries, deny_entries = self._get_entries(allow_list, deny_list) self._write(allow_entries, deny_entries, groups, roles) diff --git a/volttron/platform/main.py b/volttron/platform/main.py index 429ecaba51..e61e5619a9 100644 --- a/volttron/platform/main.py +++ b/volttron/platform/main.py @@ -986,6 +986,14 @@ def rmq_router(stop): message_bus=opts.message_bus, enable_auth=opts.allow_auth) + if opts.allow_auth: + entry = AuthEntry(credentials=config_store.core.publickey, + user_id=CONFIGURATION_STORE, + identity=CONFIGURATION_STORE, + capabilities='sync_agent_config', + comments='Automatically added by platform on start') + AuthFile().add(entry, overwrite=True) + # Launch additional services and wait for them to start before # auto-starting agents services = [ @@ -1277,12 +1285,13 @@ def setup_auth_service(opts, address, services): entry = AuthEntry(credentials=services[0].core.publickey, user_id=CONTROL, identity=CONTROL, - capabilities=[{ - 'edit_config_store': { - 'identity': '/.*/' - } - }, 'modify_rpc_method_allowance', - 'allow_auth_modifications'], + capabilities=[ + { + 'edit_config_store': { + 'identity': '/.*/'} + }, + 'modify_rpc_method_allowance', + 'allow_auth_modifications'], comments='Automatically added by platform on start') AuthFile().add(entry, overwrite=True) diff --git a/volttron/platform/vip/agent/subsystems/configstore.py b/volttron/platform/vip/agent/subsystems/configstore.py index 975ef6a257..5a0bba29bd 100644 --- a/volttron/platform/vip/agent/subsystems/configstore.py +++ b/volttron/platform/vip/agent/subsystems/configstore.py @@ -47,6 +47,8 @@ from volttron.platform.vip.agent import errors from volttron.platform.agent.known_identities import CONFIGURATION_STORE from volttron.platform import jsonapi +from volttron.platform.agent.utils import is_auth_enabled + from collections import defaultdict from copy import deepcopy @@ -90,9 +92,10 @@ def sub_factory(): def onsetup(sender, **kwargs): rpc.export(self._update_config, 'config.update') - rpc.allow('config.update', 'sync_agent_config') rpc.export(self._initial_update, 'config.initial_update') - rpc.allow('config.initial_update', 'sync_agent_config') + if is_auth_enabled(): + rpc.allow('config.update', 'sync_agent_config') + rpc.allow('config.initial_update', 'sync_agent_config') core.onsetup.connect(onsetup, self) core.configuration.connect(self._onconfig, self) From 88f72dba53a258345eacd0a67a8b2395a0d2a27e Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:41:34 -0700 Subject: [PATCH 08/13] added deprecated --- requirements.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.py b/requirements.py index bac0d08fcc..c3735d9ab0 100644 --- a/requirements.py +++ b/requirements.py @@ -61,7 +61,8 @@ 'tzlocal==2.1', #'pyOpenSSL==19.0.0', 'cryptography==37.0.4', - 'watchdog-gevent==0.1.1'] + 'watchdog-gevent==0.1.1', + 'deprecated==1.2.14'] extras_require = {'crate': ['crate==0.27.1'], 'databases': ['mysql-connector-python==8.0.30', From 3adf9ce11a8b50c85e5398d31ba9d0391f2d6211 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:42:09 -0700 Subject: [PATCH 09/13] removed duplicate code --- volttrontesting/utils/platformwrapper.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/volttrontesting/utils/platformwrapper.py b/volttrontesting/utils/platformwrapper.py index de5e809274..8f90472396 100644 --- a/volttrontesting/utils/platformwrapper.py +++ b/volttrontesting/utils/platformwrapper.py @@ -305,9 +305,6 @@ def __init__(self, messagebus=None, ssl_auth=False, instance_name=None, # with older 2.0 agents. self.opts = None - keystorefile = os.path.join(self.volttron_home, 'keystore') - self.keystore = KeyStore(keystorefile) - self.keystore.generate() self.messagebus = messagebus if messagebus else 'zmq' # Regardless of what is passed in if using rmq we need auth and ssl. if self.messagebus == 'rmq': From 31d2974060f41b9abfb239a92c3b6cc1db83f365 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:42:29 -0700 Subject: [PATCH 10/13] removed accidental comment --- volttrontesting/fixtures/volttron_platform_fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/volttrontesting/fixtures/volttron_platform_fixtures.py b/volttrontesting/fixtures/volttron_platform_fixtures.py index b5cb55dbbd..03a0f98f75 100644 --- a/volttrontesting/fixtures/volttron_platform_fixtures.py +++ b/volttrontesting/fixtures/volttron_platform_fixtures.py @@ -116,8 +116,8 @@ def volttron_instance_module_web(request): @pytest.fixture(scope="module", params=[ dict(messagebus='zmq'), - # pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif), - # dict(messagebus='zmq', auth_enabled=False), + pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif), + pytest.param(dict(messagebus='zmq', auth_enabled=False)) ]) def volttron_instance(request, **kwargs): """Fixture that returns a single instance of volttron platform for testing From 189585125a506703c68bbccd71c6b0bce90ded6c Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 14:42:40 -0700 Subject: [PATCH 11/13] doc update for config store --- .../agent-configuration-store.rst | 68 +++++++++++++------ 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/docs/source/platform-features/config-store/agent-configuration-store.rst b/docs/source/platform-features/config-store/agent-configuration-store.rst index fbf55ecd3c..aea72e2ac6 100644 --- a/docs/source/platform-features/config-store/agent-configuration-store.rst +++ b/docs/source/platform-features/config-store/agent-configuration-store.rst @@ -312,36 +312,66 @@ Platform RPC Methods -------------------- -Methods for Agents -^^^^^^^^^^^^^^^^^^ - -Agent methods that change configurations do not trigger any callbacks unless trigger_callback is True. - -**set_config(config_name, contents, trigger_callback=False)** - Change/create a configuration file on the platform. +**set_config(identity, config_name, contents, config_type="raw", trigger_callback=True, send_update=True)** - +Change/create a configuration on the platform for an agent with the specified identity. Requires the +authorization capability 'edit_config_store'. By default agents have access to edit only their own config store entries. + +**manage_store(identity, config_name, contents, config_type="raw", trigger_callback=True, send_update=True)** - +Deprecated method. Please use set_config instead. Will be removed in VOLTTRON version 10. +Change/create a configuration on the platform for an agent with the specified identity. Requires the +authorization capability 'edit_config_store'. By default agents have access to edit only their own config store entries. + +**delete_config(identity, config_name, trigger_callback=True, send_update=True)** - Delete a configuration for an +agent with the specified identity. Requires the authorization capability 'edit_config_store'. By default agents have +access to edit only their own config store entries. + +**manage_delete_config(identity, config_name, trigger_callback=True, send_update=True)** - +Deprecated method. Please use delete_config instead. Will be removed in VOLTTRON version 10. +Delete a configuration for an agent with the specified identity. Requires the authorization capability +'edit_config_store'. By default agents have access to edit only their own config store entries. + +**delete_store(identity)** - Delete all configurations for an agent with the specified identity. Requires the +authorization capability 'edit_config_store'. By default agents have access to edit only their own config store entries. +Calls the agent's update_config with the action `DELETE_ALL` and no configuration name. -**get_configs()** - Get all of the configurations for an Agent. +**manage_delete_store(identity)** - +Deprecated method. Please use delete_store instead. Will be removed in VOLTTRON version 10. +Delete all configurations for an agent with the specified identity. Requires the +authorization capability 'edit_config_store'. By default agents have access to edit only their own config store entries. +Calls the agent's update_config with the action `DELETE_ALL` and no configuration name. -**delete_config(config_name, trigger_callback=False)** - Delete a configuration. +**list_configs(identity)** - Get a list of configurations for an agent with the specified identity. +**manage_list_configs(identity)** - +Deprecated method. Please use list_configs instead. Will be removed in VOLTTRON version 10. +Get a list of configurations for an agent with the specified identity. -Methods for Management -^^^^^^^^^^^^^^^^^^^^^^ +**list_stores()** - Get a list of all the agents with configurations. -**manage_store_config(identity, config_name, contents, config_type="raw")** - Change/create a configuration on the -platform for an agent with the specified identity +**manage_list_stores()** - +Deprecated method. Please use list_stores instead. Will be removed in VOLTTRON version 10. +Get a list of all the agents with configurations. -**manage_delete_config(identity, config_name)** - Delete a configuration for an agent with the specified identity. -Calls the agent's update_config with the action `DELETE_ALL` and no configuration name. -**manage_delete_store(identity)** - Delete all configurations for a :term:`VIP Identity`. +**get_config(identity, config_name, raw=True)** - Get the contents of a configuration file. If raw is set to +`True` this function will return the original file, otherwise it will return the parsed representation of the file. -**manage_list_config(identity)** - Get a list of configurations for an agent with the specified identity. +**manage_get_config(identity, config_name, raw=True)** - +Deprecated method. Please use get_config instead. Will be removed in VOLTTRON version 10. +Get the contents of a configuration file. If raw is set to `True` this function will return the original file, +otherwise it will return the parsed representation of the file. -**manage_get_config(identity, config_name, raw=True)** - Get the contents of a configuration file. If raw is set to -`True` this function will return the original file, otherwise it will return the parsed representation of the file. +**initialize_configs(identity)** - Called by an Agent at startup to trigger initial configuration state push. +Requires the authorization capability 'edit_config_store'. By default agents have access to edit only their own +config store entries. -**manage_list_stores()** - Get a list of all the agents with configurations. +**get_metadata(identity, config_name)** - Get the metadata of configuration named *config_name* of agent +identified by *identity*. Returns the type(json, csv, raw) of the configuration, modified date and actual content +**manage_get_metadata(identity, config_name)** - +Deprecated method. Please use get_metadata instead. Will be removed in VOLTTRON version 10. +Get the metadata of configuration named *config_name* of agent +identified by *identity*. Returns the type(json, csv, raw) of the configuration, modified date and actual content Direct Call Methods ^^^^^^^^^^^^^^^^^^^ From b56017f65637d3cc72c3d7103c4730b991556025 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 15:07:08 -0700 Subject: [PATCH 12/13] minor fix --- volttrontesting/fixtures/volttron_platform_fixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volttrontesting/fixtures/volttron_platform_fixtures.py b/volttrontesting/fixtures/volttron_platform_fixtures.py index 03a0f98f75..33fe919435 100644 --- a/volttrontesting/fixtures/volttron_platform_fixtures.py +++ b/volttrontesting/fixtures/volttron_platform_fixtures.py @@ -117,7 +117,7 @@ def volttron_instance_module_web(request): params=[ dict(messagebus='zmq'), pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif), - pytest.param(dict(messagebus='zmq', auth_enabled=False)) + dict(messagebus='zmq', auth_enabled=False) ]) def volttron_instance(request, **kwargs): """Fixture that returns a single instance of volttron platform for testing From fbb7de31b68a045cb3d15bebceb8ae5db2ccdfb9 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Tue, 22 Aug 2023 16:50:37 -0700 Subject: [PATCH 13/13] removed complex type hinting that python 3.8 is not happy with --- volttron/platform/auth/auth_entry.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/volttron/platform/auth/auth_entry.py b/volttron/platform/auth/auth_entry.py index 43d3d3756d..59399d54da 100644 --- a/volttron/platform/auth/auth_entry.py +++ b/volttron/platform/auth/auth_entry.py @@ -114,7 +114,7 @@ def __init__( identity=None, groups=None, roles=None, - capabilities: Optional[Union[dict, str, list[Union[str, dict]]]] = None, + capabilities=None, rpc_method_authorizations=None, comments=None, enabled=True, @@ -127,13 +127,10 @@ def __init__( self.credentials = AuthEntry._build_field(credentials) self.groups = AuthEntry._build_field(groups) or [] self.roles = AuthEntry._build_field(roles) or [] - self.capabilities = ( - AuthEntry.build_capabilities_field(capabilities) or {} - ) - self.rpc_method_authorizations = ( - AuthEntry.build_rpc_authorizations_field(rpc_method_authorizations) - or {} - ) + self.capabilities = AuthEntry.build_capabilities_field(capabilities) or {} + + self.rpc_method_authorizations = AuthEntry.build_rpc_authorizations_field(rpc_method_authorizations) or {} + self.comments = AuthEntry._build_field(comments) if user_id is None: user_id = str(uuid.uuid4()) @@ -165,7 +162,7 @@ def _build_field(value): return List(String(elem) for elem in value) @staticmethod - def build_capabilities_field(value: Union[dict, str, list[Union[str, dict]]]): + def build_capabilities_field(value): # _log.debug("_build_capabilities {}".format(value)) if not value: