From 91bb6db6860a185f8fd4ecb89a8d625913523d34 Mon Sep 17 00:00:00 2001 From: stewie925 Date: Tue, 30 Oct 2018 16:04:08 -0700 Subject: [PATCH] Ranger tempest changes: - rename orm to ranger - update tempest-plugin to point to keystone v3 instead of v2 - update tempest_setup/tempest.conf Change-Id: I8c3bce9abf7087d3f0531b278323bf9764d30971 --- .../ranger_tempest_plugin/clients.py | 16 ++++---- .../ranger_tempest_plugin/config.py | 8 ++-- .../services/base_client.py | 11 ++--- .../services/cms_client.py | 4 +- .../services/fms_client.py | 4 +- .../services/ims_client.py | 4 +- .../services/rms_client.py | 4 +- .../ranger_tempest_plugin/tests/api/base.py | 6 +-- .../tests/api/cms_base.py | 2 +- .../tests/api/fms_base.py | 20 +++++----- ranger-tempest-plugin/setup.cfg | 2 +- .../tempest_setup/tempest.conf | 40 +++++++++++-------- 12 files changed, 64 insertions(+), 57 deletions(-) diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/clients.py b/ranger-tempest-plugin/ranger_tempest_plugin/clients.py index b3147ea5..a2798ae0 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/clients.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/clients.py @@ -29,19 +29,19 @@ class OrmClientManager(clients.Manager): def __init__(self, credentials=None): super(OrmClientManager, self).__init__(credentials) - self.cms_client = CmsClient(base_client.OrmAuthProvider(credentials), + self.cms_client = CmsClient(base_client.RangerAuthProvider(credentials), CONF.identity.catalog_type, CONF.identity.region, - CONF.orm.uri) - self.fms_client = FmsClient(base_client.OrmAuthProvider(credentials), + CONF.ranger.uri) + self.fms_client = FmsClient(base_client.RangerAuthProvider(credentials), CONF.identity.catalog_type, CONF.identity.region, - CONF.orm.uri) - self.rms_client = RmsClient(base_client.OrmAuthProvider(credentials), + CONF.ranger.uri) + self.rms_client = RmsClient(base_client.RangerAuthProvider(credentials), CONF.identity.catalog_type, CONF.identity.region, - CONF.orm.uri) - self.ims_client = ImsClient(base_client.OrmAuthProvider(credentials), + CONF.ranger.uri) + self.ims_client = ImsClient(base_client.RangerAuthProvider(credentials), CONF.identity.catalog_type, CONF.identity.region, - CONF.orm.uri) + CONF.ranger.uri) diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/config.py b/ranger-tempest-plugin/ranger_tempest_plugin/config.py index 5b1efec3..dd960f57 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/config.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/config.py @@ -22,13 +22,13 @@ service_available_group = cfg.OptGroup( ) ServiceAvailableGroup = [ - cfg.BoolOpt("orm", default=False, - help="Whether or not orm is expected to be available") + cfg.BoolOpt("ranger", default=False, + help="Whether or not ranger is expected to be available") ] orm_group = cfg.OptGroup( - name="orm", - title="Orm Service option" + name="ranger", + title="Ranger Service option" ) OrmGroup = [ diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/services/base_client.py b/ranger-tempest-plugin/ranger_tempest_plugin/services/base_client.py index f6832a49..769d7843 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/services/base_client.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/services/base_client.py @@ -22,7 +22,7 @@ from tempest.lib.common import rest_client CONF = config.CONF -class OrmClientBase(rest_client.RestClient): +class RangerClientBase(rest_client.RestClient): def get_headers(self): headers = {'X-Auth-Region': CONF.identity.region, @@ -66,17 +66,18 @@ class OrmClientBase(rest_client.RestClient): return resp, body -class OrmAuthProvider(auth.KeystoneV2AuthProvider): +class RangerAuthProvider(auth.KeystoneV3AuthProvider): - def __init__(self, credentials, auth_url=CONF.identity.uri): - super(OrmAuthProvider, self).__init__(credentials, auth_url) + def __init__(self, credentials, auth_url=CONF.identity.uri_v3): + super(RangerAuthProvider, self).__init__(credentials, auth_url) def auth_request(self, method, url, headers=None, body=None, filters=None): filters = {'service': 'identity'} - auth_headers = super(OrmAuthProvider, + auth_headers = super(RangerAuthProvider, self).auth_request(method, url, filters=filters) + base_headers = auth_headers[1] base_headers.update(headers) auth_req = dict(url=url, headers=base_headers, body=body) diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/services/cms_client.py b/ranger-tempest-plugin/ranger_tempest_plugin/services/cms_client.py index a2bb62d1..67fad4c9 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/services/cms_client.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/services/cms_client.py @@ -24,9 +24,9 @@ from tempest import config CONF = config.CONF -class CmsClient(base_client.OrmClientBase): +class CmsClient(base_client.RangerClientBase): - cms_url = '%s:%s' % (CONF.orm.uri, CONF.orm.cms_port) + cms_url = '%s:%s' % (CONF.ranger.uri, CONF.ranger.cms_port) version = 'v1' # POST diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/services/fms_client.py b/ranger-tempest-plugin/ranger_tempest_plugin/services/fms_client.py index 26779ef2..e7c654f2 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/services/fms_client.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/services/fms_client.py @@ -24,9 +24,9 @@ from tempest.lib.common import rest_client CONF = config.CONF -class FmsClient(base_client.OrmClientBase): +class FmsClient(base_client.RangerClientBase): - fms_url = '%s:%s' % (CONF.orm.uri, CONF.orm.fms_port) + fms_url = '%s:%s' % (CONF.ranger.uri, CONF.ranger.fms_port) version = "v1" def get_extra_headers(self): diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/services/ims_client.py b/ranger-tempest-plugin/ranger_tempest_plugin/services/ims_client.py index 75537629..4aba519a 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/services/ims_client.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/services/ims_client.py @@ -22,9 +22,9 @@ from tempest import config CONF = config.CONF -class ImsClient(base_client.OrmClientBase): +class ImsClient(base_client.RangerClientBase): - ims_url = '%s:%s' % (CONF.orm.uri, CONF.orm.ims_port) + ims_url = '%s:%s' % (CONF.ranger.uri, CONF.ranger.ims_port) version = "v1" def get_headers(self): diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/services/rms_client.py b/ranger-tempest-plugin/ranger_tempest_plugin/services/rms_client.py index 55096fba..0d0f1a71 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/services/rms_client.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/services/rms_client.py @@ -25,9 +25,9 @@ from tempest import config CONF = config.CONF -class RmsClient(base_client.OrmClientBase): +class RmsClient(base_client.RangerClientBase): - rms_url = '%s:%s' % (CONF.orm.uri, CONF.orm.region_port) + rms_url = '%s:%s' % (CONF.ranger.uri, CONF.ranger.region_port) version = "v2" def create_region(self, region_id, **kwargs): diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/base.py b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/base.py index 9427fbf5..9aade0d0 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/base.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/base.py @@ -36,13 +36,13 @@ class BaseOrmTest(test.BaseTestCase): @classmethod def setup_clients(cls): super(BaseOrmTest, cls).setup_clients() - cls.identity_client = cls.os_admin.tenants_client + cls.identity_client = cls.os_admin.projects_client @classmethod def skip_checks(cls): super(BaseOrmTest, cls).skip_checks() - if not CONF.service_available.orm: - skip_msg = ("%s skipped as orm is not available" % cls.__name__) + if not CONF.service_available.ranger: + skip_msg = ("%s skipped as ranger is not available" % cls.__name__) raise cls.skipException(skip_msg) def assertExpected(self, expected, actual, excluded_keys): diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/cms_base.py b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/cms_base.py index 1b4c8fe1..3fa620db 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/cms_base.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/cms_base.py @@ -304,7 +304,7 @@ class CmsBaseOrmTest(base.BaseOrmTest): @classmethod def _validate_customer_deletion_on_lcp(cls, customer_id): - body = cls.identity_client.list_tenants()["tenants"] + body = cls.identity_client.list_projects()["projects"] customer_ids = [customer["id"] for customer in body if customer["id"] == customer_id] diff --git a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/fms_base.py b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/fms_base.py index b627f801..d36f4df5 100755 --- a/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/fms_base.py +++ b/ranger-tempest-plugin/ranger_tempest_plugin/tests/api/fms_base.py @@ -38,10 +38,10 @@ class FmsBaseOrmTest(base.BaseOrmTest): super(FmsBaseOrmTest, cls).setup_clients() cls.client = cls.os_primary.fms_client cls.flavors_client = cls.os_admin.flavors_client - cls.tenant_id = cls._get_tenant_id( - cls.os_primary.credentials.tenant_name) - cls.alt_tenant_id = cls._get_tenant_id( - cls.os_alt.credentials.tenant_name) + cls.tenant_id = cls._get_project_id( + cls.os_primary.credentials.project_name) + cls.alt_tenant_id = cls._get_project_id( + cls.os_alt.credentials.project_name) @classmethod def _get_flavor_params(cls, set_region=True, single_tenant=True): @@ -230,12 +230,12 @@ class FmsBaseOrmTest(base.BaseOrmTest): raise exceptions.TempestException(message) @classmethod - def _get_tenant_id(cls, tenant_name): - body = cls.identity_client.list_tenants() - for tenant in body["tenants"]: - if(tenant["name"] == tenant_name): - return tenant["id"] - message = ('tenant %s not found on tenant list' % cls.tenant_name) + def _get_project_id(cls, project_name): + body = cls.identity_client.list_projects() + for project in body["projects"]: + if(project["name"] == project_name): + return project["id"] + message = ('project %s not found on projects list' % project_name) raise exceptions.TempestException(message) @classmethod diff --git a/ranger-tempest-plugin/setup.cfg b/ranger-tempest-plugin/setup.cfg index 5a3466c1..9576abcb 100755 --- a/ranger-tempest-plugin/setup.cfg +++ b/ranger-tempest-plugin/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = ranger-tempest-plugin version = 0.0.1 -summary = Basic Tempest plugin for Orm with a mos tempest smoke test case +summary = Basic Tempest plugin for Ranger with a mos tempest smoke test case description-file = author = author-email = diff --git a/ranger-tempest-plugin/tempest_setup/tempest.conf b/ranger-tempest-plugin/tempest_setup/tempest.conf index 6f7088a6..1aa0dc08 100644 --- a/ranger-tempest-plugin/tempest_setup/tempest.conf +++ b/ranger-tempest-plugin/tempest_setup/tempest.conf @@ -4,17 +4,20 @@ log_file = tempest.log log_dir = /var/log [auth] -test_accounts_file = /tempest/etc/accounts.yaml +test_accounts_file = /opt/stack/tempest/etc/accounts.yaml use_dynamic_credentials = true tempest_roles = admin admin_username = admin admin_project_name = admin -admin_password = nomoresecrete +# set admin_password as appropriate +admin_password = password admin_domain_name = Default + [compute] -image_ref = 199668fa-0cd4-4b84-92cb-f5c87a16628a -image_ref_alt = 199668fa-0cd4-4b84-92cb-f5c87a16628a +# uncomment image_ref and image_ref_alt and set their values accordingly +# image_ref = +# image_ref_alt = flavor_ref = 1 flavor_ref_alt = 84 fixed_network_name = public @@ -31,16 +34,17 @@ scheduler_available_filters = all [identity] disable_ssl_certificate_validation = false ca_certificates_file = /etc/ssl/certs/ca-certificates.crt -uri = http://192.168.56.107:5000/v2.0 -uri_v3 = http://192.168.56.107:5000/v3.0 -auth_version = v2 -# region = RegionOne -region = local +# change uri and uri_v3 IP address as needed +uri = http://127.0.0.1:5000/v2.0 +uri_v3 = http://127.0.0.1:5000/v3 +auth_version = v3 +# set region value accordingly +region = admin_role = admin [identity-feature-enabled] -api_v2 = true -api_v2_admin = true +api_v2 = false +api_v2_admin = false api_v3 = true api_extensions = all @@ -48,7 +52,8 @@ api_extensions = all deactivate_image = true [network] -public_network_id = 6953ce50-6ea3-4091-8f68-fd7b0c5fdcd3 +# set public_network_id to 'openstack network list | grep public' ID value +public_network_id = floating_network_name = public [network-feature-enabled] @@ -86,9 +91,8 @@ s3 = true glance = true neutron = true nova = true -ord = true nova_ec2 = true -orm = true +ranger = true contrail = true mistral = true @@ -96,7 +100,8 @@ mistral = true run_validation = true connect_method = floating image_ssh_user = cirros -image_ssh_password = cubswin:) +# set image_ssh_password as appropriate +image_ssh_password = password [volume] backend_names = SOLIDFIRE @@ -105,6 +110,7 @@ storage_protocol = iSCSI [volume-feature-enabled] multi_backend = false -[orm] +[ranger] +# change uri IP address as needed uri = http://127.0.0.1 -catalog_type = orm +catalog_type = ranger