aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/so/client.py
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/so/client.py
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/so/client.py')
-rw-r--r--onap-client/onap_client/so/client.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/onap-client/onap_client/so/client.py b/onap-client/onap_client/so/client.py
index 3fa48ec..80e9443 100644
--- a/onap-client/onap_client/so/client.py
+++ b/onap-client/onap_client/so/client.py
@@ -35,7 +35,9 @@
#
# ============LICENSE_END============================================
from functools import partial
+from frozendict import frozendict
from onap_client.client.clients import Client
+from onap_client.auth import auth_handler
class SOClient(Client):
@@ -55,6 +57,24 @@ class SOClient(Client):
service_path=self.config.so.SO_HEALTH_CHECK_PATH,
),
"success_code": 200,
- "auth": (self.config.so.SO_USERNAME, self.config.so.SO_PASSWORD),
+ "auth": self.auth,
},
}
+
+ @property
+ def so_username(self):
+ """Username to authenticate to SO"""
+ return self.config.so.SO_USERNAME
+
+ @property
+ def so_password(self):
+ """Password to authenticate to SO"""
+ return self.config.so.SO_PASSWORD
+
+ @property
+ def auth(self):
+ return auth_handler(
+ frozendict(self.config.so.AUTH_PLUGIN) if self.config.so.AUTH_PLUGIN else None,
+ self.so_username,
+ self.so_password,
+ )