diff options
author | 2020-08-03 13:03:24 -0700 | |
---|---|---|
committer | 2020-08-03 13:03:24 -0700 | |
commit | 32409110b65b013bc65930f3cfdef09671cd3a5a (patch) | |
tree | 4bb6c95c057cdde0f08af78e7abc53e2be02fad4 /onap-client/onap_client/sdc/catalog | |
parent | 9df81b14e7203d6c3911f5f36881cb5170afdccc (diff) |
[VVP] ONAP Client enhancements
Output hooks for resources. Outputs for each resource are returned as part of the complete onap-client spec when a resource is created. Hooks have been added for the SDC resources, to return the TOSCA model for each created resource.
Dynamic config change. Ability to specify and reconfigure the onap-client configuration file at runtime without restarting the current session.
Logging. Logging has been upgraded to create its own logging instance rather than the root logging instance, to avoid collisions.
Issue-ID: VVP-455
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: I7b03411d221801fc51b80ee6a73d9491e823da56
Diffstat (limited to 'onap-client/onap_client/sdc/catalog')
-rw-r--r-- | onap-client/onap_client/sdc/catalog/license_model_catalog.py | 527 | ||||
-rw-r--r-- | onap-client/onap_client/sdc/catalog/service_catalog.py | 931 | ||||
-rw-r--r-- | onap-client/onap_client/sdc/catalog/vnf_catalog.py | 983 | ||||
-rw-r--r-- | onap-client/onap_client/sdc/catalog/vsp_catalog.py | 653 |
4 files changed, 1537 insertions, 1557 deletions
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 278645d..a67eaa5 100644 --- a/onap-client/onap_client/sdc/catalog/license_model_catalog.py +++ b/onap-client/onap_client/sdc/catalog/license_model_catalog.py @@ -38,281 +38,276 @@ import uuid from functools import partial -from onap_client import sdc from onap_client import config from onap_client.sdc.client import SDCClient PAYLOADS_DIR = config.PAYLOADS_DIR -sdc_properties = sdc.SDC_PROPERTIES application_id = config.APPLICATION_ID class LicenseModelClient(SDCClient): @property - def catalog_resources(self): - return CATALOG_RESOURCES - - @property def namespace(self): return "license_model" - -CATALOG_RESOURCES = { - "ADD_LICENSE_MODEL": { - "verb": "POST", - "description": "creates a license model in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "payload": "{}/license_model.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["vendor_name"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": { - "license_model_id": ("itemId",), - "license_model_version_id": ("version", "id"), - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_KEY_GROUP": { - "verb": "POST", - "description": "Adds a key group to a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/license-key-groups".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "payload": "{}/key_group.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "license_start_date", - "license_end_date", - "key_group_name", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"key_group_id": ("value",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_ENTITLEMENT_POOL": { - "verb": "POST", - "description": "Adds an entitlement pool to a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/entitlement-pools".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "payload": "{}/entitlement_pool.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "license_start_date", - "license_end_date", - "entitlement_pool_name", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"entitlement_pool_id": ("value",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_FEATURE_GROUP": { - "verb": "POST", - "description": "Adds an feature group to a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/feature-groups".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "payload": "{}/feature_group.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "feature_group_name", - "key_group_id", - "entitlement_pool_id", - "manufacturer_reference_number", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"feature_group_id": ("value",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_LICENSE_AGREEMENT": { - "verb": "POST", - "description": "Adds an license agreement to a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/license-agreements".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "payload": "{}/license_agreement.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["feature_group_id", "license_agreement_name"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"license_agreement_id": ("value",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "SUBMIT_LICENSE_MODEL": { - "verb": "PUT", - "description": "Submits a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/actions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "payload": "{}/action.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["action"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_LICENSE_MODEL": { - "verb": "GET", - "description": "Returns a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": { - "vendor_name": ("vendorName",), - "license_model_id": ("id",), - "description": ("description",), - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_LICENSE_MODEL_VERSION_ATTRIBUTE": { - "verb": "GET", - "description": "Returns an attribute for a license model (license-agreements, features-groups, etc...)", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/{attribute}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_LICENSE_MODEL_PATH, - ), - "uri-parameters": ["license_model_id", "license_model_version_id", "attribute"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_LICENSE_MODEL_VERSIONS": { - "verb": "GET", - "description": "Returns the version list for a license model", - "uri": partial( - "{endpoint}{service_path}/{license_model_id}/versions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "uri-parameters": ["license_model_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_LICENSE_MODELS": { - "verb": "GET", - "description": "Returns the full list of license models from SDC", - "uri": partial( - "{endpoint}{service_path}?&itemType=vlm".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"results": ("results",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, -} + @property + def catalog_resources(self): + return { + "ADD_LICENSE_MODEL": { + "verb": "POST", + "description": "creates a license model in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "payload": "{}/license_model.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["vendor_name"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + "X-TransactionId": str(uuid.uuid4()), + "X-FromAppId": application_id, + }, + "return_data": { + "license_model_id": ("itemId",), + "license_model_version_id": ("version", "id"), + }, + "auth": ( + self.config.sdc.GLOBAL_SDC_USERNAME, + self.config.sdc.GLOBAL_SDC_PASSWORD, + ), + }, + "ADD_KEY_GROUP": { + "verb": "POST", + "description": "Adds a key group to a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/license-key-groups".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "payload": "{}/key_group.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "license_start_date", + "license_end_date", + "key_group_name", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_ENTITLEMENT_POOL": { + "verb": "POST", + "description": "Adds an entitlement pool to a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/entitlement-pools".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "payload": "{}/entitlement_pool.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "license_start_date", + "license_end_date", + "entitlement_pool_name", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_FEATURE_GROUP": { + "verb": "POST", + "description": "Adds an feature group to a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/feature-groups".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "payload": "{}/feature_group.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "feature_group_name", + "key_group_id", + "entitlement_pool_id", + "manufacturer_reference_number", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_LICENSE_AGREEMENT": { + "verb": "POST", + "description": "Adds an license agreement to a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/license-agreements".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "payload": "{}/license_agreement.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["feature_group_id", "license_agreement_name"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "SUBMIT_LICENSE_MODEL": { + "verb": "PUT", + "description": "Submits a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/actions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "payload": "{}/action.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["action"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_LICENSE_MODEL": { + "verb": "GET", + "description": "Returns a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + "X-TransactionId": str(uuid.uuid4()), + "X-FromAppId": application_id, + }, + "return_data": { + "vendor_name": ("vendorName",), + "license_model_id": ("id",), + "description": ("description",), + }, + "auth": ( + self.config.sdc.GLOBAL_SDC_USERNAME, + self.config.sdc.GLOBAL_SDC_PASSWORD, + ), + }, + "GET_LICENSE_MODEL_VERSION_ATTRIBUTE": { + "verb": "GET", + "description": "Returns an attribute for a license model (license-agreements, features-groups, etc...)", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions/{license_model_version_id}/{attribute}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_LICENSE_MODEL_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id", "attribute"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_LICENSE_MODEL_VERSIONS": { + "verb": "GET", + "description": "Returns the version list for a license model", + "uri": partial( + "{endpoint}{service_path}/{license_model_id}/versions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "uri-parameters": ["license_model_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_LICENSE_MODELS": { + "verb": "GET", + "description": "Returns the full list of license models from SDC", + "uri": partial( + "{endpoint}{service_path}?&itemType=vlm".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + } diff --git a/onap-client/onap_client/sdc/catalog/service_catalog.py b/onap-client/onap_client/sdc/catalog/service_catalog.py index c40306f..229f2b5 100644 --- a/onap-client/onap_client/sdc/catalog/service_catalog.py +++ b/onap-client/onap_client/sdc/catalog/service_catalog.py @@ -38,483 +38,478 @@ import uuid from functools import partial -from onap_client import sdc from onap_client import config from onap_client.sdc.client import SDCClient PAYLOADS_DIR = config.PAYLOADS_DIR -sdc_properties = sdc.SDC_PROPERTIES application_id = config.APPLICATION_ID class ServiceCatalog(SDCClient): @property - def catalog_resources(self): - return CATALOG_RESOURCES - - @property def namespace(self): return "service" - -CATALOG_RESOURCES = { - "ADD_CATALOG_SERVICE": { - "verb": "POST", - "description": "Creates a Service in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "payload": "{}/catalog_service.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "service_name", - "instantiation_type", - "contact_id", - "category_name", - "category_id", - "category_name_lower", - "category_name_icon", - "tag", - "project_code", - "environment_context", - "ecomp_generated_naming", - "description", - "service_type", - "service_role", - "naming_policy", - ], - "success_code": 201, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_service_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "CHECKOUT_CATALOG_SERVICE": { - "verb": "POST", - "description": "Creates a new version of a Service in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/CHECKOUT".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_service_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_RESOURCE_INSTANCE": { - "verb": "POST", - "description": "Attaches a Resource to a Service", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/resourceInstance".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/resource_instance.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "milli_timestamp", - "catalog_resource_id", - "catalog_resource_name", - "originType", - "posX", - "posY", - ], - "success_code": 201, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_instance_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "DELETE_RESOURCE_FROM_SERVICE": { - "verb": "DELETE", - "description": "Deletes a resource from a service.", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{resource_instance_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id", "resource_instance_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "UPDATE_RESOURCE_VERSION": { - "verb": "POST", - "description": "Updates a component version in a service", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{component_name}/changeVersion".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id", "component_name"], - "payload": "{}/update_resource_instance.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "component_id", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "CHECKIN_SERVICE": { - "verb": "POST", - "description": "Checks a service into the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/checkin".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "REQUEST_SERVICE_CERTIFICATION": { - "verb": "POST", - "description": "Requests certification of a service into the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/certificationRequest".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "START_SERVICE_CERTIFICATION": { - "verb": "POST", - "description": "Starts certification of a service into the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/startCertification".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_TESTER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "FINISH_SERVICE_CERTIFICATION": { - "verb": "POST", - "description": "Finishes certification of a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/certify".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_TESTER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_service_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "APPROVE_SERVICE_CERTIFICATION": { - "verb": "POST", - "description": "Approves a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/distribution-state/approve".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_GOVERNOR_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "DISTRIBUTE_SDC_SERVICE": { - "verb": "POST", - "description": "Distributes a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/distribution/PROD/activate".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "success_code": 200, - "header-parameters": ["X-TransactionId"], - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_OPS_USER_ID, - # "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_SERVICE_PROPERTY": { - "verb": "POST", - "description": "Add a property value for a VF in a Service", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{catalog_resource_instance_id}/properties".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_service_id", "catalog_resource_instance_id"], - "payload": "{}/catalog_service_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "parent_unique_id", - "owner_id", - "input_name", - "input_value", - "schema_type", - "property_type", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_SERVICE_INPUT": { - "verb": "POST", - "description": "Add an input value for a VF in a Service", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{catalog_resource_instance_id}/inputs".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_service_id", "catalog_resource_instance_id"], - "payload": "{}/catalog_service_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "parent_unique_id", - "owner_id", - "input_name", - "input_value", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SDC_SERVICE": { - "verb": "GET", - "description": "Gets a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SERVICES": { - "verb": "GET", - "description": "Get all services in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_SCREEN_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"services": ("services",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SERVICE_DISTRIBUTION": { - "verb": "GET", - "description": "Gets the distribution for a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/{distribution_service_id}/distribution".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["distribution_service_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SERVICE_DISTRIBUTION_DETAILS": { - "verb": "GET", - "description": "Gets the distribution details for a service from the SDC Catalog", - "uri": partial( - "{endpoint}{service_path}/distribution/{distribution_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["distribution_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SDC_CSAR": { - "verb": "GET", - "description": "Returns the CSAR for a service.", - "uri": partial( - "{endpoint}{service_path}/{catalog_service_id}/artifacts/{csar_artifact_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_SERVICES_PATH, - ), - "uri-parameters": ["catalog_service_id", "csar_artifact_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, -} + @property + def catalog_resources(self): + return { + "ADD_CATALOG_SERVICE": { + "verb": "POST", + "description": "Creates a Service in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "payload": "{}/catalog_service.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "service_name", + "instantiation_type", + "contact_id", + "category_name", + "category_id", + "category_name_lower", + "category_name_icon", + "tag", + "project_code", + "environment_context", + "ecomp_generated_naming", + "description", + "service_type", + "service_role", + "naming_policy", + ], + "success_code": 201, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "CHECKOUT_CATALOG_SERVICE": { + "verb": "POST", + "description": "Creates a new version of a Service in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/CHECKOUT".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_RESOURCE_INSTANCE": { + "verb": "POST", + "description": "Attaches a Resource to a Service", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/resourceInstance".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/resource_instance.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "milli_timestamp", + "catalog_resource_id", + "catalog_resource_name", + "originType", + "posX", + "posY", + ], + "success_code": 201, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "DELETE_RESOURCE_FROM_SERVICE": { + "verb": "DELETE", + "description": "Deletes a resource from a service.", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{resource_instance_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id", "resource_instance_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "UPDATE_RESOURCE_VERSION": { + "verb": "POST", + "description": "Updates a component version in a service", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{component_name}/changeVersion".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id", "component_name"], + "payload": "{}/update_resource_instance.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "component_id", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "CHECKIN_SERVICE": { + "verb": "POST", + "description": "Checks a service into the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/checkin".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "REQUEST_SERVICE_CERTIFICATION": { + "verb": "POST", + "description": "Requests certification of a service into the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/certificationRequest".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "START_SERVICE_CERTIFICATION": { + "verb": "POST", + "description": "Starts certification of a service into the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/startCertification".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "FINISH_SERVICE_CERTIFICATION": { + "verb": "POST", + "description": "Finishes certification of a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/certify".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "APPROVE_SERVICE_CERTIFICATION": { + "verb": "POST", + "description": "Approves a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/distribution-state/approve".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "DISTRIBUTE_SDC_SERVICE": { + "verb": "POST", + "description": "Distributes a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/distribution/PROD/activate".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "success_code": 200, + "header-parameters": ["X-TransactionId"], + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_SERVICE_PROPERTY": { + "verb": "POST", + "description": "Add a property value for a VF in a Service", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{catalog_resource_instance_id}/properties".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_service_id", "catalog_resource_instance_id"], + "payload": "{}/catalog_service_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "parent_unique_id", + "owner_id", + "input_name", + "input_value", + "schema_type", + "property_type", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_SERVICE_INPUT": { + "verb": "POST", + "description": "Add an input value for a VF in a Service", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/resourceInstance/{catalog_resource_instance_id}/inputs".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_service_id", "catalog_resource_instance_id"], + "payload": "{}/catalog_service_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "parent_unique_id", + "owner_id", + "input_name", + "input_value", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SDC_SERVICE": { + "verb": "GET", + "description": "Gets a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SERVICES": { + "verb": "GET", + "description": "Get all services in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_SCREEN_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SERVICE_DISTRIBUTION": { + "verb": "GET", + "description": "Gets the distribution for a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/{distribution_service_id}/distribution".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["distribution_service_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SERVICE_DISTRIBUTION_DETAILS": { + "verb": "GET", + "description": "Gets the distribution details for a service from the SDC Catalog", + "uri": partial( + "{endpoint}{service_path}/distribution/{distribution_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["distribution_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SDC_CSAR": { + "verb": "GET", + "description": "Returns the CSAR for a service.", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/artifacts/{csar_artifact_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_SERVICES_PATH, + ), + "uri-parameters": ["catalog_service_id", "csar_artifact_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + } diff --git a/onap-client/onap_client/sdc/catalog/vnf_catalog.py b/onap-client/onap_client/sdc/catalog/vnf_catalog.py index 852d008..0cdd5df 100644 --- a/onap-client/onap_client/sdc/catalog/vnf_catalog.py +++ b/onap-client/onap_client/sdc/catalog/vnf_catalog.py @@ -38,509 +38,504 @@ import uuid from functools import partial -from onap_client import sdc from onap_client import config from onap_client.sdc.client import SDCClient PAYLOADS_DIR = config.PAYLOADS_DIR -sdc_properties = sdc.SDC_PROPERTIES application_id = config.APPLICATION_ID class VNFCatalog(SDCClient): @property - def catalog_resources(self): - return CATALOG_RESOURCES - - @property def namespace(self): return "vnf" - -CATALOG_RESOURCES = { - "ADD_CATALOG_RESOURCE": { - "verb": "POST", - "description": "Adds a VNF to the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_resource.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "software_product_id", - "vnf_name", - "vendor_name", - "resource_type", - "categories", - "contact_id", - "vnf_description", - ], - "success_code": 201, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "CERTIFY_CATALOG_RESOURCE": { - "verb": "POST", - "description": "Certifies a VNF in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/lifecycleState/certify".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_remarks"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_RESOURCE_INPUT": { - "verb": "POST", - "description": "Adds an input value for a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/update/inputs".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_vnf_input.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "input_default_value", - "input_name", - "input_parent_unique_id", - "input_unique_id", - "input_owner_id", - ], - "uri-parameters": ["catalog_resource_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "UPDATE_CATALOG_RESOURCE": { - "verb": "PUT", - "description": "Creates a new version of a VF resource", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "success_code": 200, - "payload": "{}/generic_payload.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["payload_data"], - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "CHECKOUT_CATALOG_RESOURCE": { - "verb": "POST", - "description": "Checks out a VF from the catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/lifecycleState/CHECKOUT".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_RESOURCE_PROPERTY": { - "verb": "POST", - "description": "Adds an property value for a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/{catalog_resource_instance_id}/inputs".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_vnf_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "parent_unique_id", - "owner_id", - "property_name", - "property_default_value", - "schema_type", - "property_type", - ], - "uri-parameters": ["catalog_resource_id", "catalog_resource_instance_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_RESOURCE_PROPERTY_NON_VF": { - "verb": "POST", - "description": "Adds an property value for a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/{catalog_resource_instance_id}/properties".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_vnf_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "parent_unique_id", - "owner_id", - "property_name", - "property_default_value", - "schema_type", - "property_type", - ], - "uri-parameters": ["catalog_resource_id", "catalog_resource_instance_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_RESOURCE_POLICY": { - "verb": "POST", - "description": "Adds an policy resource to a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_name}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id", "catalog_policy_name"], - "success_code": 201, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_POLICY_PROPERTY": { - "verb": "PUT", - "description": "Adds a property to a policy for a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_id}/properties".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id", "catalog_policy_id"], - "payload": "{}/catalog_vnf_policy_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "property_name", - "property_default_value", - "description", - "property_type", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_RESOURCE_GROUP": { - "verb": "POST", - "description": "Adds an group resource to a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_name}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id", "catalog_group_name"], - "success_code": 201, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_id": ("uniqueId",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_CATALOG_GROUP_PROPERTY": { - "verb": "PUT", - "description": "Adds a property to a group for a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_id}/properties".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id", "catalog_group_id"], - "payload": "{}/catalog_vnf_group_property.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "unique_id", - "property_name", - "property_default_value", - "description", - "property_type", - "owner_id", - "parent_unique_id", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_GROUP_TO_INSTANCE": { - "verb": "POST", - "description": "Associate a group with a Catalog Instance", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_id}/members".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_vnf_group.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["instance_id"], - "uri-parameters": ["catalog_resource_id", "catalog_group_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_POLICY_TO_INSTANCE": { - "verb": "POST", - "description": "Associate a policy with a Catalog Instance", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_id}/targets".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "payload": "{}/catalog_vnf_policy.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["instance_ids"], - "uri-parameters": ["catalog_resource_id", "catalog_policy_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_RESOURCE_INSTANCE": { - "verb": "POST", - "description": "Attaches a Resource to a VNF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "payload": "{}/resource_instance_vnf.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "milli_timestamp", - "new_catalog_resource_id", - "new_catalog_resource_name", - "originType", - "posX", - "posY", - ], - "success_code": 201, - "return_data": {"catalog_resource_instance_id": ("uniqueId",)}, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_RESOURCE_RELATIONSHIP": { - "verb": "POST", - "description": "Creates a relationship between two resources in a VF", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/associate".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "payload": "{}/add_resource_relationship.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "from_node_resource_id", - "to_node_resource_id", - "relationship_type", - "capability_name", - "capability_owner_id", - "capability_id", - "requirement_name", - "requirement_id", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_CATALOG_RESOURCE": { - "verb": "GET", - "description": "Gets a VNF in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"catalog_resource_name": ("name",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_CATALOG_RESOURCE_METADATA": { - "verb": "GET", - "description": "Gets metadata for a VNF in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}/{catalog_resource_id}/filteredDataByParams?include=metadata".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_CATALOG_RESOURCES_PATH, - ), - "uri-parameters": ["catalog_resource_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_RESOURCES": { - "verb": "GET", - "description": "Get all resources in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ENDPOINT, - service_path=sdc_properties.SDC_SCREEN_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"resources": ("resources",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, -} + @property + def catalog_resources(self): + return { + "ADD_CATALOG_RESOURCE": { + "verb": "POST", + "description": "Adds a VNF to the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_resource.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "software_product_id", + "vnf_name", + "vendor_name", + "resource_type", + "categories", + "contact_id", + "vnf_description", + ], + "success_code": 201, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "CERTIFY_CATALOG_RESOURCE": { + "verb": "POST", + "description": "Certifies a VNF in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/lifecycleState/certify".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "payload": "{}/user_remarks.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_remarks"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_RESOURCE_INPUT": { + "verb": "POST", + "description": "Adds an input value for a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/update/inputs".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_vnf_input.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "input_default_value", + "input_name", + "input_parent_unique_id", + "input_unique_id", + "input_owner_id", + ], + "uri-parameters": ["catalog_resource_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "UPDATE_CATALOG_RESOURCE": { + "verb": "PUT", + "description": "Creates a new version of a VF resource", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "success_code": 200, + "payload": "{}/generic_payload.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["payload_data"], + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "CHECKOUT_CATALOG_RESOURCE": { + "verb": "POST", + "description": "Checks out a VF from the catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/lifecycleState/CHECKOUT".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_RESOURCE_PROPERTY": { + "verb": "POST", + "description": "Adds an property value for a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/{catalog_resource_instance_id}/inputs".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_vnf_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "parent_unique_id", + "owner_id", + "property_name", + "property_default_value", + "schema_type", + "property_type", + ], + "uri-parameters": ["catalog_resource_id", "catalog_resource_instance_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_RESOURCE_PROPERTY_NON_VF": { + "verb": "POST", + "description": "Adds an property value for a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/{catalog_resource_instance_id}/properties".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_vnf_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "parent_unique_id", + "owner_id", + "property_name", + "property_default_value", + "schema_type", + "property_type", + ], + "uri-parameters": ["catalog_resource_id", "catalog_resource_instance_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_RESOURCE_POLICY": { + "verb": "POST", + "description": "Adds an policy resource to a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_name}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id", "catalog_policy_name"], + "success_code": 201, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_POLICY_PROPERTY": { + "verb": "PUT", + "description": "Adds a property to a policy for a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_id}/properties".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id", "catalog_policy_id"], + "payload": "{}/catalog_vnf_policy_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "property_name", + "property_default_value", + "description", + "property_type", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_RESOURCE_GROUP": { + "verb": "POST", + "description": "Adds an group resource to a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_name}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id", "catalog_group_name"], + "success_code": 201, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_CATALOG_GROUP_PROPERTY": { + "verb": "PUT", + "description": "Adds a property to a group for a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_id}/properties".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id", "catalog_group_id"], + "payload": "{}/catalog_vnf_group_property.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "unique_id", + "property_name", + "property_default_value", + "description", + "property_type", + "owner_id", + "parent_unique_id", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_GROUP_TO_INSTANCE": { + "verb": "POST", + "description": "Associate a group with a Catalog Instance", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/groups/{catalog_group_id}/members".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_vnf_group.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["instance_id"], + "uri-parameters": ["catalog_resource_id", "catalog_group_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_POLICY_TO_INSTANCE": { + "verb": "POST", + "description": "Associate a policy with a Catalog Instance", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/policies/{catalog_policy_id}/targets".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "payload": "{}/catalog_vnf_policy.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["instance_ids"], + "uri-parameters": ["catalog_resource_id", "catalog_policy_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_RESOURCE_INSTANCE": { + "verb": "POST", + "description": "Attaches a Resource to a VNF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "payload": "{}/resource_instance_vnf.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "milli_timestamp", + "new_catalog_resource_id", + "new_catalog_resource_name", + "originType", + "posX", + "posY", + ], + "success_code": 201, + "return_data": {"catalog_resource_instance_id": ("uniqueId",)}, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_RESOURCE_RELATIONSHIP": { + "verb": "POST", + "description": "Creates a relationship between two resources in a VF", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/resourceInstance/associate".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "payload": "{}/add_resource_relationship.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "from_node_resource_id", + "to_node_resource_id", + "relationship_type", + "capability_name", + "capability_owner_id", + "capability_id", + "requirement_name", + "requirement_id", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_CATALOG_RESOURCE": { + "verb": "GET", + "description": "Gets a VNF in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_CATALOG_RESOURCE_METADATA": { + "verb": "GET", + "description": "Gets metadata for a VNF in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}/{catalog_resource_id}/filteredDataByParams?include=metadata".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_CATALOG_RESOURCES_PATH, + ), + "uri-parameters": ["catalog_resource_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_RESOURCES": { + "verb": "GET", + "description": "Get all resources in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ENDPOINT, + service_path=self.config.sdc.SDC_SCREEN_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + } diff --git a/onap-client/onap_client/sdc/catalog/vsp_catalog.py b/onap-client/onap_client/sdc/catalog/vsp_catalog.py index 702a1a2..a6e4a2b 100644 --- a/onap-client/onap_client/sdc/catalog/vsp_catalog.py +++ b/onap-client/onap_client/sdc/catalog/vsp_catalog.py @@ -38,344 +38,339 @@ import uuid from functools import partial -from onap_client import sdc from onap_client import config from onap_client.sdc.client import SDCClient PAYLOADS_DIR = config.PAYLOADS_DIR -sdc_properties = sdc.SDC_PROPERTIES application_id = config.APPLICATION_ID class VSPCatalog(SDCClient): @property - def catalog_resources(self): - return CATALOG_RESOURCES - - @property def namespace(self): return "vsp" - -CATALOG_RESOURCES = { - "ADD_SOFTWARE_PRODUCT": { - "verb": "POST", - "description": "Creates a VSP in the SDC catalog", - "uri": partial( - "{endpoint}{service_path}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "payload": "{}/software_product.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "software_product_name", - "feature_group_id", - "license_agreement_id", - "vendor_name", - "license_model_id", - "license_model_version_id", - "description", - "category", - "sub_category", - ], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": { - "software_product_id": ("itemId",), - "software_product_version_id": ("version", "id"), - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "UPDATE_SOFTWARE_PRODUCT": { - "verb": "POST", - "description": "Updates a VSP to a new version", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "payload": "{}/software_product_update.jinja".format(PAYLOADS_DIR), - "payload-parameters": [ - "description", - ], - "uri-parameters": ["software_product_id", "software_product_version_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "UPLOAD_HEAT_PACKAGE": { - "verb": "POST", - "description": "Uploads a heat zip to a VSP", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/orchestration-template-candidate".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "files-parameters": ["file_path", "file_type"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "multipart/form-data", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "VALIDATE_SOFTWARE_PRODUCT": { - "verb": "PUT", - "description": "Validates VSP with Heat Zip", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/orchestration-template-candidate/process".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "SUBMIT_SOFTWARE_PRODUCT": { - "verb": "PUT", - "description": "Submits Heat Zip to VSP", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/actions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "payload": "{}/action.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["action"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "PACKAGE_SOFTWARE_PRODUCT": { - "verb": "PUT", - "description": "Packages VSP (description needs to be better??)", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/actions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "payload": "{}/action.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["action"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SOFTWARE_PRODUCT": { - "verb": "GET", - "description": "Gets VSP from Catalog", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"name": ("name",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SOFTWARE_PRODUCT_INFORMATION": { - "verb": "GET", - "description": "Gets Information for a VSP from Catalog", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/questionnaire".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, - ), - "uri-parameters": ["software_product_id", "software_product_version_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"name": ("name",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SOFTWARE_PRODUCT_VERSIONS": { - "verb": "GET", - "description": "Returns a list of vsp versions", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/versions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "uri-parameters": ["software_product_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": { - "software_product_version_id": ("id",), - "description": ("description",), - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_SOFTWARE_PRODUCTS": { - "verb": "GET", - "description": "Returns a list of vsps", - "uri": partial( - "{endpoint}{service_path}?&itemType=vsp".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "return_data": {"results": ("results",)}, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "GET_VSP_PERMISSIONS": { - "verb": "GET", - "description": "Returns the permissions for a VSP.", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/permissions".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "uri-parameters": ["software_product_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "ADD_VSP_CONTRIBUTER": { - "verb": "PUT", - "description": "Adds a user to a VSP as a contributer", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/permissions/Contributor".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "uri-parameters": ["software_product_id"], - "payload": "{}/add_vsp_contributer.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, - "MODIFY_VSP_OWNER": { - "verb": "PUT", - "description": "Changes the owner of a VSP", - "uri": partial( - "{endpoint}{service_path}/{software_product_id}/permissions/Owner".format, - endpoint=sdc_properties.SDC_BE_ONBOARD_ENDPOINT, - service_path=sdc_properties.SDC_VENDOR_ITEMS_PATH, - ), - "uri-parameters": ["software_product_id"], - "payload": "{}/add_vsp_contributer.jinja".format(PAYLOADS_DIR), - "payload-parameters": ["user_id"], - "success_code": 200, - "headers": { - "Accept": "application/json", - "Content-Type": "application/json", - "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID, - "X-TransactionId": str(uuid.uuid4()), - "X-FromAppId": application_id, - }, - "auth": ( - sdc_properties.GLOBAL_SDC_USERNAME, - sdc_properties.GLOBAL_SDC_PASSWORD, - ), - }, -} + @property + def catalog_resources(self): + return { + "ADD_SOFTWARE_PRODUCT": { + "verb": "POST", + "description": "Creates a VSP in the SDC catalog", + "uri": partial( + "{endpoint}{service_path}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "payload": "{}/software_product.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "software_product_name", + "feature_group_id", + "license_agreement_id", + "vendor_name", + "license_model_id", + "license_model_version_id", + "description", + "category", + "sub_category", + ], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + "X-TransactionId": str(uuid.uuid4()), + "X-FromAppId": application_id, + }, + "return_data": { + "software_product_id": ("itemId",), + "software_product_version_id": ("version", "id"), + }, + "auth": ( + self.config.sdc.GLOBAL_SDC_USERNAME, + self.config.sdc.GLOBAL_SDC_PASSWORD, + ), + }, + "UPDATE_SOFTWARE_PRODUCT": { + "verb": "POST", + "description": "Updates a VSP to a new version", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "payload": "{}/software_product_update.jinja".format(PAYLOADS_DIR), + "payload-parameters": [ + "description", + ], + "uri-parameters": ["software_product_id", "software_product_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "UPLOAD_HEAT_PACKAGE": { + "verb": "POST", + "description": "Uploads a heat zip to a VSP", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/orchestration-template-candidate".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "files-parameters": ["file_path", "file_type"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "multipart/form-data", + "USER_ID": self.config.sdc.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, + ), + }, + "VALIDATE_SOFTWARE_PRODUCT": { + "verb": "PUT", + "description": "Validates VSP with Heat Zip", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/orchestration-template-candidate/process".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "SUBMIT_SOFTWARE_PRODUCT": { + "verb": "PUT", + "description": "Submits Heat Zip to VSP", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/actions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "payload": "{}/action.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["action"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "PACKAGE_SOFTWARE_PRODUCT": { + "verb": "PUT", + "description": "Packages VSP (description needs to be better??)", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/actions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "payload": "{}/action.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["action"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SOFTWARE_PRODUCT": { + "verb": "GET", + "description": "Gets VSP from Catalog", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SOFTWARE_PRODUCT_INFORMATION": { + "verb": "GET", + "description": "Gets Information for a VSP from Catalog", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions/{software_product_version_id}/questionnaire".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_SOFTWARE_PRODUCT_PATH, + ), + "uri-parameters": ["software_product_id", "software_product_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_SOFTWARE_PRODUCT_VERSIONS": { + "verb": "GET", + "description": "Returns a list of vsp versions", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/versions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "uri-parameters": ["software_product_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID, + "X-TransactionId": str(uuid.uuid4()), + "X-FromAppId": application_id, + }, + "return_data": { + "software_product_version_id": ("id",), + "description": ("description",), + }, + "auth": ( + self.config.sdc.GLOBAL_SDC_USERNAME, + self.config.sdc.GLOBAL_SDC_PASSWORD, + ), + }, + "GET_SOFTWARE_PRODUCTS": { + "verb": "GET", + "description": "Returns a list of vsps", + "uri": partial( + "{endpoint}{service_path}?&itemType=vsp".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "GET_VSP_PERMISSIONS": { + "verb": "GET", + "description": "Returns the permissions for a VSP.", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/permissions".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "uri-parameters": ["software_product_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "ADD_VSP_CONTRIBUTER": { + "verb": "PUT", + "description": "Adds a user to a VSP as a contributer", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/permissions/Contributor".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "uri-parameters": ["software_product_id"], + "payload": "{}/add_vsp_contributer.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + "MODIFY_VSP_OWNER": { + "verb": "PUT", + "description": "Changes the owner of a VSP", + "uri": partial( + "{endpoint}{service_path}/{software_product_id}/permissions/Owner".format, + endpoint=self.config.sdc.SDC_BE_ONBOARD_ENDPOINT, + service_path=self.config.sdc.SDC_VENDOR_ITEMS_PATH, + ), + "uri-parameters": ["software_product_id"], + "payload": "{}/add_vsp_contributer.jinja".format(PAYLOADS_DIR), + "payload-parameters": ["user_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.config.sdc.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, + ), + }, + } |