aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
committerstark, steven <steven.stark@att.com>2020-08-03 13:03:24 -0700
commit32409110b65b013bc65930f3cfdef09671cd3a5a (patch)
tree4bb6c95c057cdde0f08af78e7abc53e2be02fad4
parent9df81b14e7203d6c3911f5f36881cb5170afdccc (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
-rw-r--r--onap-client/onap_client/aai/__init__.py4
-rw-r--r--onap-client/onap_client/aai/catalog/business_catalog.py440
-rw-r--r--onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py155
-rw-r--r--onap-client/onap_client/aai/client.py43
-rw-r--r--onap-client/onap_client/client/clients.py34
-rw-r--r--onap-client/onap_client/client/request.py4
-rw-r--r--onap-client/onap_client/client/response.py3
-rw-r--r--onap-client/onap_client/config.py15
-rw-r--r--onap-client/onap_client/engine.py46
-rw-r--r--onap-client/onap_client/resource.py5
-rw-r--r--onap-client/onap_client/sdc/__init__.py4
-rw-r--r--onap-client/onap_client/sdc/catalog/license_model_catalog.py527
-rw-r--r--onap-client/onap_client/sdc/catalog/service_catalog.py931
-rw-r--r--onap-client/onap_client/sdc/catalog/vnf_catalog.py983
-rw-r--r--onap-client/onap_client/sdc/catalog/vsp_catalog.py653
-rw-r--r--onap-client/onap_client/sdc/client.py89
-rw-r--r--onap-client/onap_client/sdc/license_model.py5
-rw-r--r--onap-client/onap_client/sdc/service.py14
-rw-r--r--onap-client/onap_client/sdc/vnf.py12
-rw-r--r--onap-client/onap_client/sdc/vsp.py5
-rw-r--r--onap-client/onap_client/sdnc/__init__.py4
-rw-r--r--onap-client/onap_client/sdnc/catalog/config_catalog.py119
-rw-r--r--onap-client/onap_client/sdnc/catalog/operations_catalog.py85
-rw-r--r--onap-client/onap_client/sdnc/client.py2
-rw-r--r--onap-client/onap_client/sdnc/preload.py3
-rw-r--r--onap-client/onap_client/so/__init__.py4
-rw-r--r--onap-client/onap_client/so/catalog/service_instantiation.py523
-rw-r--r--onap-client/onap_client/so/client.py31
-rw-r--r--onap-client/onap_client/so/module_instance.py2
-rw-r--r--onap-client/onap_client/so/service_instance.py5
-rw-r--r--onap-client/onap_client/so/vnf_instance.py23
-rw-r--r--onap-client/onap_client/tests/test_engine.py2
-rw-r--r--onap-client/onap_client/vid/__init__.py4
-rw-r--r--onap-client/onap_client/vid/catalog/maintenance_catalog.py199
-rw-r--r--onap-client/onap_client/vid/client.py31
-rw-r--r--onap-client/setup.py10
36 files changed, 2505 insertions, 2514 deletions
diff --git a/onap-client/onap_client/aai/__init__.py b/onap-client/onap_client/aai/__init__.py
index a67037c..5519a84 100644
--- a/onap-client/onap_client/aai/__init__.py
+++ b/onap-client/onap_client/aai/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-AAI_PROPERTIES = APP_CONFIG.aai
diff --git a/onap-client/onap_client/aai/catalog/business_catalog.py b/onap-client/onap_client/aai/catalog/business_catalog.py
index 2b9af21..283521c 100644
--- a/onap-client/onap_client/aai/catalog/business_catalog.py
+++ b/onap-client/onap_client/aai/catalog/business_catalog.py
@@ -34,241 +34,235 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
import uuid
from functools import partial
-from onap_client import aai
from onap_client import config
from onap_client.aai.client import AAIClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-aai_properties = aai.AAI_PROPERTIES
application_id = config.APPLICATION_ID
class BusinessClient(AAIClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "business"
-
-CATALOG_RESOURCES = {
- "GET_OWNING_ENTITY": {
- "verb": "GET",
- "description": "Queries AAI for an owning entity",
- "uri": partial(
- "{endpoint}{service_path}/owning-entities?owning-entity-name={name}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_OWNING_ENTITIES": {
- "verb": "GET",
- "description": "Queries AAI for all owning entities",
- "uri": partial(
- "{endpoint}{service_path}/owning-entities".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_CUSTOMER": {
- "verb": "GET",
- "description": "Queries AAI for a customer",
- "uri": partial(
- "{endpoint}{service_path}/customers?global-customer-id={name}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_CUSTOMERS": {
- "verb": "GET",
- "description": "Queries AAI for all customers",
- "uri": partial(
- "{endpoint}{service_path}/customers".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_PLATFORM": {
- "verb": "GET",
- "description": "Queries AAI for a platform",
- "uri": partial(
- "{endpoint}{service_path}/platforms?platform-name={name}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_PLATFORMS": {
- "verb": "GET",
- "description": "Queries AAI for all platforms",
- "uri": partial(
- "{endpoint}{service_path}/platforms".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_PROJECT": {
- "verb": "GET",
- "description": "Queries AAI for a project",
- "uri": partial(
- "{endpoint}{service_path}/projects/project/{name}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_PROJECTS": {
- "verb": "GET",
- "description": "Queries AAI for all projects",
- "uri": partial(
- "{endpoint}{service_path}/projects".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_LINES_OF_BUSINESS": {
- "verb": "GET",
- "description": "Queries AAI for all lobs",
- "uri": partial(
- "{endpoint}{service_path}/lines-of-business".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "CREATE_CUSTOMER": {
- "verb": "PUT",
- "description": "Creates a customer in AAI",
- "uri": partial(
- "{endpoint}{service_path}/customers/customer/{customer_name}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["customer_name"],
- "payload-parameters": ["customer_name", "subscriber_name"],
- "payload": "{}/aai_create_customer.jinja".format(PAYLOADS_DIR),
- "success_code": 201,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_CUSTOMER_SUBSCRIPTIONS": {
- "verb": "GET",
- "description": "Queries AAI the subscriptions for a customer",
- "uri": partial(
- "{endpoint}{service_path}/customers/customer/{customer_name}/service-subscriptions".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["customer_name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_SERVICE_INSTANCES": {
- "verb": "GET",
- "description": "Queries AAI the service instances for a customer subscription",
- "uri": partial(
- "{endpoint}{service_path}/customers/customer/{customer_name}/service-subscriptions/service-subscription/{subscription_name}/service-instances".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_BUSINESS_PATH,
- ),
- "uri-parameters": ["customer_name", "subscription_name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GET_OWNING_ENTITY": {
+ "verb": "GET",
+ "description": "Queries AAI for an owning entity",
+ "uri": partial(
+ "{endpoint}{service_path}/owning-entities?owning-entity-name={name}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_OWNING_ENTITIES": {
+ "verb": "GET",
+ "description": "Queries AAI for all owning entities",
+ "uri": partial(
+ "{endpoint}{service_path}/owning-entities".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_CUSTOMER": {
+ "verb": "GET",
+ "description": "Queries AAI for a customer",
+ "uri": partial(
+ "{endpoint}{service_path}/customers?global-customer-id={name}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_CUSTOMERS": {
+ "verb": "GET",
+ "description": "Queries AAI for all customers",
+ "uri": partial(
+ "{endpoint}{service_path}/customers".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_PLATFORM": {
+ "verb": "GET",
+ "description": "Queries AAI for a platform",
+ "uri": partial(
+ "{endpoint}{service_path}/platforms?platform-name={name}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_PLATFORMS": {
+ "verb": "GET",
+ "description": "Queries AAI for all platforms",
+ "uri": partial(
+ "{endpoint}{service_path}/platforms".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_PROJECT": {
+ "verb": "GET",
+ "description": "Queries AAI for a project",
+ "uri": partial(
+ "{endpoint}{service_path}/projects/project/{name}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_PROJECTS": {
+ "verb": "GET",
+ "description": "Queries AAI for all projects",
+ "uri": partial(
+ "{endpoint}{service_path}/projects".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_LINES_OF_BUSINESS": {
+ "verb": "GET",
+ "description": "Queries AAI for all lobs",
+ "uri": partial(
+ "{endpoint}{service_path}/lines-of-business".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "CREATE_CUSTOMER": {
+ "verb": "PUT",
+ "description": "Creates a customer in AAI",
+ "uri": partial(
+ "{endpoint}{service_path}/customers/customer/{customer_name}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["customer_name"],
+ "payload-parameters": ["customer_name", "subscriber_name"],
+ "payload": "{}/aai_create_customer.jinja".format(PAYLOADS_DIR),
+ "success_code": 201,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_CUSTOMER_SUBSCRIPTIONS": {
+ "verb": "GET",
+ "description": "Queries AAI the subscriptions for a customer",
+ "uri": partial(
+ "{endpoint}{service_path}/customers/customer/{customer_name}/service-subscriptions".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["customer_name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_SERVICE_INSTANCES": {
+ "verb": "GET",
+ "description": "Queries AAI the service instances for a customer subscription",
+ "uri": partial(
+ "{endpoint}{service_path}/customers/customer/{customer_name}/service-subscriptions/service-subscription/{subscription_name}/service-instances".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_BUSINESS_PATH,
+ ),
+ "uri-parameters": ["customer_name", "subscription_name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py b/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py
index b2570a0..4ebe34a 100644
--- a/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py
+++ b/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py
@@ -38,95 +38,90 @@
import uuid
from functools import partial
-from onap_client import aai
from onap_client import config
from onap_client.aai.client import AAIClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-aai_properties = aai.AAI_PROPERTIES
application_id = config.APPLICATION_ID
class CloudInfrastructureClient(AAIClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "cloud_infrastructure"
-
-CATALOG_RESOURCES = {
- "GET_CLOUD_REGIONS": {
- "verb": "GET",
- "description": "Queries AAI for all cloud regions",
- "uri": partial(
- "{endpoint}{service_path}/cloud-regions".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_CLOUD_INFRASTRUCTURE_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_CLOUD_REGION": {
- "verb": "GET",
- "description": "Queries AAI for a cloud region",
- "uri": partial(
- "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_CLOUD_INFRASTRUCTURE_PATH,
- ),
- "uri-parameters": ["cloud_region", "cloud_owner"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_CLOUD_REGION_TENANTS": {
- "verb": "GET",
- "description": "Queries AAI for a cloud region's tenants",
- "uri": partial(
- "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}/tenants".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_CLOUD_INFRASTRUCTURE_PATH,
- ),
- "uri-parameters": ["cloud_region", "cloud_owner"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
- "GET_ESR_LIST": {
- "verb": "GET",
- "description": "Queries AAI for a esr info",
- "uri": partial(
- "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}/esr-system-info-list".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_CLOUD_INFRASTRUCTURE_PATH,
- ),
- "uri-parameters": ["cloud_region", "cloud_owner"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GET_CLOUD_REGIONS": {
+ "verb": "GET",
+ "description": "Queries AAI for all cloud regions",
+ "uri": partial(
+ "{endpoint}{service_path}/cloud-regions".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_CLOUD_INFRASTRUCTURE_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_CLOUD_REGION": {
+ "verb": "GET",
+ "description": "Queries AAI for a cloud region",
+ "uri": partial(
+ "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_CLOUD_INFRASTRUCTURE_PATH,
+ ),
+ "uri-parameters": ["cloud_region", "cloud_owner"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_CLOUD_REGION_TENANTS": {
+ "verb": "GET",
+ "description": "Queries AAI for a cloud region's tenants",
+ "uri": partial(
+ "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}/tenants".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_CLOUD_INFRASTRUCTURE_PATH,
+ ),
+ "uri-parameters": ["cloud_region", "cloud_owner"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ "GET_ESR_LIST": {
+ "verb": "GET",
+ "description": "Queries AAI for a esr info",
+ "uri": partial(
+ "{endpoint}{service_path}/cloud-regions/cloud-region/{cloud_owner}/{cloud_region}/esr-system-info-list".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_CLOUD_INFRASTRUCTURE_PATH,
+ ),
+ "uri-parameters": ["cloud_region", "cloud_owner"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/aai/client.py b/onap-client/onap_client/aai/client.py
index 5a2ddb1..5820fdd 100644
--- a/onap-client/onap_client/aai/client.py
+++ b/onap-client/onap_client/aai/client.py
@@ -38,11 +38,9 @@
import uuid
from functools import partial
-from onap_client import aai
from onap_client.client.clients import Client
from onap_client import config
-aai_properties = aai.AAI_PROPERTIES
application_id = config.APPLICATION_ID
@@ -53,25 +51,22 @@ class AAIClient(Client):
@property
def catalog_resources(self):
- return CATALOG_RESOURCES
-
-
-CATALOG_RESOURCES = {
- "HEALTH_CHECK": {
- "verb": "GET",
- "description": "Queries AAI health check endpoint",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=aai_properties.AAI_BE_ENDPOINT,
- service_path=aai_properties.AAI_HEALTH_CHECK_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (aai_properties.AAI_USERNAME, aai_properties.AAI_PASSWORD,),
- },
-}
+ return {
+ "HEALTH_CHECK": {
+ "verb": "GET",
+ "description": "Queries AAI health check endpoint",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.aai.AAI_BE_ENDPOINT,
+ service_path=self.config.aai.AAI_HEALTH_CHECK_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/client/clients.py b/onap-client/onap_client/client/clients.py
index 9b7a0c6..f0a0c1d 100644
--- a/onap-client/onap_client/client/clients.py
+++ b/onap-client/onap_client/client/clients.py
@@ -39,18 +39,36 @@ import importlib
import onap_client
import pkgutil
import inspect
+import sys
+import logging
from onap_client.client.catalog import Catalog
+from onap_client import config
+
+CACHED_CLIENT = None
+
+
+def get_client(config_file=None):
+ clients = sys.modules[__name__]
+ if not clients.CACHED_CLIENT or config_file:
+ clients.CACHED_CLIENT = Client(config_file)
+ return clients.CACHED_CLIENT
class Client(Catalog):
"""Base class for the ONAP client. Subclasses are dynamically
loaded and added as attributes. Instantiate and use this class
to interact with ONAP."""
- def __init__(self):
+ def __init__(self, config_file=None):
+ self.config = config.APP_CONFIG
self.modules = import_submodules(onap_client)
+
super().__init__()
+ if config_file:
+ config.LOG.info("Overriding ONAP Client configuration: {}".format(config_file))
+ self.set_config(config_file)
+
@property
def namespace(self):
return "onap"
@@ -70,6 +88,20 @@ class Client(Catalog):
utility_functions[func[0]] = func[1]
return utility_functions
+ def set_config(self, config_file):
+ self.config = config.load_config(config_file, "onap_client")
+ self._set_logging(self.config.LOG_LEVEL)
+ for attr_name, attr in self.__dict__.items():
+ if isinstance(attr, Client):
+ config.LOG.info("Reloading {} {}".format(attr_name, attr))
+ attr.set_config(config_file)
+ for k, v in attr.catalog_resources.items():
+ attr.load(k, v)
+
+ def _set_logging(self, level):
+ LOG = logging.getLogger("ONAP_CLIENT")
+ LOG.setLevel(getattr(logging, level.upper()))
+
def import_submodules(package, recursive=True):
"""Import all the modules in onap-client, except for those starting
diff --git a/onap-client/onap_client/client/request.py b/onap-client/onap_client/client/request.py
index 0e1ce5c..194dad5 100644
--- a/onap-client/onap_client/client/request.py
+++ b/onap-client/onap_client/client/request.py
@@ -40,12 +40,14 @@ import requests
import json
import os
import copy
+import logging
from onap_client.client.response import ResponseHandler
-from onap_client.config import LOG as logger
from onap_client.exceptions import FilesRequestFailure
from jinja2 import exceptions as jinja_exceptions
+logger = logging.getLogger("ONAP_CLIENT")
+
class RequestHandler:
"""Handles a APICatalogRequestObject to make a request
diff --git a/onap-client/onap_client/client/response.py b/onap-client/onap_client/client/response.py
index ef0aab5..9693af5 100644
--- a/onap-client/onap_client/client/response.py
+++ b/onap-client/onap_client/client/response.py
@@ -36,8 +36,9 @@
# ============LICENSE_END============================================
import simplejson
+import logging
-from onap_client.config import LOG as logger
+logger = logging.getLogger("ONAP_CLIENT")
class ResponseHandler:
diff --git a/onap-client/onap_client/config.py b/onap-client/onap_client/config.py
index ffe493f..2436619 100644
--- a/onap-client/onap_client/config.py
+++ b/onap-client/onap_client/config.py
@@ -36,7 +36,7 @@
# ============LICENSE_END============================================
import distutils.sysconfig
-import logging as logger
+import logging
import os
import yaml
@@ -70,7 +70,7 @@ class Config:
with open(self.config_file, "r") as f:
config_data = yaml.safe_load(f)
except FileNotFoundError:
- logger.warn(
+ logging.warn(
"Config file {} not found, using default.".format(self.config_file)
)
@@ -96,6 +96,11 @@ APPLICATION_ID = "robot-ete"
CONFIG_ENV = os.environ.get("OC_CONFIG")
CONFIG_FILE = CONFIG_ENV or "/etc/onap_client/config.yaml"
APP_CONFIG = load_config(CONFIG_FILE, "onap_client")
-LOG = logger
-log_level = getattr(LOG, APP_CONFIG.LOG_LEVEL.upper())
-LOG.basicConfig(format="%(asctime)s %(message)s", level=log_level)
+LOG = logging.getLogger("ONAP_CLIENT")
+LOG.propagate = False
+log_level = getattr(logging, APP_CONFIG.LOG_LEVEL.upper())
+ch = logging.StreamHandler()
+LOG.setLevel(log_level)
+formatter = logging.Formatter('%(levelname)s %(asctime)s %(name)s %(message)s')
+ch.setFormatter(formatter)
+LOG.addHandler(ch)
diff --git a/onap-client/onap_client/engine.py b/onap-client/onap_client/engine.py
index a352163..daac47d 100644
--- a/onap-client/onap_client/engine.py
+++ b/onap-client/onap_client/engine.py
@@ -37,11 +37,14 @@
import argparse
import json
+import logging
from onap_client.resource import Resource
-from onap_client.config import LOG as logger
from onap_client.client.clients import import_submodules
from onap_client.exceptions import InvalidSpecException, ResourceTypeNotFoundException
+from onap_client.client.clients import get_client
+
+logger = logging.getLogger("ONAP_CLIENT")
def dumper(obj):
@@ -70,7 +73,7 @@ def show_resource_spec(resource_name):
list_spec_resources()
-def load_spec(input_spec, validate_only=False, submit=True):
+def load_spec(input_spec, validate_only=False, submit=True, suppress_out=False, config=None):
try:
with open(input_spec, "r") as f:
jdata = json.loads(f.read())
@@ -79,7 +82,7 @@ def load_spec(input_spec, validate_only=False, submit=True):
raise
engine = SpecEngine()
- return engine.load_spec(jdata, validate_only=validate_only, distribute=submit)
+ return engine.load_spec(jdata, validate_only=validate_only, distribute=submit, suppress_out=suppress_out, config=config)
def spec_cli(args):
@@ -102,10 +105,18 @@ def spec_cli(args):
)
parser.add_argument(
+ "--oc-config", required=False, help="Path to configuration file for ONAP Client."
+ )
+
+ parser.add_argument(
"--no-submit", action="store_false", required=False, default=True, help="Dont execute submit() for each resource in spec."
)
parser.add_argument(
+ "--no-outputs", action="store_true", required=False, default=False, help="Don't return the full output from each created resource."
+ )
+
+ parser.add_argument(
"--list-spec-resources",
action="store_true",
required=False,
@@ -119,9 +130,9 @@ def spec_cli(args):
elif arguments.show_resource_spec:
show_resource_spec(arguments.show_resource_spec)
elif arguments.validate_spec:
- print(json.dumps(load_spec(arguments.validate_spec, validate_only=True), indent=4))
+ print(json.dumps(load_spec(arguments.validate_spec, validate_only=True, suppress_out=arguments.no_outputs), indent=4))
elif arguments.load_spec:
- load_spec(arguments.load_spec, submit=arguments.no_submit)
+ print(json.dumps(load_spec(arguments.load_spec, submit=arguments.no_submit, suppress_out=arguments.no_outputs, config=arguments.oc_config), indent=4))
class SpecEngine:
@@ -132,15 +143,23 @@ class SpecEngine:
def initialize(self):
import_submodules("onap_client")
- def load_spec(self, spec, distribute=True, validate_only=False):
+ def load_spec(self, spec, distribute=True, validate_only=False, suppress_out=False, config=None):
# print("loading spec {}".format(spec))
+
+ if config:
+ oc = get_client(config) # noqa: F841
+
self.spec = resolve_spec(spec)
self.validate(self.spec.get("spec", {}))
+ logger.info("Loading spec into spec engine:")
+ logger.info(json.dumps(self.spec, indent=4))
+
+ out = self.spec
if not validate_only:
- self._create(self.spec.get("spec", {}), distribute)
+ out = self._create(self.spec.get("spec", {}), distribute, suppress_out)
- return self.spec
+ return out
def validate(self, spec):
if not isinstance(spec, list):
@@ -174,7 +193,7 @@ class SpecEngine:
)
subclass.validate(resource_spec)
- def _create(self, spec, distribute):
+ def _create(self, spec, distribute, suppress_out):
full_engine_spec = []
for item_spec in spec:
resource_type = item_spec.get("type")
@@ -186,10 +205,13 @@ class SpecEngine:
)
full_spec = subclass.validate(resource_spec)
logger.debug(json.dumps(full_spec, indent=4))
- subclass.create_from_spec(full_spec, submit=distribute)
- full_engine_spec.append({"type": resource_type, "resource_spec": full_spec})
+ t = subclass.create_from_spec(full_spec, submit=distribute)
+ finished_spec = {"type": resource_type, "resource_spec": full_spec}
+ if not suppress_out:
+ finished_spec["output"] = t._output()
+ full_engine_spec.append(finished_spec)
- logger.info(json.dumps(full_engine_spec, indent=4))
+ return full_engine_spec
def resolve_spec(spec_dict):
diff --git a/onap-client/onap_client/resource.py b/onap-client/onap_client/resource.py
index ca5d675..cd7c677 100644
--- a/onap-client/onap_client/resource.py
+++ b/onap-client/onap_client/resource.py
@@ -36,7 +36,7 @@
# ============LICENSE_END============================================
from abc import ABC
from onap_client.exceptions import InvalidSpecException, ResourceAlreadyExistsException, ResourceCreationFailure
-from onap_client.client.clients import Client
+from onap_client.client.clients import get_client as Client
class Resource(ABC):
@@ -68,6 +68,9 @@ class Resource(ABC):
def _on_failure(self):
pass
+ def _output(self):
+ return None
+
@classmethod
def create_from_spec(cls, spec, submit=True):
instance = cls(**spec)
diff --git a/onap-client/onap_client/sdc/__init__.py b/onap-client/onap_client/sdc/__init__.py
index d8028f6..5519a84 100644
--- a/onap-client/onap_client/sdc/__init__.py
+++ b/onap-client/onap_client/sdc/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-SDC_PROPERTIES = APP_CONFIG.sdc
diff --git a/onap-client/onap_client/sdc/catalog/license_model_catalog.py b/onap-client/onap_client/sdc/catalog/license_model_catalog.py
index 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,
+ ),
+ },
+ }
diff --git a/onap-client/onap_client/sdc/client.py b/onap-client/onap_client/sdc/client.py
index c1923da..4089c39 100644
--- a/onap-client/onap_client/sdc/client.py
+++ b/onap-client/onap_client/sdc/client.py
@@ -38,11 +38,9 @@
import uuid
from functools import partial
-from onap_client import sdc
from onap_client.client.clients import Client
from onap_client import config
-sdc_properties = sdc.SDC_PROPERTIES
application_id = config.APPLICATION_ID
@@ -53,48 +51,45 @@ class SDCClient(Client):
@property
def catalog_resources(self):
- return CATALOG_RESOURCES
-
-
-CATALOG_RESOURCES = {
- "HEALTH_CHECK": {
- "verb": "GET",
- "description": "Queries SDC health check endpoint",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=sdc_properties.SDC_HC_ENDPOINT,
- service_path=sdc_properties.SDC_HEALTH_CHECK_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,
- },
- "auth": (
- sdc_properties.SDC_DESIGNER_USER_ID,
- sdc_properties.SDC_DESIGNER_PASSWORD,
- ),
- },
- "GET_RESOURCE_CATEGORIES": {
- "verb": "GET",
- "description": "Queries SDC for resource categories",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=sdc_properties.SDC_BE_ENDPOINT,
- service_path=sdc_properties.SDC_RESOURCE_CATEGORIES_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "USER_ID": sdc_properties.SDC_DESIGNER_USER_ID,
- },
- "auth": (
- sdc_properties.GLOBAL_SDC_USERNAME,
- sdc_properties.GLOBAL_SDC_PASSWORD,
- ),
- },
-}
+ return {
+ "HEALTH_CHECK": {
+ "verb": "GET",
+ "description": "Queries SDC health check endpoint",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.sdc.SDC_HC_ENDPOINT,
+ service_path=self.config.sdc.SDC_HEALTH_CHECK_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,
+ },
+ "auth": (
+ self.config.sdc.SDC_DESIGNER_USER_ID,
+ self.config.sdc.SDC_DESIGNER_PASSWORD,
+ ),
+ },
+ "GET_RESOURCE_CATEGORIES": {
+ "verb": "GET",
+ "description": "Queries SDC for resource categories",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.sdc.SDC_BE_ENDPOINT,
+ service_path=self.config.sdc.SDC_RESOURCE_CATEGORIES_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "USER_ID": self.config.sdc.SDC_DESIGNER_USER_ID,
+ },
+ "auth": (
+ self.config.sdc.GLOBAL_SDC_USERNAME,
+ self.config.sdc.GLOBAL_SDC_PASSWORD,
+ ),
+ },
+ }
diff --git a/onap-client/onap_client/sdc/license_model.py b/onap-client/onap_client/sdc/license_model.py
index 52846c1..1fbcea2 100644
--- a/onap-client/onap_client/sdc/license_model.py
+++ b/onap-client/onap_client/sdc/license_model.py
@@ -37,7 +37,7 @@
from onap_client.lib import generate_dummy_string, generate_dummy_date
from onap_client.resource import Resource
-from onap_client.client.clients import Client
+from onap_client.client.clients import get_client as Client
class LicenseModel(Resource):
@@ -97,6 +97,9 @@ class LicenseModel(Resource):
license_model = self.oc.sdc.license_model.get_license_model(**self.attributes)
self.attributes["tosca"] = license_model.response_data
+ def _output(self):
+ return self.tosca
+
# TODO
# Break this up into class funcs?
diff --git a/onap-client/onap_client/sdc/service.py b/onap-client/onap_client/sdc/service.py
index 8eec31a..5f2f918 100644
--- a/onap-client/onap_client/sdc/service.py
+++ b/onap-client/onap_client/sdc/service.py
@@ -38,9 +38,8 @@
from onap_client.lib import generate_dummy_string
from onap_client.resource import Resource
from onap_client import exceptions
-from onap_client.client.clients import Client
+from onap_client.client.clients import get_client as Client
from onap_client.sdc.vnf import get_vnf_id
-from onap_client.sdc import SDC_PROPERTIES
from onap_client.util import utility
import base64
@@ -160,7 +159,9 @@ class Service(Resource):
def _submit(self):
"""Submits the service in SDC and distributes the model"""
- DISTRIBUTION_STEPS = SDC_PROPERTIES.SERVICE_DISTRIBUTION or []
+ oc = Client()
+
+ DISTRIBUTION_STEPS = oc.config.sdc.SERVICE_DISTRIBUTION or []
self.oc.sdc.service.checkin_service(**self.attributes, user_remarks="checking in")
@@ -293,6 +294,9 @@ class Service(Resource):
catalog_service_id=self.catalog_service_id
).response_data
+ def _output(self):
+ return self.tosca
+
def update_service(existing_service_id, service_input):
oc = Client()
@@ -401,7 +405,9 @@ def get_distribution_id(service_name):
@utility
def poll_distribution(service_name):
"""Polls a distributed service until distribution is complete"""
- poll_interval = SDC_PROPERTIES.POLL_INTERVAL or 30
+ oc = Client()
+
+ poll_interval = oc.config.sdc.POLL_INTERVAL or 30
x = 0
while x < 30:
distribution = get_service_distribution(service_name)
diff --git a/onap-client/onap_client/sdc/vnf.py b/onap-client/onap_client/sdc/vnf.py
index 03b5c54..21540e9 100644
--- a/onap-client/onap_client/sdc/vnf.py
+++ b/onap-client/onap_client/sdc/vnf.py
@@ -37,8 +37,8 @@
from onap_client.lib import generate_dummy_string
from onap_client.resource import Resource
-from onap_client import exceptions, sdc
-from onap_client.client.clients import Client
+from onap_client import exceptions
+from onap_client.client.clients import get_client as Client
from onap_client.sdc import vsp
from onap_client.util import utility
@@ -444,8 +444,9 @@ class VNF(Resource):
:policy_name: name of the policy, matching onap-client.conf
"""
- sdc_properties = sdc.SDC_PROPERTIES
- policy = sdc_properties.POLICIES.get(policy_name)
+ oc = Client()
+
+ policy = oc.config.sdc.POLICIES.get(policy_name)
if not policy:
raise exceptions.UnknownPolicyException(
"Policy {} was not found in configuration file".format(policy_name)
@@ -472,6 +473,9 @@ class VNF(Resource):
vnf = self.oc.sdc.vnf.get_catalog_resource(**self.attributes)
self.attributes["tosca"] = vnf.response_data
+ def _output(self):
+ return self.tosca
+
def update_vnf(catalog_resource_id, vnf_input):
oc = Client()
diff --git a/onap-client/onap_client/sdc/vsp.py b/onap-client/onap_client/sdc/vsp.py
index de47277..0dd2a52 100644
--- a/onap-client/onap_client/sdc/vsp.py
+++ b/onap-client/onap_client/sdc/vsp.py
@@ -37,7 +37,7 @@
from onap_client.lib import generate_dummy_string
from onap_client.resource import Resource
-from onap_client.client.clients import Client
+from onap_client.client.clients import get_client as Client
from onap_client import sdc
from onap_client.util import utility
from onap_client.exceptions import ResourceAlreadyExistsException
@@ -119,6 +119,9 @@ class VSP(Resource):
vsp = self.oc.sdc.vsp.get_software_product(**self.attributes)
self.attributes["tosca"] = vsp.response_data
+ def _output(self):
+ return self.tosca
+
def update_vsp(existing_vsp, vsp_input):
oc = Client()
diff --git a/onap-client/onap_client/sdnc/__init__.py b/onap-client/onap_client/sdnc/__init__.py
index eb3184f..5519a84 100644
--- a/onap-client/onap_client/sdnc/__init__.py
+++ b/onap-client/onap_client/sdnc/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-SDNC_PROPERTIES = APP_CONFIG.sdnc
diff --git a/onap-client/onap_client/sdnc/catalog/config_catalog.py b/onap-client/onap_client/sdnc/catalog/config_catalog.py
index da3c1cf..18854e8 100644
--- a/onap-client/onap_client/sdnc/catalog/config_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/config_catalog.py
@@ -38,77 +38,72 @@
import uuid
from functools import partial
-from onap_client import sdnc
from onap_client import config
from onap_client.sdnc.client import SDNCClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
class ConfigClient(SDNCClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "config"
-
-CATALOG_RESOURCES = {
- "GET_SERVICE_INSTANCES": {
- "verb": "GET",
- "description": "Get a list of all service instances",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "GET_SERVICE_INSTANCE": {
- "verb": "GET",
- "description": "Get details for a service instance",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "uri-parameters": ["service_instance_id"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "GET_VNF_INSTANCE": {
- "verb": "GET",
- "description": "Get details for a vnf instance",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}/service-data/vnfs/vnf/{vnf_instance_id}".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_CONFIG_PATH,
- ),
- "uri-parameters": ["service_instance_id", "vnf_instance_id"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GET_SERVICE_INSTANCES": {
+ "verb": "GET",
+ "description": "Get a list of all service instances",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "GET_SERVICE_INSTANCE": {
+ "verb": "GET",
+ "description": "Get details for a service instance",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "uri-parameters": ["service_instance_id"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "GET_VNF_INSTANCE": {
+ "verb": "GET",
+ "description": "Get details for a vnf instance",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:services/service/{service_instance_id}/service-data/vnfs/vnf/{vnf_instance_id}".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_CONFIG_PATH,
+ ),
+ "uri-parameters": ["service_instance_id", "vnf_instance_id"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/sdnc/catalog/operations_catalog.py b/onap-client/onap_client/sdnc/catalog/operations_catalog.py
index 12db3a3..2d9662b 100644
--- a/onap-client/onap_client/sdnc/catalog/operations_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/operations_catalog.py
@@ -38,60 +38,55 @@
import uuid
from functools import partial
-from onap_client import sdnc
from onap_client import config
from onap_client.sdnc.client import SDNCClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
class OperationsClient(SDNCClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "operations"
-
-CATALOG_RESOURCES = {
- "GR_API_PRELOAD": {
- "verb": "POST",
- "description": "Upload a GR API preload to SDNC",
- "uri": partial(
- "{endpoint}{service_path}/GENERIC-RESOURCE-API:preload-vf-module-topology-operation".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_OPERATIONS_PATH,
- ),
- "payload-path": ["preload_path"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
- "VNF_API_PRELOAD": {
- "verb": "POST",
- "description": "Upload a VNF API preload to SDNC",
- "uri": partial(
- "{endpoint}{service_path}/VNF-API:preload-vnf-topology-operation".format,
- endpoint=sdnc_properties.SDNC_ENDPOINT,
- service_path=sdnc_properties.SDNC_OPERATIONS_PATH,
- ),
- "payload-path": ["preload_path"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (sdnc_properties.SDNC_USERNAME, sdnc_properties.SDNC_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "GR_API_PRELOAD": {
+ "verb": "POST",
+ "description": "Upload a GR API preload to SDNC",
+ "uri": partial(
+ "{endpoint}{service_path}/GENERIC-RESOURCE-API:preload-vf-module-topology-operation".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_OPERATIONS_PATH,
+ ),
+ "payload-path": ["preload_path"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ "VNF_API_PRELOAD": {
+ "verb": "POST",
+ "description": "Upload a VNF API preload to SDNC",
+ "uri": partial(
+ "{endpoint}{service_path}/VNF-API:preload-vnf-topology-operation".format,
+ endpoint=self.config.sdnc.SDNC_ENDPOINT,
+ service_path=self.config.sdnc.SDNC_OPERATIONS_PATH,
+ ),
+ "payload-path": ["preload_path"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/sdnc/client.py b/onap-client/onap_client/sdnc/client.py
index c0a3d1b..9f5a495 100644
--- a/onap-client/onap_client/sdnc/client.py
+++ b/onap-client/onap_client/sdnc/client.py
@@ -35,11 +35,9 @@
#
# ============LICENSE_END============================================
-from onap_client import sdnc
from onap_client.client.clients import Client
from onap_client import config
-sdnc_properties = sdnc.SDNC_PROPERTIES
application_id = config.APPLICATION_ID
diff --git a/onap-client/onap_client/sdnc/preload.py b/onap-client/onap_client/sdnc/preload.py
index 8f67feb..5e1ee91 100644
--- a/onap-client/onap_client/sdnc/preload.py
+++ b/onap-client/onap_client/sdnc/preload.py
@@ -42,7 +42,6 @@ from onap_client.resource import Resource
from onap_client.client.clients import Client
from onap_client.exceptions import ServiceInstanceNotFound, VNFInstanceNotFound
from onap_client import so
-from onap_client.config import LOG as logger
class Preload(Resource):
@@ -106,8 +105,6 @@ class Preload(Resource):
module_model.get("groupName"),
)
- logger.info("Created preload {}".format(preload_path))
-
create_preload(preload_path, instance_input.get("api_type"))
return instance_input
diff --git a/onap-client/onap_client/so/__init__.py b/onap-client/onap_client/so/__init__.py
index 44cf6d7..5519a84 100644
--- a/onap-client/onap_client/so/__init__.py
+++ b/onap-client/onap_client/so/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-SO_PROPERTIES = APP_CONFIG.so
diff --git a/onap-client/onap_client/so/catalog/service_instantiation.py b/onap-client/onap_client/so/catalog/service_instantiation.py
index 665402f..d561317 100644
--- a/onap-client/onap_client/so/catalog/service_instantiation.py
+++ b/onap-client/onap_client/so/catalog/service_instantiation.py
@@ -38,279 +38,274 @@
import uuid
from functools import partial
-from onap_client import so
from onap_client import config
from onap_client.so.client import SOClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-so_properties = so.SO_PROPERTIES
application_id = config.APPLICATION_ID
class ServiceInstantiationClient(SOClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "service_instantiation"
-
-CATALOG_RESOURCES = {
- "CREATE_SERVICE_INSTANCE": {
- "verb": "POST",
- "description": "Creates a Service Instance from the service catalog",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "payload": "{}/so_service_instance.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "service_instance_name",
- "requestor_id",
- "model_invariant_id",
- "model_version_id",
- "model_name",
- "model_version",
- "tenant_id",
- "cloud_owner",
- "cloud_region",
- "api_type",
- "service_type",
- "customer_id",
- "project_name",
- "owning_entity_id",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "DELETE_SERVICE_INSTANCE": {
- "verb": "DELETE",
- "description": "Deletes a VNF Instance.",
- "uri": partial(
- "{endpoint}{service_path}/{service_instance_id}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "uri-parameters": ["service_instance_id"],
- "payload": "{}/so_delete_service.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "service_invariant_id",
- "service_name",
- "service_version",
- "api_type",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "CREATE_VNF_INSTANCE": {
- "verb": "POST",
- "description": "Creates a VNF Instance.",
- "uri": partial(
- "{endpoint}{service_path}/{service_instance_id}/vnfs".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "uri-parameters": ["service_instance_id"],
- "payload": "{}/so_vnf_instance.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "vnf_instance_name",
- "requestor_id",
- "model_invariant_id",
- "model_version_id",
- "model_name",
- "model_version",
- "model_customization_id",
- "tenant_id",
- "cloud_owner",
- "cloud_region",
- "api_type",
- "platform",
- "line_of_business",
- "service_model_name",
- "service_model_invariant_id",
- "service_model_version",
- "service_model_version_id",
- "service_instance_id",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "DELETE_VNF_INSTANCE": {
- "verb": "DELETE",
- "description": "Deletes a VNF Instance.",
- "uri": partial(
- "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "uri-parameters": ["service_instance_id", "vnf_instance_id"],
- "payload": "{}/so_delete_vnf.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "vnf_invariant_id",
- "vnf_name",
- "vnf_version",
- "cloud_region",
- "cloud_owner",
- "tenant_id",
- "api_type",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "CREATE_MODULE_INSTANCE": {
- "verb": "POST",
- "description": "Creates a VNF Module Instance.",
- "uri": partial(
- "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}/vfModules".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "uri-parameters": ["service_instance_id", "vnf_instance_id"],
- "payload": "{}/so_create_module.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "module_instance_name",
- "model_invariant_id",
- "model_version_id",
- "model_name",
- "model_version",
- "model_customization_id",
- "model_name",
- "api_type",
- "tenant_id",
- "cloud_owner",
- "cloud_region",
- "service_instance_id",
- "service_model_name",
- "service_model_invariant_id",
- "service_model_version",
- "service_model_version_id",
- "vnf_instance_id",
- "vnf_model_name",
- "vnf_model_invariant_id",
- "vnf_model_version",
- "vnf_model_version_id",
- "vnf_model_customization_id",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "DELETE_MODULE_INSTANCE": {
- "verb": "DELETE",
- "description": "Deletes a VNF Module Instance.",
- "uri": partial(
- "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}/vfModules/{vf_module_id}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_SERVICE_INSTANCE_PATH,
- ),
- "uri-parameters": ["service_instance_id", "vnf_instance_id", "vf_module_id"],
- "payload": "{}/so_delete_module.jinja".format(PAYLOADS_DIR),
- "payload-parameters": [
- "module_invariant_id",
- "module_name",
- "module_version",
- "cloud_region",
- "cloud_owner",
- "tenant_id",
- "api_type",
- ],
- "header-parameters": ["X-TransactionId"],
- "success_code": 202,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- # "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "GET_REQUEST_STATUS": {
- "verb": "GET",
- "description": "Queries the status for a given request ID",
- "uri": partial(
- "{endpoint}{service_path}/{request_id}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_ORCHESTRATION_PATH,
- ),
- "uri-parameters": ["request_id"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "GET_SERVICE_MODEL": {
- "verb": "GET",
- "description": "Searches the SO catalog for a service model",
- "uri": partial(
- "{endpoint}/service/search/findOneByModelName?modelName={model_name}".format,
- endpoint=so_properties.SO_ENDPOINT,
- ),
- "uri-parameters": ["model_name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
- "GET_SERVICE_MODEL_DETAILS": {
- "verb": "GET",
- "description": "Searches the SO catalog for a service model",
- "uri": partial(
- "{endpoint}/service/search/findOneByModelName?modelName={model_name}".format,
- endpoint=so_properties.SO_ENDPOINT,
- ),
- "uri-parameters": ["model_name"],
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "CREATE_SERVICE_INSTANCE": {
+ "verb": "POST",
+ "description": "Creates a Service Instance from the service catalog",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "payload": "{}/so_service_instance.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "service_instance_name",
+ "requestor_id",
+ "model_invariant_id",
+ "model_version_id",
+ "model_name",
+ "model_version",
+ "tenant_id",
+ "cloud_owner",
+ "cloud_region",
+ "api_type",
+ "service_type",
+ "customer_id",
+ "project_name",
+ "owning_entity_id",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "DELETE_SERVICE_INSTANCE": {
+ "verb": "DELETE",
+ "description": "Deletes a VNF Instance.",
+ "uri": partial(
+ "{endpoint}{service_path}/{service_instance_id}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "uri-parameters": ["service_instance_id"],
+ "payload": "{}/so_delete_service.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "service_invariant_id",
+ "service_name",
+ "service_version",
+ "api_type",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "CREATE_VNF_INSTANCE": {
+ "verb": "POST",
+ "description": "Creates a VNF Instance.",
+ "uri": partial(
+ "{endpoint}{service_path}/{service_instance_id}/vnfs".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "uri-parameters": ["service_instance_id"],
+ "payload": "{}/so_vnf_instance.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "vnf_instance_name",
+ "requestor_id",
+ "model_invariant_id",
+ "model_version_id",
+ "model_name",
+ "model_version",
+ "model_customization_id",
+ "tenant_id",
+ "cloud_owner",
+ "cloud_region",
+ "api_type",
+ "platform",
+ "line_of_business",
+ "service_model_name",
+ "service_model_invariant_id",
+ "service_model_version",
+ "service_model_version_id",
+ "service_instance_id",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "DELETE_VNF_INSTANCE": {
+ "verb": "DELETE",
+ "description": "Deletes a VNF Instance.",
+ "uri": partial(
+ "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "uri-parameters": ["service_instance_id", "vnf_instance_id"],
+ "payload": "{}/so_delete_vnf.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "vnf_invariant_id",
+ "vnf_name",
+ "vnf_version",
+ "cloud_region",
+ "cloud_owner",
+ "tenant_id",
+ "api_type",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "CREATE_MODULE_INSTANCE": {
+ "verb": "POST",
+ "description": "Creates a VNF Module Instance.",
+ "uri": partial(
+ "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}/vfModules".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "uri-parameters": ["service_instance_id", "vnf_instance_id"],
+ "payload": "{}/so_create_module.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "module_instance_name",
+ "model_invariant_id",
+ "model_version_id",
+ "model_name",
+ "model_version",
+ "model_customization_id",
+ "model_name",
+ "api_type",
+ "tenant_id",
+ "cloud_owner",
+ "cloud_region",
+ "service_instance_id",
+ "service_model_name",
+ "service_model_invariant_id",
+ "service_model_version",
+ "service_model_version_id",
+ "vnf_instance_id",
+ "vnf_model_name",
+ "vnf_model_invariant_id",
+ "vnf_model_version",
+ "vnf_model_version_id",
+ "vnf_model_customization_id",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "DELETE_MODULE_INSTANCE": {
+ "verb": "DELETE",
+ "description": "Deletes a VNF Module Instance.",
+ "uri": partial(
+ "{endpoint}{service_path}/{service_instance_id}/vnfs/{vnf_instance_id}/vfModules/{vf_module_id}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_SERVICE_INSTANCE_PATH,
+ ),
+ "uri-parameters": ["service_instance_id", "vnf_instance_id", "vf_module_id"],
+ "payload": "{}/so_delete_module.jinja".format(PAYLOADS_DIR),
+ "payload-parameters": [
+ "module_invariant_id",
+ "module_name",
+ "module_version",
+ "cloud_region",
+ "cloud_owner",
+ "tenant_id",
+ "api_type",
+ ],
+ "header-parameters": ["X-TransactionId"],
+ "success_code": 202,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ # "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "GET_REQUEST_STATUS": {
+ "verb": "GET",
+ "description": "Queries the status for a given request ID",
+ "uri": partial(
+ "{endpoint}{service_path}/{request_id}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_ORCHESTRATION_PATH,
+ ),
+ "uri-parameters": ["request_id"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "GET_SERVICE_MODEL": {
+ "verb": "GET",
+ "description": "Searches the SO catalog for a service model",
+ "uri": partial(
+ "{endpoint}/service/search/findOneByModelName?modelName={model_name}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ ),
+ "uri-parameters": ["model_name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ "GET_SERVICE_MODEL_DETAILS": {
+ "verb": "GET",
+ "description": "Searches the SO catalog for a service model",
+ "uri": partial(
+ "{endpoint}/service/search/findOneByModelName?modelName={model_name}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ ),
+ "uri-parameters": ["model_name"],
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ }
diff --git a/onap-client/onap_client/so/client.py b/onap-client/onap_client/so/client.py
index c38cf0c..7e79fe1 100644
--- a/onap-client/onap_client/so/client.py
+++ b/onap-client/onap_client/so/client.py
@@ -36,11 +36,9 @@
# ============LICENSE_END============================================
from functools import partial
-from onap_client import so
from onap_client.client.clients import Client
from onap_client import config
-so_properties = so.SO_PROPERTIES
application_id = config.APPLICATION_ID
@@ -51,19 +49,16 @@ class SOClient(Client):
@property
def catalog_resources(self):
- return CATALOG_RESOURCES
-
-
-CATALOG_RESOURCES = {
- "HEALTH_CHECK": {
- "verb": "GET",
- "description": "Queries so health check endpoint",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=so_properties.SO_ENDPOINT,
- service_path=so_properties.SO_HEALTH_CHECK_PATH,
- ),
- "success_code": 200,
- "auth": (so_properties.SO_USERNAME, so_properties.SO_PASSWORD),
- },
-}
+ return {
+ "HEALTH_CHECK": {
+ "verb": "GET",
+ "description": "Queries so health check endpoint",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.so.SO_ENDPOINT,
+ service_path=self.config.so.SO_HEALTH_CHECK_PATH,
+ ),
+ "success_code": 200,
+ "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ },
+ }
diff --git a/onap-client/onap_client/so/module_instance.py b/onap-client/onap_client/so/module_instance.py
index 51c9bc2..67da272 100644
--- a/onap-client/onap_client/so/module_instance.py
+++ b/onap-client/onap_client/so/module_instance.py
@@ -37,7 +37,7 @@
import uuid
from onap_client.resource import Resource
-from onap_client.client.clients import Client
+from onap_client.client.clients import get_client as Client
from onap_client.exceptions import ServiceInstanceNotFound, VNFInstanceNotFound, ModuleInstanceNotFound
from onap_client import so
from onap_client import sdnc
diff --git a/onap-client/onap_client/so/service_instance.py b/onap-client/onap_client/so/service_instance.py
index 10271fa..3675a4e 100644
--- a/onap-client/onap_client/so/service_instance.py
+++ b/onap-client/onap_client/so/service_instance.py
@@ -39,8 +39,7 @@ import uuid
from onap_client.lib import generate_dummy_string
from onap_client.resource import Resource
-from onap_client.client.clients import Client
-from onap_client.so import SO_PROPERTIES
+from onap_client.client.clients import get_client as Client
from onap_client.exceptions import (
SORequestStatusUnavailable,
SORequestFailed,
@@ -152,7 +151,7 @@ def poll_request(request_id):
"""Poll an SO request until completion"""
oc = Client()
- poll_interval = SO_PROPERTIES.POLL_INTERVAL or 30
+ poll_interval = oc.config.so.POLL_INTERVAL or 30
request = None
x = 0
while x < 30:
diff --git a/onap-client/onap_client/so/vnf_instance.py b/onap-client/onap_client/so/vnf_instance.py
index abb26c3..0dbd87f 100644
--- a/onap-client/onap_client/so/vnf_instance.py
+++ b/onap-client/onap_client/so/vnf_instance.py
@@ -39,7 +39,7 @@ import uuid
from onap_client.lib import generate_dummy_string
from onap_client.resource import Resource
-from onap_client.client.clients import Client as SOClient
+from onap_client.client.clients import get_client as Client
from onap_client.exceptions import (
ServiceInstanceNotFound,
VNFComponentNotFound,
@@ -52,12 +52,6 @@ from onap_client import so
from onap_client.util import utility
-oc = SOClient()
-so_client = oc.so
-sdc_client = oc.sdc
-sdnc_client = oc.sdnc
-
-
class VNFInstance(Resource):
resource_name = "VNF_INSTANCE"
spec = {
@@ -116,7 +110,7 @@ class VNFInstance(Resource):
vnf_model_version_id = vnf_component["actualComponentUid"]
vnf_model_version = vnf_component["componentVersion"]
- vnf_model = sdc_client.vnf.get_catalog_resource(
+ vnf_model = self.oc.sdc.vnf.get_catalog_resource(
catalog_resource_id=vnf_model_version_id,
).response_data
vnf_model_invariant_id = vnf_model["invariantUUID"]
@@ -135,7 +129,8 @@ class VNFInstance(Resource):
def get_vnf_model_component(service_model_name, vnf_model_name):
- service_model = sdc_client.service.get_sdc_service(
+ oc = Client()
+ service_model = oc.sdc.service.get_sdc_service(
catalog_service_id=sdc.service.get_service_id(service_model_name)
).response_data
@@ -146,7 +141,8 @@ def get_vnf_model_component(service_model_name, vnf_model_name):
def get_service_instance(service_instance_name):
- service_instances = sdnc_client.config.get_service_instances().response_data
+ oc = Client()
+ service_instances = oc.sdnc.config.get_service_instances().response_data
for si in service_instances.get("services", {}).get("service", []):
si_name = (
si.get("service-data", {})
@@ -196,8 +192,10 @@ def get_vnf_instance(service_instance, vnf_instance_name):
def create_vnf_instance(instance_input):
+ oc = Client()
+
headers = {"X-TransactionId": str(uuid.uuid4())}
- vnf_instance = so_client.service_instantiation.create_vnf_instance(
+ vnf_instance = oc.so.service_instantiation.create_vnf_instance(
**instance_input, **headers
)
@@ -213,6 +211,7 @@ def create_vnf_instance(instance_input):
@utility
def delete_vnf_instance(service_instance_name, vnf_instance_name, api_type="GR_API"):
"""Delete a VNF Instance from SO"""
+ oc = Client()
si = so.service_instance.get_service_instance(service_instance_name)
si_id = si.get("service-instance-id")
for vnfi in si.get("service-data", {}).get("vnfs", {}).get("vnf", []):
@@ -223,7 +222,7 @@ def delete_vnf_instance(service_instance_name, vnf_instance_name, api_type="GR_A
tenant_id = vnfi.get("vnf-data").get("vnf-request-input").get("tenant")
cloud_owner = vnfi.get("vnf-data").get("vnf-request-input").get("cloud-owner")
cloud_region = vnfi.get("vnf-data").get("vnf-request-input").get("aic-cloud-region")
- return so_client.service_instantiation.delete_vnf_instance(
+ return oc.so.service_instantiation.delete_vnf_instance(
vnf_invariant_id=invariant_id,
vnf_version=vnf_version,
vnf_name=vnf_instance_name,
diff --git a/onap-client/onap_client/tests/test_engine.py b/onap-client/onap_client/tests/test_engine.py
index 808e5b7..b305725 100644
--- a/onap-client/onap_client/tests/test_engine.py
+++ b/onap-client/onap_client/tests/test_engine.py
@@ -46,4 +46,4 @@ def test_engine():
t = load_spec(spec_file)
- assert isinstance(t, dict)
+ assert isinstance(t, list)
diff --git a/onap-client/onap_client/vid/__init__.py b/onap-client/onap_client/vid/__init__.py
index 1cb6244..5519a84 100644
--- a/onap-client/onap_client/vid/__init__.py
+++ b/onap-client/onap_client/vid/__init__.py
@@ -34,7 +34,3 @@
# limitations under the License.
#
# ============LICENSE_END============================================
-
-from onap_client.config import APP_CONFIG
-
-VID_PROPERTIES = APP_CONFIG.vid
diff --git a/onap-client/onap_client/vid/catalog/maintenance_catalog.py b/onap-client/onap_client/vid/catalog/maintenance_catalog.py
index 2f01a79..1c7bad0 100644
--- a/onap-client/onap_client/vid/catalog/maintenance_catalog.py
+++ b/onap-client/onap_client/vid/catalog/maintenance_catalog.py
@@ -38,117 +38,112 @@
import uuid
from functools import partial
-from onap_client import vid
from onap_client import config
from onap_client.vid.client import VIDClient
PAYLOADS_DIR = config.PAYLOADS_DIR
-vid_properties = vid.VID_PROPERTIES
application_id = config.APPLICATION_ID
class MaintenanceClient(VIDClient):
@property
- def catalog_resources(self):
- return CATALOG_RESOURCES
-
- @property
def namespace(self):
return "maintenance"
-
-CATALOG_RESOURCES = {
- "CREATE_OWNING_ENTITY": {
- "verb": "POST",
- "description": "Creates an owning entity in VID",
- "uri": partial(
- "{endpoint}{service_path}/category_parameter/owningEntity".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_MAINTENANCE_PATH,
- ),
- "payload-parameters": ["name"],
- "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
- "CREATE_LINE_OF_BUSINESS": {
- "verb": "POST",
- "description": "Creates a line of business in VID",
- "uri": partial(
- "{endpoint}{service_path}/category_parameter/lineOfBusiness".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_MAINTENANCE_PATH,
- ),
- "payload-parameters": ["name"],
- "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
- "CREATE_PLATFORM": {
- "verb": "POST",
- "description": "Creates a platform in VID",
- "uri": partial(
- "{endpoint}{service_path}/category_parameter/platform".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_MAINTENANCE_PATH,
- ),
- "payload-parameters": ["name"],
- "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
- "CREATE_PROJECT": {
- "verb": "POST",
- "description": "Creates a project in VID",
- "uri": partial(
- "{endpoint}{service_path}/category_parameter/project".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_MAINTENANCE_PATH,
- ),
- "payload-parameters": ["name"],
- "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
- "GET_CATEGORY_PARAMETERS": {
- "verb": "GET",
- "description": "Returns the category parameters currently stored in VID",
- "uri": partial(
- "{endpoint}{service_path}/category_parameter?familyName=PARAMETER_STANDARDIZATION".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_MAINTENANCE_PATH,
- ),
- "success_code": 200,
- "headers": {
- "Accept": "application/json",
- "Content-Type": "application/json",
- "X-TransactionId": str(uuid.uuid4()),
- "X-FromAppId": application_id,
- },
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
-}
+ @property
+ def catalog_resources(self):
+ return {
+ "CREATE_OWNING_ENTITY": {
+ "verb": "POST",
+ "description": "Creates an owning entity in VID",
+ "uri": partial(
+ "{endpoint}{service_path}/category_parameter/owningEntity".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_MAINTENANCE_PATH,
+ ),
+ "payload-parameters": ["name"],
+ "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ "CREATE_LINE_OF_BUSINESS": {
+ "verb": "POST",
+ "description": "Creates a line of business in VID",
+ "uri": partial(
+ "{endpoint}{service_path}/category_parameter/lineOfBusiness".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_MAINTENANCE_PATH,
+ ),
+ "payload-parameters": ["name"],
+ "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ "CREATE_PLATFORM": {
+ "verb": "POST",
+ "description": "Creates a platform in VID",
+ "uri": partial(
+ "{endpoint}{service_path}/category_parameter/platform".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_MAINTENANCE_PATH,
+ ),
+ "payload-parameters": ["name"],
+ "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ "CREATE_PROJECT": {
+ "verb": "POST",
+ "description": "Creates a project in VID",
+ "uri": partial(
+ "{endpoint}{service_path}/category_parameter/project".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_MAINTENANCE_PATH,
+ ),
+ "payload-parameters": ["name"],
+ "payload": "{}/vid_maintenance.jinja".format(PAYLOADS_DIR),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ "GET_CATEGORY_PARAMETERS": {
+ "verb": "GET",
+ "description": "Returns the category parameters currently stored in VID",
+ "uri": partial(
+ "{endpoint}{service_path}/category_parameter?familyName=PARAMETER_STANDARDIZATION".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_MAINTENANCE_PATH,
+ ),
+ "success_code": 200,
+ "headers": {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ "X-TransactionId": str(uuid.uuid4()),
+ "X-FromAppId": application_id,
+ },
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ }
diff --git a/onap-client/onap_client/vid/client.py b/onap-client/onap_client/vid/client.py
index 3b95618..d3d4468 100644
--- a/onap-client/onap_client/vid/client.py
+++ b/onap-client/onap_client/vid/client.py
@@ -36,11 +36,9 @@
# ============LICENSE_END============================================
from functools import partial
-from onap_client import vid
from onap_client.client.clients import Client
from onap_client import config
-vid_properties = vid.VID_PROPERTIES
application_id = config.APPLICATION_ID
@@ -51,19 +49,16 @@ class VIDClient(Client):
@property
def catalog_resources(self):
- return CATALOG_RESOURCES
-
-
-CATALOG_RESOURCES = {
- "HEALTH_CHECK": {
- "verb": "GET",
- "description": "Queries VID health check endpoint",
- "uri": partial(
- "{endpoint}{service_path}".format,
- endpoint=vid_properties.VID_ENDPOINT,
- service_path=vid_properties.VID_HEALTH_CHECK_PATH,
- ),
- "success_code": 200,
- "auth": (vid_properties.VID_USERNAME, vid_properties.VID_PASSWORD,),
- },
-}
+ return {
+ "HEALTH_CHECK": {
+ "verb": "GET",
+ "description": "Queries VID health check endpoint",
+ "uri": partial(
+ "{endpoint}{service_path}".format,
+ endpoint=self.config.vid.VID_ENDPOINT,
+ service_path=self.config.vid.VID_HEALTH_CHECK_PATH,
+ ),
+ "success_code": 200,
+ "auth": (self.config.vid.VID_USERNAME, self.config.vid.VID_PASSWORD,),
+ },
+ }
diff --git a/onap-client/setup.py b/onap-client/setup.py
index a9adbb4..5f0048b 100644
--- a/onap-client/setup.py
+++ b/onap-client/setup.py
@@ -47,7 +47,7 @@ for file in os.listdir("etc/payloads"):
setuptools.setup(
name="onap-client",
- version="0.8.0",
+ version="0.9.0",
author="Steven Stark",
author_email="steven.stark@att.com",
description="Python API wrapper for ONAP applications",
@@ -63,4 +63,12 @@ setuptools.setup(
python_requires=">=3.6",
scripts=["bin/onap-client"],
data_files=datafiles,
+ install_requires=[
+ "Jinja2>=2.10",
+ "PyYAML>=5.1.2",
+ "requests>=2.22.0",
+ "PTable>=0.9.2",
+ "simplejson>=3.17.0",
+ "prettytable>=0.7.2"
+ ]
)