Added support for Keystone v3 07/43907/1
authorBertrand Souville <souville@docomolab-euro.com>
Mon, 2 Oct 2017 14:27:15 +0000 (16:27 +0200)
committerGerald Kunzmann <kunzmann@docomolab-euro.com>
Mon, 2 Oct 2017 15:11:33 +0000 (15:11 +0000)
JIRA: PROMISE-80

Modified Promise shim-layer as well

Change-Id: I82340a6af5c3e6056e77323ca5c44ecdf4e109b6
Signed-off-by: Bertrand Souville <souville@docomolab-euro.com>
(cherry picked from commit a8cd506d6759833231b1b8806082d793faf0997a)

promise/test/functest/run_promise_tests.py
source/config/custom-environment-variables.yaml
source/config/functest.yaml
source/promise.yaml
source/schema/opnfv-promise.yang
source/spec/promise-intents.coffee

index ec9cf99..bb43e37 100644 (file)
@@ -70,6 +70,10 @@ def main():
         logger.info("OS_AUTH_URL: %s" % os.environ["OS_AUTH_URL"])
         logger.info("OS_IDENTITY_API_VERSION: %s " %
                     os.environ["OS_IDENTITY_API_VERSION"])
+        logger.info("OS_USER_DOMAIN_NAME: %s" %
+                    os.environ["OS_USER_DOMAIN_NAME"])
+        logger.info("OS_PROJECT_DOMAIN_NAME: %s" %
+                    os.environ["OS_PROJECT_DOMAIN_NAME"])
     except KeyError:
         logger.error("Please set the OS environment variables")
 
@@ -171,7 +175,7 @@ def main():
     os.environ["OS_TEST_IMAGE"] = image_id
     os.environ["OS_TEST_FLAVOR"] = flavor_id
     os.environ["OS_TEST_NETWORK"] = network_dic["net_id"]
-    os.environ["OS_TENANT_NAME"] = PROMISE_TENANT_NAME
+    os.environ["OS_PROJECT_NAME"] = PROMISE_PROJECT_NAME
     os.environ["OS_USERNAME"] = PROMISE_USER_NAME
 
     os.chdir(PROMISE_REPO_DIR + '/source/')
index 30a72d2..001e799 100644 (file)
@@ -11,11 +11,13 @@ openstack:
   auth:
     endpoint: OS_AUTH_URL
     strategy: OS_AUTH_STRATEGY
-    tenant:
-      id: OS_TENANT_ID
-      name: OS_TENANT_NAME
+    project:
+      id: OS_PROJECT_ID
+      name: OS_PROJECT_NAME
+      domain-name: OS_PROJECT_DOMAIN_NAME
     username: OS_USERNAME
     password: OS_PASSWORD
+    user-domain-name: OS_USER_DOMAIN_NAME
   test:
     image:  OS_TEST_IMAGE
     flavor: OS_TEST_FLAVOR
index 8cc84d3..6655fc4 100644 (file)
@@ -5,5 +5,5 @@ opnfv-functest:
     images:
       -
         name: cirros
-        path: /home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img
+        path: /home/opnfv/functest/images/cirros-0.3.5-x86_64-disk.img
 
index be12082..98dcdc4 100644 (file)
@@ -255,7 +255,7 @@ complex-type:
         services.forEach (service) =>
           switch service.type
             when 'compute'
-              url = service.endpoints[0].publicURL
+              url = service.endpoints[0].url
               @set 'services.compute.endpoint', url
               request
                 .get "#{url}/limits"
index b606382..9ee7564 100644 (file)
@@ -620,9 +620,11 @@ module opnfv-promise {
           default "http://localhost:5000/v2.0";
         }
       }
-      container tenant {
+      leaf user-domain-name { type string; }
+      container project {
         leaf id { type string; }
         leaf name { type string; }
+        leaf domain-name { type string; }
       }
     }
     output {
index afb0e24..4fad0b1 100644 (file)
@@ -320,9 +320,19 @@ module.exports =
       payload = switch input.get 'provider-type'
         when 'openstack'
           auth:
-            tenantId: input.get 'tenant.id'
-            tenantName: input.get 'tenant.name'
-            passwordCredentials: input.get 'username', 'password'
+            identity: 
+               methods: [ "password" ]
+               password:
+                  user:
+                     name: input.get 'username'
+                     password: input.get 'password'
+                     domain:
+                        name: input.get 'user-domain-name'
+            scope:
+               project:
+                  name: input.get 'project.name'
+                  domain:
+                     name: input.get 'project.domain-name'
 
       unless payload?
         return done 'Sorry, only openstack supported at this time'
@@ -330,7 +340,7 @@ module.exports =
       url = input.get 'endpoint'
       switch input.get 'strategy'
         when 'keystone', 'oauth'
-          url += '/tokens' unless /\/tokens$/.test url
+          url += '/auth/tokens' unless /\/tokens$/.test url
 
       providers = @access 'promise.providers'
       request
@@ -340,11 +350,12 @@ module.exports =
         .end (err, res) =>
           if err? or !res.ok then return done res.error
           #console.log JSON.stringify res.body, null, 2
-          access = res.body.access
+          console.log res.headers
+          console.log res.body.token.catalog
           provider = @create 'ResourceProvider',
-            token: access?.token?.id
-            name: access?.token?.tenant?.name
-          provider.invoke 'update', access.serviceCatalog
+            token: res.headers['x-subject-token']
+            name: res.body.token.project.name
+          provider.invoke 'update', res.body.token.catalog
           .then (res) ->
             res.save()
             .then ->