From 0566c20d99d2b6b89d1b6b6b0aed067b43487e38 Mon Sep 17 00:00:00 2001 From: Damian Dabrowski Date: Wed, 19 Jan 2022 23:25:40 +0100 Subject: [PATCH] Add support for both Credential Provider Mechanisms Tempest currently has two different internal methods for providing authentication to tests: dynamic credentials and pre-provisioned credentials. Depending on which one is in use the configuration of Tempest is slightly different. We should provide a support for both of them. https: //docs.openstack.org/tempest/latest/configuration.html#credential-provider-mechanisms Change-Id: I26d69caa3f96a530bc0a4a21365404b1a84e489a --- defaults/main.yml | 9 +++++++++ ...redential-provider-mechanisms-959f7479debbe448.yaml | 3 +++ tasks/tempest_post_install.yml | 8 ++++++++ templates/tempest.conf.j2 | 10 +++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/credential-provider-mechanisms-959f7479debbe448.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 276872b1..506d7d5d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,6 +45,15 @@ tempest_cleanup: no # leftover resources to a dry_run.json file, none resources will be deleted #tempest_cleanup_dry_run: no +# Credential Provider Mechanisms +# If tempest_test_accounts is not an empty string, then use_dynamic_credentials will be turned off +tempest_test_accounts: "" +tempest_test_accounts_file_path: "{{ tempest_workspace }}/etc/tempest_accounts.yaml" +# tempest_create_isolated_networks has an effect only when use_dynamic_credentials is enabled +tempest_create_isolated_networks: true +# tempest_fixed_network_name has an effect only when tempest_create_isolated_networks is disabled +tempest_fixed_network_name: public + # Tempest Resources # Toggle whether default resources are implemented tempest_default_role_resources: yes diff --git a/releasenotes/notes/credential-provider-mechanisms-959f7479debbe448.yaml b/releasenotes/notes/credential-provider-mechanisms-959f7479debbe448.yaml new file mode 100644 index 00000000..5a72ee91 --- /dev/null +++ b/releasenotes/notes/credential-provider-mechanisms-959f7479debbe448.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added a support for both Credential Provider Mechanisms(dynamic credentials and pre-provisioned credentials). diff --git a/tasks/tempest_post_install.yml b/tasks/tempest_post_install.yml index def7a929..4990aabf 100644 --- a/tasks/tempest_post_install.yml +++ b/tasks/tempest_post_install.yml @@ -186,3 +186,11 @@ mode: "0644" when: - tempest_test_excludelist | length > 0 + +- name: Drop test_accounts_file + copy: + content: "{{ tempest_test_accounts }}" + dest: "{{ tempest_test_accounts_file_path }}" + mode: "0644" + when: + - tempest_test_accounts | length > 0 diff --git a/templates/tempest.conf.j2 b/templates/tempest.conf.j2 index 86cbd5fb..e043cbd1 100644 --- a/templates/tempest.conf.j2 +++ b/templates/tempest.conf.j2 @@ -8,11 +8,17 @@ log_file = {{ tempest_log_dir}}/tempest.log [auth] +{% if tempest_test_accounts | length > 0 %} +use_dynamic_credentials = False +test_accounts_file = {{ tempest_test_accounts_file_path }} +{% else %} use_dynamic_credentials = True admin_domain_name = Default admin_username = {{ keystone_admin_user_name }} admin_project_name = {{ keystone_admin_tenant_name }} admin_password = {{ keystone_auth_admin_password }} +create_isolated_networks = {{ tempest_create_isolated_networks }} +{% endif %} [baremetal] @@ -24,7 +30,9 @@ image_ref = {{ tempest_glance_image_id_1 }} image_ref_alt = {{ tempest_glance_image_id_2 }} flavor_ref = {{ tempest_nova_flavor_id_1 }} flavor_ref_alt = {{ tempest_nova_flavor_id_2 }} -fixed_network_name = private +{% if not tempest_create_isolated_networks | bool %} +fixed_network_name = {{ tempest_fixed_network_name }} +{% endif %} endpoint_type = {{ tempest_endpoint_type }} build_timeout = 600