summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2018-09-28 02:56:29 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2018-09-28 02:56:29 -0700
commitc477064f0b4d30ff9f8a467dd8fa6564203956fb (patch)
tree441d8c177b98947e1ffbb0a97591c88161ae2547
parent30d9e916b1591ca4af8bbf56433b65858010f7d8 (diff)
Fix AAF Authentication CSIT issues
The value stored in perms.cache is throwing JSON load error on subsequent calls. Returned the perms['roles'] from cache. Fixed expected string or buffer error in plans.py CSIT was stuck waiting for port 8100. Changed the aafsim internal port to 8100 everywhere (same as the aaf-service port). Change-Id: I00e72a0aee66bb0649996288c37c6c0aef2070d2 Issue-ID: OPTFRA-362 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
-rwxr-xr-xconductor.conf24
-rw-r--r--conductor/conductor/api/adapters/aaf/aaf_authentication.py2
-rw-r--r--conductor/conductor/api/controllers/v1/plans.py4
-rwxr-xr-xconductor/conductor/tests/functional/simulators/aafsim/Dockerfile5
-rwxr-xr-xconductor/conductor/tests/functional/simulators/run_aafsim.sh4
5 files changed, 32 insertions, 7 deletions
diff --git a/conductor.conf b/conductor.conf
index 654eddd..b2f0078 100755
--- a/conductor.conf
+++ b/conductor.conf
@@ -119,6 +119,30 @@ log_config_append = /usr/local/bin/log.conf
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = false
+[aaf_authentication]
+
+#
+# From conductor
+#
+
+# is_aaf_enabled. (boolean value)
+is_aaf_enabled = false
+
+# aaf_cache_expiry_hrs. (integer value)
+#aaf_cache_expiry_hrs = 3
+
+# aaf_url. (string value)
+aaf_url = http://aaf-service:8100/authz/perms/user/
+
+# aaf_retries. (integer value)
+#aaf_retries = 3
+
+# aaf_timeout. (integer value)
+#aaf_timeout = 100
+
+# aaf_user_roles. (list value)
+#aaf_user_roles = {"type": "org.onap.oof","instance": "plans","action": "GET"},{"type": "org.onap.oof","instance": "plans","action": "POST"}
+
[aaf_sms]
diff --git a/conductor/conductor/api/adapters/aaf/aaf_authentication.py b/conductor/conductor/api/adapters/aaf/aaf_authentication.py
index fca84fd..e6b79d2 100644
--- a/conductor/conductor/api/adapters/aaf/aaf_authentication.py
+++ b/conductor/conductor/api/adapters/aaf/aaf_authentication.py
@@ -113,7 +113,7 @@ def get_aaf_permissions(uid, passwd):
if perms and datetime.now() < perms.get(EXPIRE_TIME):
LOG.debug("Returning cached value")
- return perms
+ return perms['roles']
LOG.debug("Invoking AAF authentication API")
response = remote_api(passwd, uid)
perms = {EXPIRE_TIME: datetime.now() + time_delta, 'roles': response}
diff --git a/conductor/conductor/api/controllers/v1/plans.py b/conductor/conductor/api/controllers/v1/plans.py
index f70b998..b32caef 100644
--- a/conductor/conductor/api/controllers/v1/plans.py
+++ b/conductor/conductor/api/controllers/v1/plans.py
@@ -350,8 +350,8 @@ def verify_user(authstr):
user_pw = auth_str.split(' ')[1]
decode_user_pw = base64.b64decode(user_pw)
list_id_pw = decode_user_pw.split(':')
- user_dict['username'] = list_id_pw[0]
- user_dict['password'] = list_id_pw[1]
+ user_dict['username'] = str(list_id_pw[0])
+ user_dict['password'] = str(list_id_pw[1])
password = CONF.conductor_api.password
username = CONF.conductor_api.username
diff --git a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
index 5970b3b..eb43a86 100755
--- a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
+++ b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
@@ -27,13 +27,14 @@ ADD ./ /opt/aafsim
# Install any needed packages specified in requirements.txt
RUN pip install web.py
+RUN pip install oslo.log
# Make port 80 available to the world outside this container
-EXPOSE 8081
+EXPOSE 8100
# Define environment variable
ENV NAME aafsim
# Run aafsim.py when the container launches
-CMD ["/bin/sh", "-c", "python -u aafsim.py 8081 > /tmp/aafsim.log 2>&1"]
+CMD ["/bin/sh", "-c", "python -u aafsim.py 8100 > /tmp/aafsim.log 2>&1"]
diff --git a/conductor/conductor/tests/functional/simulators/run_aafsim.sh b/conductor/conductor/tests/functional/simulators/run_aafsim.sh
index 0039bbc..8535613 100755
--- a/conductor/conductor/tests/functional/simulators/run_aafsim.sh
+++ b/conductor/conductor/tests/functional/simulators/run_aafsim.sh
@@ -17,6 +17,6 @@
#
# -------------------------------------------------------------------------
#
-# Note mapping to external port 8082. avoids conflict with aaisim
-docker run -d --name aafsim -p 8082:8081 aafsim
+# Note mapping to external port 8100. avoids conflict with aaisim
+docker run -d --name aafsim -p 8100:8100 aafsim