aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/sdnc
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-10-15 12:34:35 -0700
committerstark, steven <steven.stark@att.com>2020-10-15 12:39:49 -0700
commita0984e365a7c610e9cb91cf73e5d09db2be6df6a (patch)
tree67b8aaaffb37b56105569f2233672db9e5720cbd /onap-client/onap_client/sdnc
parent82f201fb65094aad55b3e46634bad39713387c6e (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/sdnc')
-rw-r--r--onap-client/onap_client/sdnc/catalog/config_catalog.py6
-rw-r--r--onap-client/onap_client/sdnc/catalog/operations_catalog.py4
-rw-r--r--onap-client/onap_client/sdnc/client.py20
3 files changed, 25 insertions, 5 deletions
diff --git a/onap-client/onap_client/sdnc/catalog/config_catalog.py b/onap-client/onap_client/sdnc/catalog/config_catalog.py
index b3c5b1f..7bbf62a 100644
--- a/onap-client/onap_client/sdnc/catalog/config_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/config_catalog.py
@@ -63,7 +63,7 @@ class ConfigClient(SDNCClient):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": self.config.application_id,
},
- "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ "auth": self.auth,
},
"GET_SERVICE_INSTANCE": {
"verb": "GET",
@@ -81,7 +81,7 @@ class ConfigClient(SDNCClient):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": self.config.application_id,
},
- "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ "auth": self.auth,
},
"GET_VNF_INSTANCE": {
"verb": "GET",
@@ -99,6 +99,6 @@ class ConfigClient(SDNCClient):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": self.config.application_id,
},
- "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ "auth": self.auth,
},
}
diff --git a/onap-client/onap_client/sdnc/catalog/operations_catalog.py b/onap-client/onap_client/sdnc/catalog/operations_catalog.py
index 79e6f29..4763c9b 100644
--- a/onap-client/onap_client/sdnc/catalog/operations_catalog.py
+++ b/onap-client/onap_client/sdnc/catalog/operations_catalog.py
@@ -64,7 +64,7 @@ class OperationsClient(SDNCClient):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": self.config.application_id,
},
- "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ "auth": self.auth,
},
"VNF_API_PRELOAD": {
"verb": "POST",
@@ -82,6 +82,6 @@ class OperationsClient(SDNCClient):
"X-TransactionId": str(uuid.uuid4()),
"X-FromAppId": self.config.application_id,
},
- "auth": (self.config.sdnc.SDNC_USERNAME, self.config.sdnc.SDNC_PASSWORD,),
+ "auth": self.auth,
},
}
diff --git a/onap-client/onap_client/sdnc/client.py b/onap-client/onap_client/sdnc/client.py
index 1ebd04a..03b338e 100644
--- a/onap-client/onap_client/sdnc/client.py
+++ b/onap-client/onap_client/sdnc/client.py
@@ -34,7 +34,9 @@
# limitations under the License.
#
# ============LICENSE_END============================================
+from frozendict import frozendict
from onap_client.client.clients import Client
+from onap_client.auth import auth_handler
class SDNCClient(Client):
@@ -45,3 +47,21 @@ class SDNCClient(Client):
@property
def catalog_resources(self):
return {}
+
+ @property
+ def sdnc_username(self):
+ """Username to authenticate to SDNC"""
+ return self.config.sdnc.SDNC_USERNAME
+
+ @property
+ def sdnc_password(self):
+ """Password to authenticate to SDNC"""
+ return self.config.sdnc.SDNC_PASSWORD
+
+ @property
+ def auth(self):
+ return auth_handler(
+ frozendict(self.config.sdnc.AUTH_PLUGIN) if self.config.sdnc.AUTH_PLUGIN else None,
+ self.sdnc_username,
+ self.sdnc_password,
+ )