aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/aai/catalog/business_catalog.py
diff options
context:
space:
mode:
Diffstat (limited to 'onap-client/onap_client/aai/catalog/business_catalog.py')
-rw-r--r--onap-client/onap_client/aai/catalog/business_catalog.py440
1 files changed, 217 insertions, 223 deletions
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,),
+ },
+ }