diff options
author | stark, steven <steven.stark@att.com> | 2020-04-07 08:36:44 -0700 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2020-04-07 08:36:44 -0700 |
commit | 298508191ae545ecf6eb2b7a56fd1d0828f20f0e (patch) | |
tree | 9685dc85589fa2a395fc03f733299e63a3b77fd6 /onap-client/onap_client/sdc/catalog | |
parent | 07c28e0a81383f76f5d563f265db27519d4922f1 (diff) |
[VVP] Adding support for update to onap-client
Issue-ID: VVP-399
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: I3f7d1694fd23295a274c0c0e3801a33ab23dce7f
Diffstat (limited to 'onap-client/onap_client/sdc/catalog')
-rw-r--r-- | onap-client/onap_client/sdc/catalog/service_catalog.py | 52 | ||||
-rw-r--r-- | onap-client/onap_client/sdc/catalog/vnf_catalog.py | 133 | ||||
-rw-r--r-- | onap-client/onap_client/sdc/catalog/vsp_catalog.py | 26 |
3 files changed, 210 insertions, 1 deletions
diff --git a/onap-client/onap_client/sdc/catalog/service_catalog.py b/onap-client/onap_client/sdc/catalog/service_catalog.py index 1d30725..eff2784 100644 --- a/onap-client/onap_client/sdc/catalog/service_catalog.py +++ b/onap-client/onap_client/sdc/catalog/service_catalog.py @@ -98,6 +98,29 @@ CATALOG_RESOURCES = { 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", @@ -130,6 +153,32 @@ CATALOG_RESOURCES = { 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", @@ -261,11 +310,12 @@ CATALOG_RESOURCES = { ), "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-TransactionId": str(uuid.uuid4()), "X-FromAppId": application_id, }, "auth": ( diff --git a/onap-client/onap_client/sdc/catalog/vnf_catalog.py b/onap-client/onap_client/sdc/catalog/vnf_catalog.py index c4fd3da..cd08dad 100644 --- a/onap-client/onap_client/sdc/catalog/vnf_catalog.py +++ b/onap-client/onap_client/sdc/catalog/vnf_catalog.py @@ -142,6 +142,52 @@ CATALOG_RESOURCES = { 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", @@ -174,6 +220,38 @@ CATALOG_RESOURCES = { 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", @@ -362,6 +440,39 @@ CATALOG_RESOURCES = { 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", @@ -385,6 +496,28 @@ CATALOG_RESOURCES = { 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", diff --git a/onap-client/onap_client/sdc/catalog/vsp_catalog.py b/onap-client/onap_client/sdc/catalog/vsp_catalog.py index 65781a6..574149e 100644 --- a/onap-client/onap_client/sdc/catalog/vsp_catalog.py +++ b/onap-client/onap_client/sdc/catalog/vsp_catalog.py @@ -95,6 +95,32 @@ CATALOG_RESOURCES = { 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", |