Revert "Feature 10955: Osmclient changes related to VIM configuration with a Promethe... 25/12725/1
authorLuis Vega <lvega@whitestack.com>
Fri, 25 Nov 2022 13:57:46 +0000 (13:57 +0000)
committerLuis Vega <lvega@whitestack.com>
Fri, 25 Nov 2022 13:58:22 +0000 (13:58 +0000)
This reverts commit e6e9ebfa7cc4d9c3d0bda4a2dcab7f337af63baf.

Change-Id: Ibcc1c5442f8cb44cf20a46172a965a74818c9f26
Signed-off-by: Luis Vega <lvega@whitestack.com>
osmclient/cli_commands/vim.py
osmclient/sol005/http.py
osmclient/sol005/vim.py

index ff1bcc6..c6424ca 100755 (executable)
@@ -75,16 +75,6 @@ def _check_ca_cert(vim_config: dict) -> None:
 @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,
@@ -107,8 +97,6 @@ def vim_create(
     wait,
     vca,
     creds,
-    prometheus_url,
-    prometheus_map,
     prometheus_config_file,
 ):
     """creates a new VIM account"""
@@ -118,17 +106,11 @@ def vim_create(
     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)
-        prometheus_config.update(prometheus_config_dict)
-    if prometheus_config:
-        vim["prometheus-config"] = prometheus_config
+        vim["prometheus-config"] = prometheus_config_dict
+
     vim["vim-username"] = user
     vim["vim-password"] = password
     vim["vim-url"] = auth_url
@@ -184,16 +166,6 @@ def vim_create(
 @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,
@@ -216,8 +188,6 @@ def vim_update(
     sdn_port_mapping,
     wait,
     creds,
-    prometheus_url,
-    prometheus_map,
     prometheus_config_file,
 ):
     """updates a VIM account
@@ -248,17 +218,11 @@ def vim_update(
     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)
-        prometheus_config.update(prometheus_config_dict)
-    if prometheus_config:
-        vim["prometheus-config"] = prometheus_config
+        vim["prometheus-config"] = prometheus_config_dict
+    logger.info(f"VIM: {vim}, VIM config: {vim_config}")
     ctx.obj.vim.update(
         name, vim, vim_config, sdn_controller, sdn_port_mapping, wait=wait
     )
index 1b47204..4234fc8 100644 (file)
@@ -114,6 +114,7 @@ class Http(http.Http):
             curl_cmd.setopt(pycurl.CUSTOMREQUEST, "PATCH")
         curl_cmd.setopt(pycurl.POST, 1)
         curl_cmd.setopt(pycurl.WRITEFUNCTION, data.write)
+
         if postfields_dict is not None:
             jsondata = json.dumps(postfields_dict)
             if "password" in postfields_dict:
index fa40140..72a0822 100644 (file)
@@ -108,6 +108,7 @@ class Vim(object):
         if vim_config:
             vim_account["config"] = vim_config
             # vim_account['config'] = json.dumps(vim_config)
+
         http_code, resp = self._http.post_cmd(
             endpoint=self._apiBase, postfields_dict=vim_account
         )
@@ -196,8 +197,6 @@ class Vim(object):
         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):