From a8cd506d6759833231b1b8806082d793faf0997a Mon Sep 17 00:00:00 2001 From: Bertrand Souville Date: Mon, 2 Oct 2017 16:27:15 +0200 Subject: Added support for Keystone v3 JIRA: PROMISE-80 Modified Promise shim-layer as well Change-Id: I82340a6af5c3e6056e77323ca5c44ecdf4e109b6 Signed-off-by: Bertrand Souville --- promise/test/functest/run_promise_tests.py | 6 +++++- source/config/custom-environment-variables.yaml | 8 +++++--- source/config/functest.yaml | 2 +- source/promise.yaml | 2 +- source/schema/opnfv-promise.yang | 4 +++- source/spec/promise-intents.coffee | 27 +++++++++++++++++-------- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/promise/test/functest/run_promise_tests.py b/promise/test/functest/run_promise_tests.py index ec9cf99..bb43e37 100644 --- a/promise/test/functest/run_promise_tests.py +++ b/promise/test/functest/run_promise_tests.py @@ -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/') diff --git a/source/config/custom-environment-variables.yaml b/source/config/custom-environment-variables.yaml index 30a72d2..001e799 100644 --- a/source/config/custom-environment-variables.yaml +++ b/source/config/custom-environment-variables.yaml @@ -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 diff --git a/source/config/functest.yaml b/source/config/functest.yaml index 8cc84d3..6655fc4 100644 --- a/source/config/functest.yaml +++ b/source/config/functest.yaml @@ -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 diff --git a/source/promise.yaml b/source/promise.yaml index be12082..98dcdc4 100644 --- a/source/promise.yaml +++ b/source/promise.yaml @@ -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" diff --git a/source/schema/opnfv-promise.yang b/source/schema/opnfv-promise.yang index b606382..9ee7564 100644 --- a/source/schema/opnfv-promise.yang +++ b/source/schema/opnfv-promise.yang @@ -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 { diff --git a/source/spec/promise-intents.coffee b/source/spec/promise-intents.coffee index afb0e24..4fad0b1 100644 --- a/source/spec/promise-intents.coffee +++ b/source/spec/promise-intents.coffee @@ -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 -> -- cgit 1.2.3-korg