aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-08-26 15:51:35 -0700
committerstark, steven <steven.stark@att.com>2020-08-26 15:51:35 -0700
commita0531fb313c867b87e8275bc47234145bb09e0d2 (patch)
tree290e5efc2ba1f8a002b57a292653093c50f461dd
parent7c90d325e8fd8ce21fa747ab292f9c233e3bf367 (diff)
[VVP] Add configuration override capability to client
- Add capability to override instance-specific client configuration values programatically. - Unrelated cleanup to CLI parameters Issue-ID: VVP-466 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: Ie5ec1636d888d63eaba46bd222a698c12db2c95e
-rw-r--r--onap-client/onap_client/cli.py57
-rw-r--r--onap-client/onap_client/client/catalog.py4
-rw-r--r--onap-client/onap_client/client/clients.py21
-rw-r--r--onap-client/onap_client/engine.py19
-rw-r--r--onap-client/onap_client/sdc/catalog/license_model_catalog.py60
-rw-r--r--onap-client/onap_client/sdc/catalog/service_catalog.py108
-rw-r--r--onap-client/onap_client/sdc/catalog/vnf_catalog.py108
-rw-r--r--onap-client/onap_client/sdc/catalog/vsp_catalog.py78
-rw-r--r--onap-client/onap_client/sdc/client.py50
-rw-r--r--onap-client/onap_client/util.py16
-rw-r--r--onap-client/setup.py2
11 files changed, 282 insertions, 241 deletions
diff --git a/onap-client/onap_client/cli.py b/onap-client/onap_client/cli.py
index 9a58fab..1013403 100644
--- a/onap-client/onap_client/cli.py
+++ b/onap-client/onap_client/cli.py
@@ -42,14 +42,12 @@ from prettytable import PrettyTable
from onap_client.client.clients import get_client as Client
from onap_client.client.catalog import Catalog
from onap_client.engine import spec_cli
-from onap_client.util import utility_cli
+from onap_client.util import utility_cli, get_actions
def main(*args):
cli_arguments = list(args)
request_arguments = {}
- search_key = None
- keys = None
oc = Client()
configure_logging()
@@ -57,23 +55,18 @@ def main(*args):
if len(args) > 0 and args[0] == "spec-engine":
# use engine cli instead
spec_cli(cli_arguments[1:])
- elif len(args) > 0 and args[0] == "utility":
- # use engine cli instead
- utility_cli(oc, cli_arguments[1:])
+ elif len(args) > 0 and convert_to_underscores(args[0]) in oc.utility_functions:
+ # use utility cli instead
+ utility_cli(oc, cli_arguments)
elif len(args) == 0 or args[0] == "--help":
- print(help(oc, extra_clients=["spec-engine", "utility"]))
+ print(help(oc, extra_clients=["spec-engine"], include_utility=True))
else:
while cli_arguments:
arg = cli_arguments.pop(0)
+
if arg == "--help":
print(help(oc))
return
- elif arg == "--search":
- search_key = cli_arguments.pop(0)
- continue
- elif arg == "--keys":
- keys = True
- continue
if is_argument(arg):
arg = convert_to_underscores(arg)
@@ -88,6 +81,7 @@ def main(*args):
except IndexError:
print("No Value passed for argument: {}. Try --help".format(arg))
return
+
request_arguments[arg] = value
else:
arg = convert_to_underscores(arg)
@@ -101,13 +95,8 @@ def main(*args):
output_data = data.response_data
- if isinstance(output_data, dict):
- if keys:
- print("\n".join(x for x in output_data.keys()))
- elif search_key:
- print(output_data.get(search_key))
- else:
- print(json.dumps(output_data, indent=4))
+ if isinstance(output_data, dict) or isinstance(output_data, list):
+ print(json.dumps(output_data, indent=4))
else:
print(output_data)
else:
@@ -139,9 +128,10 @@ def get_value(value):
return value
-def help(client, extra_clients=[]):
+def help(client, extra_clients=[], include_utility=False):
namespaces = []
actions = []
+ utility_data = {}
if isinstance(client, Catalog):
@@ -158,22 +148,23 @@ def help(client, extra_clients=[]):
data = {"clients": namespaces, "actions": actions}
data["clients"].extend(extra_clients)
- return help_table(data)
+ if include_utility:
+ utility_data = get_actions(client.utility_functions)
+ return help_table(data, utility_data)
-def help_table(data):
+
+def help_table(data, utility_data={}):
x = PrettyTable()
x.field_names = [
"name",
"description",
"required parameters",
- "optional parameters",
]
x.align["name"] = "l"
x.align["description"] = "l"
x.align["required parameters"] = "l"
- x.align["optional parameters"] = "l"
for item in data.get("actions"):
name = item.get("name").lower().replace("_", "-")
@@ -185,15 +176,23 @@ def help_table(data):
elif isinstance(param, list):
for param2 in param:
parameters.append(parameterize(param2))
- x.add_row([name, description, "\n".join(parameters), "--keys, --search"])
- x.add_row(["", "", "", ""])
+ x.add_row([name, description, "\n".join(parameters)])
+ x.add_row(["", "", ""])
for item in data.get("clients"):
name = item
description = "Various actions available for {}".format(name)
parameters = ["--help"]
- x.add_row([name, description, "\n".join(parameters), ""])
- x.add_row(["", "", "", ""])
+ x.add_row([name, description, "\n".join(parameters)])
+ x.add_row(["", "", ""])
+
+ for action, data in utility_data.items():
+ name = action
+ description = data[0]
+ parameters = []
+ parameters.extend("<{}>".format(x) for x in data[1])
+ x.add_row([name, description, "\n".join(parameters)])
+ x.add_row(["", "", ""])
return x
diff --git a/onap-client/onap_client/client/catalog.py b/onap-client/onap_client/client/catalog.py
index 419d00f..a69c501 100644
--- a/onap-client/onap_client/client/catalog.py
+++ b/onap-client/onap_client/client/catalog.py
@@ -53,7 +53,7 @@ class Catalog(ABC):
def __call__(self, **kwargs):
return make_request(self.resource, **kwargs)
- def __init__(self):
+ def __init__(self, **kwargs):
"""Iterates through all child classes and attaches them as attributes, named
after the namespace property.
@@ -64,7 +64,7 @@ class Catalog(ABC):
self.catalog_items = {}
for cls in self.__class__.__subclasses__():
- subclass = cls()
+ subclass = cls(**kwargs)
namespace = subclass.namespace
catalog_resources = subclass.catalog_resources
diff --git a/onap-client/onap_client/client/clients.py b/onap-client/onap_client/client/clients.py
index 8a8160f..86c069a 100644
--- a/onap-client/onap_client/client/clients.py
+++ b/onap-client/onap_client/client/clients.py
@@ -48,10 +48,10 @@ from onap_client import config
CACHED_CLIENT = None
-def get_client(config_file=None):
+def get_client(config_file=None, **kwargs):
clients = sys.modules[__name__]
if not clients.CACHED_CLIENT or config_file:
- clients.CACHED_CLIENT = Client(config_file)
+ clients.CACHED_CLIENT = Client(config_file, **kwargs)
return clients.CACHED_CLIENT
@@ -59,14 +59,15 @@ class Client(Catalog):
"""Base class for the ONAP client. Subclasses are dynamically
loaded and added as attributes. Instantiate and use this class
to interact with ONAP."""
- def __init__(self, config_file=None):
+ def __init__(self, config_file=None, **kwargs):
self.config = config.APP_CONFIG
self.modules = import_submodules(onap_client)
+ self._config_overrides = kwargs
- super().__init__()
+ super().__init__(**kwargs)
if config_file:
- logging.info("Overriding ONAP Client configuration: {}".format(config_file))
+ logging.debug("Overriding ONAP Client configuration: {}".format(config_file))
self.set_config(config_file)
@property
@@ -92,11 +93,19 @@ class Client(Catalog):
self.config = config.load_config(config_file, "onap_client")
for attr_name, attr in self.__dict__.items():
if isinstance(attr, Client):
- logging.info("Reloading {} {}".format(attr_name, attr))
+ logging.debug("Reloading {} {}".format(attr_name, attr))
attr.set_config(config_file)
for k, v in attr.catalog_resources.items():
attr.load(k, v)
+ def override(override_key):
+ def decorator(func):
+ def override_check(self):
+ o = self._config_overrides.get(override_key)
+ return o if o else func(self)
+ return override_check
+ return decorator
+
def import_submodules(package, recursive=True):
"""Import all the modules in onap-client, except for those starting
diff --git a/onap-client/onap_client/engine.py b/onap-client/onap_client/engine.py
index d0bf6b8..8f42507 100644
--- a/onap-client/onap_client/engine.py
+++ b/onap-client/onap_client/engine.py
@@ -40,7 +40,6 @@ import json
import logging as logger
from onap_client.resource import Resource
-from onap_client.client.clients import import_submodules
from onap_client.exceptions import InvalidSpecException, ResourceTypeNotFoundException
from onap_client.client.clients import get_client
@@ -79,8 +78,8 @@ def load_spec(input_spec, validate_only=False, submit=True, suppress_out=False,
print("{} is not valid json, exiting...".format(input_spec))
raise
- engine = SpecEngine()
- return engine.load_spec(jdata, validate_only=validate_only, distribute=submit, suppress_out=suppress_out, config=config)
+ engine = SpecEngine(config_file=config)
+ return engine.load_spec(jdata, validate_only=validate_only, distribute=submit, suppress_out=suppress_out)
def spec_cli(args):
@@ -134,19 +133,11 @@ def spec_cli(args):
class SpecEngine:
- def __init__(self):
- self.initialize()
+ def __init__(self, config_file=None, **oc_kwargs):
self.spec = {}
+ self.oc = get_client(config_file=config_file, **oc_kwargs)
- def initialize(self):
- import_submodules("onap_client")
-
- def load_spec(self, spec, distribute=True, validate_only=False, suppress_out=False, config=None):
- # print("loading spec {}".format(spec))
-
- if config:
- oc = get_client(config) # noqa: F841
-
+ def load_spec(self, spec, distribute=True, validate_only=False, suppress_out=False):
self.spec = resolve_spec(spec)
self.validate(self.spec.get("spec", {}))
diff --git a/onap-client/onap_client/sdc/catalog/license_model_catalog.py b/onap-client/onap_client/sdc/catalog/license_model_catalog.py
index a67eaa5..a01b967 100644
--- a/onap-client/onap_client/sdc/catalog/license_model_catalog.py
+++ b/onap-client/onap_client/sdc/catalog/license_model_catalog.py
@@ -67,7 +67,7 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
@@ -76,8 +76,8 @@ class LicenseModelClient(SDCClient):
"license_model_version_id": ("version", "id"),
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_KEY_GROUP": {
@@ -99,14 +99,14 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"key_group_id": ("value",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_ENTITLEMENT_POOL": {
@@ -128,14 +128,14 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"entitlement_pool_id": ("value",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_FEATURE_GROUP": {
@@ -158,14 +158,14 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"feature_group_id": ("value",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_LICENSE_AGREEMENT": {
@@ -183,14 +183,14 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"license_agreement_id": ("value",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"SUBMIT_LICENSE_MODEL": {
@@ -208,13 +208,13 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_LICENSE_MODEL": {
@@ -230,7 +230,7 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
@@ -240,8 +240,8 @@ class LicenseModelClient(SDCClient):
"description": ("description",),
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_LICENSE_MODEL_VERSION_ATTRIBUTE": {
@@ -257,13 +257,13 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_LICENSE_MODEL_VERSIONS": {
@@ -279,13 +279,13 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_LICENSE_MODELS": {
@@ -300,14 +300,14 @@ class LicenseModelClient(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"results": ("results",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
}
diff --git a/onap-client/onap_client/sdc/catalog/service_catalog.py b/onap-client/onap_client/sdc/catalog/service_catalog.py
index 229f2b5..c845422 100644
--- a/onap-client/onap_client/sdc/catalog/service_catalog.py
+++ b/onap-client/onap_client/sdc/catalog/service_catalog.py
@@ -83,14 +83,14 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_service_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"CHECKOUT_CATALOG_SERVICE": {
@@ -106,14 +106,14 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_service_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_RESOURCE_INSTANCE": {
@@ -138,14 +138,14 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_instance_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"DELETE_RESOURCE_FROM_SERVICE": {
@@ -161,13 +161,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"UPDATE_RESOURCE_VERSION": {
@@ -187,13 +187,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"CHECKIN_SERVICE": {
@@ -211,13 +211,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"REQUEST_SERVICE_CERTIFICATION": {
@@ -235,13 +235,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"START_SERVICE_CERTIFICATION": {
@@ -259,13 +259,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_TESTER_USER_ID,
+ "USER_ID": self.sdc_tester_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"FINISH_SERVICE_CERTIFICATION": {
@@ -283,14 +283,14 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_TESTER_USER_ID,
+ "USER_ID": self.sdc_tester_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_service_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"APPROVE_SERVICE_CERTIFICATION": {
@@ -308,13 +308,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_GOVERNOR_USER_ID,
+ "USER_ID": self.sdc_governor_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"DISTRIBUTE_SDC_SERVICE": {
@@ -331,13 +331,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_OPS_USER_ID,
+ "USER_ID": self.sdc_ops_user_id,
# "X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_SERVICE_PROPERTY": {
@@ -363,13 +363,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_SERVICE_INPUT": {
@@ -393,13 +393,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SDC_SERVICE": {
@@ -415,13 +415,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SERVICES": {
@@ -436,14 +436,14 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"services": ("services",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SERVICE_DISTRIBUTION": {
@@ -459,13 +459,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SERVICE_DISTRIBUTION_DETAILS": {
@@ -481,13 +481,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SDC_CSAR": {
@@ -503,13 +503,13 @@ class ServiceCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
}
diff --git a/onap-client/onap_client/sdc/catalog/vnf_catalog.py b/onap-client/onap_client/sdc/catalog/vnf_catalog.py
index 0cdd5df..692052f 100644
--- a/onap-client/onap_client/sdc/catalog/vnf_catalog.py
+++ b/onap-client/onap_client/sdc/catalog/vnf_catalog.py
@@ -75,14 +75,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"CERTIFY_CATALOG_RESOURCE": {
@@ -100,14 +100,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_RESOURCE_INPUT": {
@@ -131,13 +131,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"UPDATE_CATALOG_RESOURCE": {
@@ -155,13 +155,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"CHECKOUT_CATALOG_RESOURCE": {
@@ -177,13 +177,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_RESOURCE_PROPERTY": {
@@ -209,13 +209,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_RESOURCE_PROPERTY_NON_VF": {
@@ -241,13 +241,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_RESOURCE_POLICY": {
@@ -263,14 +263,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_POLICY_PROPERTY": {
@@ -294,13 +294,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_RESOURCE_GROUP": {
@@ -316,14 +316,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_id": ("uniqueId",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_CATALOG_GROUP_PROPERTY": {
@@ -349,13 +349,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_GROUP_TO_INSTANCE": {
@@ -373,13 +373,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_POLICY_TO_INSTANCE": {
@@ -397,13 +397,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_RESOURCE_INSTANCE": {
@@ -429,13 +429,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_RESOURCE_RELATIONSHIP": {
@@ -462,13 +462,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_CATALOG_RESOURCE": {
@@ -484,14 +484,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"catalog_resource_name": ("name",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_CATALOG_RESOURCE_METADATA": {
@@ -507,13 +507,13 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_RESOURCES": {
@@ -528,14 +528,14 @@ class VNFCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"resources": ("resources",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
}
diff --git a/onap-client/onap_client/sdc/catalog/vsp_catalog.py b/onap-client/onap_client/sdc/catalog/vsp_catalog.py
index a6e4a2b..c16fa16 100644
--- a/onap-client/onap_client/sdc/catalog/vsp_catalog.py
+++ b/onap-client/onap_client/sdc/catalog/vsp_catalog.py
@@ -77,7 +77,7 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
@@ -86,8 +86,8 @@ class VSPCatalog(SDCClient):
"software_product_version_id": ("version", "id"),
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"UPDATE_SOFTWARE_PRODUCT": {
@@ -107,13 +107,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"UPLOAD_HEAT_PACKAGE": {
@@ -130,13 +130,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "multipart/form-data",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"VALIDATE_SOFTWARE_PRODUCT": {
@@ -152,13 +152,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"SUBMIT_SOFTWARE_PRODUCT": {
@@ -176,13 +176,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"PACKAGE_SOFTWARE_PRODUCT": {
@@ -200,13 +200,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SOFTWARE_PRODUCT": {
@@ -222,14 +222,14 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"name": ("name",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SOFTWARE_PRODUCT_INFORMATION": {
@@ -245,14 +245,14 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"name": ("name",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SOFTWARE_PRODUCT_VERSIONS": {
@@ -268,7 +268,7 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
@@ -277,8 +277,8 @@ class VSPCatalog(SDCClient):
"description": ("description",),
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_SOFTWARE_PRODUCTS": {
@@ -293,14 +293,14 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"return_data": {"results": ("results",)},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"GET_VSP_PERMISSIONS": {
@@ -316,13 +316,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"ADD_VSP_CONTRIBUTER": {
@@ -340,13 +340,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
"MODIFY_VSP_OWNER": {
@@ -364,13 +364,13 @@ class VSPCatalog(SDCClient):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
}
diff --git a/onap-client/onap_client/sdc/client.py b/onap-client/onap_client/sdc/client.py
index 4089c39..cfdd4ad 100644
--- a/onap-client/onap_client/sdc/client.py
+++ b/onap-client/onap_client/sdc/client.py
@@ -68,10 +68,10 @@ class SDCClient(Client):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": application_id,
},
- "auth": (
- self.config.sdc.SDC_DESIGNER_USER_ID,
- self.config.sdc.SDC_DESIGNER_PASSWORD,
- ),
+ # "auth": (
+ # self.sdc_designer_user_id,
+ # self.config.sdc.SDC_DESIGNER_PASSWORD,
+ # ),
},
"GET_RESOURCE_CATEGORIES": {
"verb": "GET",
@@ -85,11 +85,47 @@ class SDCClient(Client):
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
- "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ "USER_ID": self.sdc_designer_user_id,
},
"auth": (
- self.config.sdc.GLOBAL_SDC_USERNAME,
- self.config.sdc.GLOBAL_SDC_PASSWORD,
+ self.global_sdc_username,
+ self.global_sdc_password,
),
},
}
+
+ @property
+ @Client.override("global_sdc_username")
+ def global_sdc_username(self):
+ """Username to authenticate to SDC"""
+ return self.config.sdc.GLOBAL_SDC_USERNAME
+
+ @property
+ @Client.override("global_sdc_password")
+ def global_sdc_password(self):
+ """Password to authenticate to SDC"""
+ return self.config.sdc.GLOBAL_SDC_PASSWORD
+
+ @property
+ @Client.override("sdc_designer_user_id")
+ def sdc_designer_user_id(self):
+ """Designer role User ID"""
+ return self.config.sdc.SDC_DESIGNER_USER_ID
+
+ @property
+ @Client.override("sdc_tester_user_id")
+ def sdc_tester_user_id(self):
+ """Tester role User ID"""
+ return self.config.sdc.SDC_TESTER_USER_ID
+
+ @property
+ @Client.override("sdc_ops_user_id")
+ def sdc_ops_user_id(self):
+ """Ops role User ID"""
+ return self.config.sdc.SDC_OPS_USER_ID
+
+ @property
+ @Client.override("sdc_governor_user_id")
+ def sdc_governor_user_id(self):
+ """Ops role User ID"""
+ return self.config.sdc.SDC_GOVERNOR_USER_ID
diff --git a/onap-client/onap_client/util.py b/onap-client/onap_client/util.py
index d3148d0..4c8043a 100644
--- a/onap-client/onap_client/util.py
+++ b/onap-client/onap_client/util.py
@@ -59,10 +59,6 @@ def utility_cli(onap_client, cli_arguments):
return
if callable(functions):
- if cli_arguments[0] == "--help":
- help(functions)
- return
-
if functions.__code__.co_argcount != len(cli_arguments):
print(
"Function requires {} arguments, but {} were passed. Try --help.".format(
@@ -71,6 +67,10 @@ def utility_cli(onap_client, cli_arguments):
)
return
+ if cli_arguments[0] == "--help":
+ help(functions)
+ return
+
return_data = functions(*cli_arguments[0:])
if isinstance(return_data, str):
print(return_data)
@@ -89,6 +89,12 @@ def convert_to_dash(argument):
def help(functions):
+ actions = get_actions(functions)
+
+ print(help_table(actions))
+
+
+def get_actions(functions):
actions = {}
actions["--help"] = ("", "")
if isinstance(functions, dict):
@@ -103,7 +109,7 @@ def help(functions):
list(functions.__code__.co_varnames[: functions.__code__.co_argcount]),
)
- print(help_table(actions))
+ return actions
def help_table(actions):
diff --git a/onap-client/setup.py b/onap-client/setup.py
index d02864b..6a2ba11 100644
--- a/onap-client/setup.py
+++ b/onap-client/setup.py
@@ -47,7 +47,7 @@ for file in os.listdir("etc/payloads"):
setuptools.setup(
name="onap-client",
- version="0.9.4",
+ version="0.10.0",
author="Steven Stark",
author_email="steven.stark@att.com",
description="Python API wrapper for ONAP applications",