Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for - #3121 - vcfg command to set multiple configuration-store entries at a time #3131

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 52 additions & 8 deletions docs/source/deploying-volttron/platform-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Platform Configuration

Each instance of the VOLTTRON platform includes a `config` file which is used to configure the platform instance on
startup. This file is kept in :term:`VOLTTRON_HOME` and is created using the `volttron-cfg` (`vcfg`) command, or will
be created with default values on start up of the platform otherwise.
be created with default values on start up of the platform otherwise. `vcfg` also provides commands to configure and
install few frequently used agents and update configuration-store entries

Following is helpful information about the `config` file and the `vcfg` command.


VOLTTRON_HOME
=============

Expand Down Expand Up @@ -75,9 +75,13 @@ The example consists of the following entries:
VOLTTRON Config
===============

The `volttron-cfg` or `vcfg` command allows for an easy configuration of the VOLTTRON environment. The command includes
the ability to set up the platform configuration, an instance of the platform historian, VOLTTRON Central UI, and
VOLTTRON Central Platform agent.
The `volttron-cfg` or `vcfg` command allows for an easy configuration of the VOLTTRON environment.
The `vcfg` command can be run without any arguments to go through all available configuration steps sequentially and
pick what is appropriate for a given instance of VOLTTRON. This is useful when starting with a new VOLTTRON instance.

`vcfg` command can also be used with specific subcommands to configure and install specific agents such as
listener agent, platform historian, VOLTTRON Central UI, and VOLTTRON Central Platform agent
or add one or more agent configurations to VOLTTRON's configuration store.

Running `vcfg` will create a `config` file in `VOLTTRON_HOME` which will be populated according to the answers to
prompts. This process should be repeated for each platform instance, and can be re-run to reconfigure a platform
Expand Down Expand Up @@ -158,12 +162,52 @@ Optional Arguments
- **-v, --verbose** - Enables verbose output in standard-output (PIP output, etc.)
- **--vhome VHOME** - Provide a path to set `VOLTTRON_HOME` for this instance
- **--instance-name INSTANCE_NAME** - Provide a name for this instance. Required for running secure agents mode
- **--list-agents** - Display a list of configurable agents (Listener, Platform Driver, Platform Historian, VOLTTRON
Central, VOLTTRON Central Platform)
- **--agent AGENT [AGENT ...]** - Configure listed agents
- **--agent-isolation-mode** - Require that agents run as their own Unix users (this requires running
`scripts/secure_user_permissions.sh` as `sudo`)

Sub commands
------------
**--list-agents**
~~~~~~~~~~~~~~~~~~
Display a list of configurable agents (Listener, Platform Driver, Platform Historian, VOLTTRON
Central, VOLTTRON Central Platform)

**--agent AGENT [AGENT ...]**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Configure and install one of the listed agents for a specific VOLTTRON instance

**update-config-store --metadata-file METADATA_FILE_OR_DIR [METADATA_FILE_OR_DIR ...]**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Command to bulk add/update multiple agent configurations to VOLTTRON's configuration store. This is especially useful
for automated deployment use cases. For example, a automated deployment setup where devices in a network are
detected, and configurations for platform driver and control agents such as ILCAgent are auto generated using semantic
tags. In such as scenario, adding all the generated configurations to the configuration store using the below command
is more efficient than running the "vctl config store" command once for each configuration

This command can only be used when volttron instance is not running.

Usage:

.. code-block:: bash

vcfg update-config-store --metadata-file <one or more metadata file or directories containing metadata files separated by space>


Format for Metadata file:

.. code-block::

{ "vip-id": [
{
"config-name": "optional. name. defaults to config
"config": "json config or string config or config file name",
"config-type": "optional. type of config - csv or json or raw. defaults to json"
}, ...
],...
}


RabbitMQ Arguments
------------------
vcfg command to configure a single RabbitMQ instance of VOLTTRON.
Expand Down
4 changes: 2 additions & 2 deletions volttron/platform/agent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def load_config(config_path):

if not os.path.exists(config_path):
raise ValueError(
f"Config file specified by AGENT_CONFIG path {config_path} does not exist."
f"Config file specified by path {config_path} does not exist."
)

# First attempt parsing the file with a yaml parser (allows comments natively)
Expand All @@ -169,7 +169,7 @@ def load_config(config_path):
with open(config_path) as f:
return parse_json_config(f.read())
except Exception as e:
_log.error("Problem parsing agent configuration")
_log.error(f"Problem parsing configuration {config_path}: {e}")
raise


Expand Down
Loading
Loading