aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/sdc/catalog
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-03-11 14:30:58 -0700
committerstark, steven <steven.stark@att.com>2020-03-12 14:41:09 -0700
commitc02d3ed39e53d4ce56406a43089fc4a336c43f17 (patch)
tree8354fe71b2b4d379f36042b76c0e29775692f03e /onap-client/onap_client/sdc/catalog
parentd7d8722ce27e308defb6764d8d76f85ce7d63927 (diff)
[VVP] Adding onap-client intial commit.
This is supplementary tooling to interact with various ONAP applications. It will be used by the OVP VNF Testcase, it's not deployed with the ONAP platform. Issue-ID: VVP-381 Change-Id: I2ff3952ba8f4b9448acb5a24717ccc3b1f0a92fe Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'onap-client/onap_client/sdc/catalog')
-rw-r--r--onap-client/onap_client/sdc/catalog/__init__.py37
-rw-r--r--onap-client/onap_client/sdc/catalog/license_model_catalog.py318
-rw-r--r--onap-client/onap_client/sdc/catalog/service_catalog.py426
-rw-r--r--onap-client/onap_client/sdc/catalog/vnf_catalog.py410
-rw-r--r--onap-client/onap_client/sdc/catalog/vsp_catalog.py286
5 files changed, 1477 insertions, 0 deletions
diff --git a/onap-client/onap_client/sdc/catalog/__init__.py b/onap-client/onap_client/sdc/catalog/__init__.py
new file mode 100644
index 0000000..d35e96a
--- /dev/null
+++ b/onap-client/onap_client/sdc/catalog/__init__.py
@@ -0,0 +1,37 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2020 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
diff --git a/onap-client/onap_client/sdc/catalog/license_model_catalog.py b/onap-client/onap_client/sdc/catalog/license_model_catalog.py
new file mode 100644
index 0000000..278645d
--- /dev/null
+++ b/onap-client/onap_client/sdc/catalog/license_model_catalog.py
@@ -0,0 +1,318 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2020 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+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,
+ ),
+ },
+}
diff --git a/onap-client/onap_client/sdc/catalog/service_catalog.py b/onap-client/onap_client/sdc/catalog/service_catalog.py
new file mode 100644
index 0000000..1d30725
--- /dev/null
+++ b/onap-client/onap_client/sdc/catalog/service_catalog.py
@@ -0,0 +1,426 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2020 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+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,
+ ),
+ },
+ "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,
+ ),
+ },
+ "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,
+ "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,
+ ),
+ },
+}
diff --git a/onap-client/onap_client/sdc/catalog/vnf_catalog.py b/onap-client/onap_client/sdc/catalog/vnf_catalog.py
new file mode 100644
index 0000000..c4fd3da
--- /dev/null
+++ b/onap-client/onap_client/sdc/catalog/vnf_catalog.py
@@ -0,0 +1,410 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2020 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+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",
+ ],
+ "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,
+ ),
+ },
+ "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_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,
+ ),
+ },
+ "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_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,
+ ),
+ },
+}
diff --git a/onap-client/onap_client/sdc/catalog/vsp_catalog.py b/onap-client/onap_client/sdc/catalog/vsp_catalog.py
new file mode 100644
index 0000000..65781a6
--- /dev/null
+++ b/onap-client/onap_client/sdc/catalog/vsp_catalog.py
@@ -0,0 +1,286 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2020 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the "License");
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ============LICENSE_END============================================
+
+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,
+ ),
+ },
+ "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_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,
+ ),
+ },
+ "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,
+ ),
+ },
+}