This commit should be merged AFTER the revert in the commit https://osm.etsi.org/gerrit/#/c/osm/osmclient/+/12725/
Change-Id: Ifae76a63f6fecf323e63d38daa06196a4ba33345
Signed-off-by: Luis Vega <lvega@whitestack.com>
@click.option(
"--creds", default=None, help="credentials file (only applicable for GCP VIM type)"
)
@click.option(
"--creds", default=None, help="credentials file (only applicable for GCP VIM type)"
)
+@click.option(
+ "--prometheus_url",
+ default=None,
+ help="PrometheusTSBD URL to get VIM data",
+)
+@click.option(
+ "--prometheus_map",
+ default=None,
+ help="PrometheusTSBD metrics mapping for VIM data",
+)
@click.option(
"--prometheus_config_file",
default=None,
@click.option(
"--prometheus_config_file",
default=None,
+ prometheus_url,
+ prometheus_map,
prometheus_config_file,
):
"""creates a new VIM account"""
prometheus_config_file,
):
"""creates a new VIM account"""
if sdn_port_mapping:
utils.check_client_version(ctx.obj, "--sdn_port_mapping")
vim = {}
if sdn_port_mapping:
utils.check_client_version(ctx.obj, "--sdn_port_mapping")
vim = {}
+ prometheus_config = {}
+ if prometheus_url:
+ prometheus_config["prometheus-url"] = prometheus_url
+ if prometheus_map:
+ prometheus_config["prometheus-map"] = prometheus_map
if prometheus_config_file:
with open(prometheus_config_file) as prometheus_file:
prometheus_config_dict = json.load(prometheus_file)
if prometheus_config_file:
with open(prometheus_config_file) as prometheus_file:
prometheus_config_dict = json.load(prometheus_file)
- vim["prometheus-config"] = prometheus_config_dict
-
+ prometheus_config.update(prometheus_config_dict)
+ if prometheus_config:
+ vim["prometheus-config"] = prometheus_config
vim["vim-username"] = user
vim["vim-password"] = password
vim["vim-url"] = auth_url
vim["vim-username"] = user
vim["vim-password"] = password
vim["vim-url"] = auth_url
@click.option(
"--creds", default=None, help="credentials file (only applicable for GCP VIM type)"
)
@click.option(
"--creds", default=None, help="credentials file (only applicable for GCP VIM type)"
)
+@click.option(
+ "--prometheus_url",
+ default=None,
+ help="PrometheusTSBD URL to get VIM data",
+)
+@click.option(
+ "--prometheus_map",
+ default=None,
+ help="PrometheusTSBD metrics mapping for VIM data",
+)
@click.option(
"--prometheus_config_file",
default=None,
@click.option(
"--prometheus_config_file",
default=None,
sdn_port_mapping,
wait,
creds,
sdn_port_mapping,
wait,
creds,
+ prometheus_url,
+ prometheus_map,
prometheus_config_file,
):
"""updates a VIM account
prometheus_config_file,
):
"""updates a VIM account
if creds:
with open(creds, "r") as cf:
vim_config["credentials"] = yaml.safe_load(cf.read())
if creds:
with open(creds, "r") as cf:
vim_config["credentials"] = yaml.safe_load(cf.read())
+ prometheus_config = {}
+ if prometheus_url:
+ prometheus_config["prometheus-url"] = prometheus_url
+ if prometheus_map:
+ prometheus_config["prometheus-map"] = prometheus_map
if prometheus_config_file:
with open(prometheus_config_file) as prometheus_file:
prometheus_config_dict = json.load(prometheus_file)
if prometheus_config_file:
with open(prometheus_config_file) as prometheus_file:
prometheus_config_dict = json.load(prometheus_file)
- vim["prometheus-config"] = prometheus_config_dict
- logger.info(f"VIM: {vim}, VIM config: {vim_config}")
+ prometheus_config.update(prometheus_config_dict)
+ if prometheus_config:
+ vim["prometheus-config"] = prometheus_config
ctx.obj.vim.update(
name, vim, vim_config, sdn_controller, sdn_port_mapping, wait=wait
)
ctx.obj.vim.update(
name, vim, vim_config, sdn_controller, sdn_port_mapping, wait=wait
)
vim_account["vim_user"] = vim_access["vim-username"] or "null"
vim_account["vim_password"] = vim_access["vim-password"] or "null"
vim_account["vim_tenant_name"] = vim_access["vim-tenant-name"] or "null"
vim_account["vim_user"] = vim_access["vim-username"] or "null"
vim_account["vim_password"] = vim_access["vim-password"] or "null"
vim_account["vim_tenant_name"] = vim_access["vim-tenant-name"] or "null"
+ if "prometheus-config" in vim_access:
+ vim_account["prometheus-config"] = vim_access["prometheus-config"]
return vim_account
def get_id(self, name):
return vim_account
def get_id(self, name):