From a0531fb313c867b87e8275bc47234145bb09e0d2 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Wed, 26 Aug 2020 15:51:35 -0700 Subject: [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 Change-Id: Ie5ec1636d888d63eaba46bd222a698c12db2c95e --- .../sdc/catalog/license_model_catalog.py | 60 ++++++------ .../onap_client/sdc/catalog/service_catalog.py | 108 ++++++++++----------- onap-client/onap_client/sdc/catalog/vnf_catalog.py | 108 ++++++++++----------- onap-client/onap_client/sdc/catalog/vsp_catalog.py | 78 +++++++-------- onap-client/onap_client/sdc/client.py | 50 ++++++++-- 5 files changed, 220 insertions(+), 184 deletions(-) (limited to 'onap-client/onap_client/sdc') 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 -- cgit 1.2.3-korg