Fix AAF Authentication CSIT issues 09/69509/1
authorDileep Ranganathan <dileep.ranganathan@intel.com>
Fri, 28 Sep 2018 09:56:29 +0000 (02:56 -0700)
committerDileep Ranganathan <dileep.ranganathan@intel.com>
Fri, 28 Sep 2018 09:56:29 +0000 (02:56 -0700)
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>
conductor.conf
conductor/conductor/api/adapters/aaf/aaf_authentication.py
conductor/conductor/api/controllers/v1/plans.py
conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
conductor/conductor/tests/functional/simulators/run_aafsim.sh

index 654eddd..b2f0078 100755 (executable)
@@ -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]
 
index fca84fd..e6b79d2 100644 (file)
@@ -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}
index f70b998..b32caef 100644 (file)
@@ -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
 
index 5970b3b..eb43a86 100755 (executable)
@@ -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"]
 
index 0039bbc..8535613 100755 (executable)
@@ -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