diff options
author | stark, steven <steven.stark@att.com> | 2020-08-03 13:03:24 -0700 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2020-08-03 13:03:24 -0700 |
commit | 32409110b65b013bc65930f3cfdef09671cd3a5a (patch) | |
tree | 4bb6c95c057cdde0f08af78e7abc53e2be02fad4 /onap-client/onap_client/aai | |
parent | 9df81b14e7203d6c3911f5f36881cb5170afdccc (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
Diffstat (limited to 'onap-client/onap_client/aai')
-rw-r--r-- | onap-client/onap_client/aai/__init__.py | 4 | ||||
-rw-r--r-- | onap-client/onap_client/aai/catalog/business_catalog.py | 440 | ||||
-rw-r--r-- | onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py | 155 | ||||
-rw-r--r-- | onap-client/onap_client/aai/client.py | 43 |
4 files changed, 311 insertions, 331 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,), + }, + } |