diff options
author | stark, steven <steven.stark@att.com> | 2020-10-15 12:34:35 -0700 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2020-10-15 12:39:49 -0700 |
commit | a0984e365a7c610e9cb91cf73e5d09db2be6df6a (patch) | |
tree | 67b8aaaffb37b56105569f2233672db9e5720cbd /onap-client/onap_client/aai | |
parent | 82f201fb65094aad55b3e46634bad39713387c6e (diff) |
[VVP] VVP onap-client enhancements
Adding capability for custom auth plugin (defaults to basic auth).
During updates to VNF models, resource and policy objects are deletd and recreated.
Issue-ID: VVP-477
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: Iba743176167c2b1df185666b08cbd79c6a559c9e
Diffstat (limited to 'onap-client/onap_client/aai')
-rw-r--r-- | onap-client/onap_client/aai/catalog/business_catalog.py | 24 | ||||
-rw-r--r-- | onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py | 10 | ||||
-rw-r--r-- | onap-client/onap_client/aai/client.py | 22 |
3 files changed, 38 insertions, 18 deletions
diff --git a/onap-client/onap_client/aai/catalog/business_catalog.py b/onap-client/onap_client/aai/catalog/business_catalog.py index 51c2409..9105ba7 100644 --- a/onap-client/onap_client/aai/catalog/business_catalog.py +++ b/onap-client/onap_client/aai/catalog/business_catalog.py @@ -64,7 +64,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_OWNING_ENTITIES": { "verb": "GET", @@ -81,7 +81,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_CUSTOMER": { "verb": "GET", @@ -99,7 +99,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_CUSTOMERS": { "verb": "GET", @@ -116,7 +116,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_PLATFORM": { "verb": "GET", @@ -134,7 +134,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_PLATFORMS": { "verb": "GET", @@ -151,7 +151,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_PROJECT": { "verb": "GET", @@ -169,7 +169,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_PROJECTS": { "verb": "GET", @@ -186,7 +186,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_LINES_OF_BUSINESS": { "verb": "GET", @@ -203,7 +203,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "CREATE_CUSTOMER": { "verb": "PUT", @@ -223,7 +223,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_CUSTOMER_SUBSCRIPTIONS": { "verb": "GET", @@ -241,7 +241,7 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_SERVICE_INSTANCES": { "verb": "GET", @@ -259,6 +259,6 @@ class BusinessClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, } 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 d22ab0e..e71f767 100644 --- a/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py +++ b/onap-client/onap_client/aai/catalog/cloud_infrastructure_catalog.py @@ -63,7 +63,7 @@ class CloudInfrastructureClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_CLOUD_REGION": { "verb": "GET", @@ -81,7 +81,7 @@ class CloudInfrastructureClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_CLOUD_REGION_TENANTS": { "verb": "GET", @@ -99,7 +99,7 @@ class CloudInfrastructureClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_ESR_LIST": { "verb": "GET", @@ -117,7 +117,7 @@ class CloudInfrastructureClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, "GET_VOLUME_GROUPS": { "verb": "GET", @@ -135,6 +135,6 @@ class CloudInfrastructureClient(AAIClient): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, } diff --git a/onap-client/onap_client/aai/client.py b/onap-client/onap_client/aai/client.py index c4ab03b..2f48e62 100644 --- a/onap-client/onap_client/aai/client.py +++ b/onap-client/onap_client/aai/client.py @@ -37,7 +37,9 @@ import uuid from functools import partial +from frozendict import frozendict from onap_client.client.clients import Client +from onap_client.auth import auth_handler class AAIClient(Client): @@ -63,6 +65,24 @@ class AAIClient(Client): "X-TransactionId": str(uuid.uuid4()), "X-FromAppId": self.config.application_id, }, - "auth": (self.config.aai.AAI_USERNAME, self.config.aai.AAI_PASSWORD,), + "auth": self.auth, }, } + + @property + def aai_username(self): + """Username to authenticate to AAI""" + return self.config.aai.AAI_USERNAME + + @property + def aai_password(self): + """Password to authenticate to AAI""" + return self.config.aai.AAI_PASSWORD + + @property + def auth(self): + return auth_handler( + frozendict(self.config.aai.AUTH_PLUGIN) if self.config.aai.AUTH_PLUGIN else None, + self.aai_username, + self.aai_password, + ) |