From 7530353e6ad1839f74af4c361b5215d68d78e0c7 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Mon, 3 May 2021 15:23:46 -0700 Subject: [VVP] vsp creates for first time user If the user has never used the SDC dashboard, the request to retrieve LM details fails. Issue-ID: VVP-535 Signed-off-by: stark, steven Change-Id: I55d0c02e6de4c5fdd1a0f5cc20d9c2cd706f855b --- .../onap_client/sdc/catalog/license_model_catalog.py | 18 ++++++++++++++++++ onap-client/onap_client/sdc/catalog/service_catalog.py | 18 ++++++++++++++++++ onap-client/onap_client/sdc/tests/test_vsp.py | 4 ++++ onap-client/onap_client/sdc/vsp.py | 6 ++++++ onap-client/setup.py | 2 +- 5 files changed, 47 insertions(+), 1 deletion(-) 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 484598c..25e7c6b 100644 --- a/onap-client/onap_client/sdc/catalog/license_model_catalog.py +++ b/onap-client/onap_client/sdc/catalog/license_model_catalog.py @@ -228,6 +228,24 @@ class LicenseModelClient(SDCClient): }, "auth": self.auth, }, + "GET_LICENSE_MODEL_VERSION": { + "verb": "GET", + "description": "Returns the version list for 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_ITEMS_PATH, + ), + "uri-parameters": ["license_model_id", "license_model_version_id"], + "success_code": 200, + "headers": { + "Accept": "application/json", + "Content-Type": "application/json", + "USER_ID": self.sdc_designer_user_id, + "X-FromAppId": self.config.application_id, + }, + "auth": self.auth, + }, "GET_LICENSE_MODEL_VERSIONS": { "verb": "GET", "description": "Returns the version list for a license model", diff --git a/onap-client/onap_client/sdc/catalog/service_catalog.py b/onap-client/onap_client/sdc/catalog/service_catalog.py index 32749ff..c49b40a 100644 --- a/onap-client/onap_client/sdc/catalog/service_catalog.py +++ b/onap-client/onap_client/sdc/catalog/service_catalog.py @@ -130,6 +130,24 @@ class ServiceCatalog(SDCClient): "return_data": {"catalog_resource_instance_id": ("uniqueId",)}, "auth": self.auth, }, + "UNDO_CHECKOUT": { + "verb": "POST", + "description": "Undo a checked-out service in SDC.", + "uri": partial( + "{endpoint}{service_path}/{catalog_service_id}/lifecycleState/UNDOCHECKOUT".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.sdc_designer_user_id, + "X-FromAppId": self.config.application_id, + }, + "auth": self.auth, + }, "DELETE_RESOURCE_FROM_SERVICE": { "verb": "DELETE", "description": "Deletes a resource from a service.", diff --git a/onap-client/onap_client/sdc/tests/test_vsp.py b/onap-client/onap_client/sdc/tests/test_vsp.py index cd35a90..f401b22 100644 --- a/onap-client/onap_client/sdc/tests/test_vsp.py +++ b/onap-client/onap_client/sdc/tests/test_vsp.py @@ -63,6 +63,10 @@ def test_vsp_create(): "results": [{"name": LICENSE_MODEL_NAME, "id": LICENSE_MODEL_ID}] }, ) + mockup_catalog_item( + oc.sdc.license_model.catalog_items["GET_LICENSE_MODEL_VERSION"], + override_uri_params={"license_model_id": LICENSE_MODEL_ID, "license_model_version_id": LICENSE_MODEL_VERSION_ID}, + ) mockup_catalog_item( oc.sdc.license_model.catalog_items["GET_LICENSE_MODEL_VERSIONS"], override_return_data={ diff --git a/onap-client/onap_client/sdc/vsp.py b/onap-client/onap_client/sdc/vsp.py index fca674b..44363d8 100644 --- a/onap-client/onap_client/sdc/vsp.py +++ b/onap-client/onap_client/sdc/vsp.py @@ -183,6 +183,12 @@ def create_vsp(vsp_input, oc=None): oc=oc ) + # Workaround for first time users to avoid ENTITY_NOT_FOUND error + oc.sdc.license_model.get_license_model_version( + license_model_id=license_model_id, + license_model_version_id=license_model_version_id, + ) + feature_group = sdc.license_model.get_license_model_attribute( license_model_id, license_model_version_id, diff --git a/onap-client/setup.py b/onap-client/setup.py index 9494956..504f275 100644 --- a/onap-client/setup.py +++ b/onap-client/setup.py @@ -43,7 +43,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="onap-client", - version="1.5.1", + version="1.5.2", author="Steven Stark", author_email="steven.stark@att.com", description="Python API wrapper for ONAP applications", -- cgit 1.2.3-korg