Merge "Remove redundant neutron_ from parameter names"

This commit is contained in:
Zuul 2020-02-24 20:17:37 +00:00 committed by Gerrit Code Review
commit 37369c64c1
3 changed files with 285 additions and 78 deletions

View File

@ -4,62 +4,62 @@
#
# === Parameters:
#
# [*neutron_password*]
# [*password*]
# (required) Password for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
#
# [*neutron_auth_type*]
# [*auth_type*]
# Name of the auth type to load (string value)
# Defaults to 'v3password'
#
# [*neutron_project_name*]
# [*project_name*]
# (optional) Project name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to 'services'
#
# [*neutron_project_domain_name*]
# [*project_domain_name*]
# (optional) Project Domain name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*neutron_username*]
# [*username*]
# (optional) Username for connecting to Neutron network services in admin context
# through the OpenStack Identity service.
# Defaults to 'neutron'
#
# [*neutron_user_domain_name*]
# [*user_domain_name*]
# (optional) User Domain name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*neutron_auth_url*]
# [*auth_url*]
# (optional) Points to the OpenStack Identity server IP and port.
# This is the Identity (keystone) admin API server IP and port value,
# and not the Identity service API IP and port.
# Defaults to 'http://127.0.0.1:5000/v3'
#
# [*neutron_valid_interfaces*]
# [*valid_interfaces*]
# (optional) The endpoint type to lookup when talking to Neutron.
# Defaults to $::os_service_default
#
# [*neutron_endpoint_override*]
# [*endpoint_override*]
# (optional) Override the endpoint to use to talk to Neutron.
# Defaults to $::os_service_default
#
# [*neutron_timeout*]
# [*timeout*]
# (optional) Timeout value for connecting to neutron in seconds.
# Defaults to '30'
#
# [*neutron_region_name*]
# [*region_name*]
# (optional) Region name for connecting to neutron in admin context
# through the OpenStack Identity service.
# Defaults to 'RegionOne'
#
# [*neutron_ovs_bridge*]
# [*ovs_bridge*]
# (optional) Name of Integration Bridge used by Open vSwitch
# Defaults to 'br-int'
#
# [*neutron_extension_sync_interval*]
# [*extension_sync_interval*]
# (optional) Number of seconds before querying neutron for extensions
# Defaults to '600'
#
@ -79,44 +79,210 @@
# (optional) Default pool for floating IPs
# Defaults to 'nova'
#
# DEPRECATED
#
# [*neutron_password*]
# (optional) Password for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_auth_type*]
# Name of the auth type to load (string value)
# Defaults to undef
#
# [*neutron_project_name*]
# (optional) Project name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_project_domain_name*]
# (optional) Project Domain name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_username*]
# (optional) Username for connecting to Neutron network services in admin context
# through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_user_domain_name*]
# (optional) User Domain name for connecting to Neutron network services in
# admin context through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_auth_url*]
# (optional) Points to the OpenStack Identity server IP and port.
# This is the Identity (keystone) admin API server IP and port value,
# and not the Identity service API IP and port.
# Defaults to undef
#
# [*neutron_valid_interfaces*]
# (optional) The endpoint type to lookup when talking to Neutron.
# Defaults to undef
#
# [*neutron_endpoint_override*]
# (optional) Override the endpoint to use to talk to Neutron.
# Defaults to undef
#
# [*neutron_timeout*]
# (optional) Timeout value for connecting to neutron in seconds.
# Defaults to undef
#
# [*neutron_region_name*]
# (optional) Region name for connecting to neutron in admin context
# through the OpenStack Identity service.
# Defaults to undef
#
# [*neutron_ovs_bridge*]
# (optional) Name of Integration Bridge used by Open vSwitch
# Defaults to undef
#
# [*neutron_extension_sync_interval*]
# (optional) Number of seconds before querying neutron for extensions
# Defaults to undef
#
class nova::network::neutron (
$neutron_password = false,
$neutron_auth_type = 'v3password',
$neutron_project_name = 'services',
$neutron_project_domain_name = 'Default',
$neutron_username = 'neutron',
$neutron_user_domain_name = 'Default',
$neutron_auth_url = 'http://127.0.0.1:5000/v3',
$neutron_valid_interfaces = $::os_service_default,
$neutron_endpoint_override = $::os_service_default,
$neutron_timeout = '30',
$neutron_region_name = 'RegionOne',
$neutron_ovs_bridge = 'br-int',
$neutron_extension_sync_interval = '600',
$password = false,
$auth_type = 'v3password',
$project_name = 'services',
$project_domain_name = 'Default',
$username = 'neutron',
$user_domain_name = 'Default',
$auth_url = 'http://127.0.0.1:5000/v3',
$valid_interfaces = $::os_service_default,
$endpoint_override = $::os_service_default,
$timeout = '30',
$region_name = 'RegionOne',
$ovs_bridge = 'br-int',
$extension_sync_interval = '600',
$vif_plugging_is_fatal = true,
$vif_plugging_timeout = '300',
$default_floating_pool = 'nova',
#DEPRECATED
$neutron_password = undef,
$neutron_auth_type = undef,
$neutron_project_name = undef,
$neutron_project_domain_name = undef,
$neutron_username = undef,
$neutron_user_domain_name = undef,
$neutron_auth_url = undef,
$neutron_valid_interfaces = undef,
$neutron_endpoint_override = undef,
$neutron_timeout = undef,
$neutron_region_name = undef,
$neutron_ovs_bridge = undef,
$neutron_extension_sync_interval = undef,
) {
include nova::deps
if $neutron_password != undef {
warning('The neutron_password parameter was deprecated. Use password instead')
$password_real = $neutron_password
} else {
$password_real = $password
}
if $neutron_auth_type != undef {
warning('The neutron_auth_type parameter was deprecated. Use auth_type instead')
$auth_type_real = $neutron_auth_type
} else {
$auth_type_real = $auth_type
}
if $neutron_project_name != undef {
warning('The neutron_project_name parameter was deprecated. Use project_name instead')
$project_name_real = $neutron_project_name
} else {
$project_name_real = $project_name
}
if $neutron_project_domain_name != undef {
warning('The neutron_project_domain_name parameter was deprecated. Use project_domain_name instead')
$project_domain_name_real = $neutron_project_domain_name
} else {
$project_domain_name_real = $project_domain_name
}
if $neutron_username != undef {
warning('The neutron_username parameter was deprecated. Use username instead')
$username_real = $neutron_username
} else {
$username_real = $username
}
if $neutron_user_domain_name != undef {
warning('The neutron_user_domain_name parameter was deprecated. Use user_domain_name_name instead')
$user_domain_name_real = $neutron_user_domain_name
} else {
$user_domain_name_real = $user_domain_name
}
if $neutron_auth_url != undef {
warning('The neutron_auth_url parameter was deprecated. Use auth_url instead')
$auth_url_real = $neutron_auth_url
} else {
$auth_url_real = $auth_url
}
if $neutron_valid_interfaces != undef {
warning('The neutron_valid_interfaces parameter was deprecated. Use valid_interfaces instead')
$valid_interfaces_real = $neutron_valid_interfaces
} else {
$valid_interfaces_real = $valid_interfaces
}
if $neutron_endpoint_override != undef {
warning('The neutron_endpoint_override parameter was deprecated. Use endpoint_override instead')
$endpoint_override_real = $neutron_endpoint_override
} else {
$endpoint_override_real = $endpoint_override
}
if $neutron_timeout != undef {
warning('The neutron_timeout parameter was deprecated. Use timeout instead')
$timeout_real = $neutron_timeout
} else {
$timeout_real = $timeout
}
if $neutron_region_name != undef {
warning('The neutron_region_name parameter was deprecated. Use region_name instead')
$region_name_real = $neutron_region_name
} else {
$region_name_real = $region_name
}
if $neutron_ovs_bridge != undef {
warning('The neutron_ovs_bridge parameter was deprecated. Use ovs_bridge instead')
$ovs_bridge_real = $neutron_ovs_bridge
} else {
$ovs_bridge_real = $ovs_bridge
}
if $neutron_extension_sync_interval != undef {
warning('The neutron_extension_sync_interval parameter was deprecated. Use extension_sync_interval instead')
$extension_sync_interval_real = $neutron_extension_sync_interval
} else {
$extension_sync_interval_real = $extension_sync_interval
}
nova_config {
'DEFAULT/vif_plugging_is_fatal': value => $vif_plugging_is_fatal;
'DEFAULT/vif_plugging_timeout': value => $vif_plugging_timeout;
'neutron/default_floating_pool': value => $default_floating_pool;
'neutron/timeout': value => $neutron_timeout;
'neutron/project_name': value => $neutron_project_name;
'neutron/project_domain_name': value => $neutron_project_domain_name;
'neutron/region_name': value => $neutron_region_name;
'neutron/username': value => $neutron_username;
'neutron/user_domain_name': value => $neutron_user_domain_name;
'neutron/password': value => $neutron_password, secret => true;
'neutron/auth_url': value => $neutron_auth_url;
'neutron/valid_interfaces': value => $neutron_valid_interfaces;
'neutron/endpoint_override': value => $neutron_endpoint_override;
'neutron/ovs_bridge': value => $neutron_ovs_bridge;
'neutron/extension_sync_interval': value => $neutron_extension_sync_interval;
'neutron/auth_type': value => $neutron_auth_type;
'neutron/timeout': value => $timeout_real;
'neutron/project_name': value => $project_name_real;
'neutron/project_domain_name': value => $project_domain_name_real;
'neutron/region_name': value => $region_name_real;
'neutron/username': value => $username_real;
'neutron/user_domain_name': value => $user_domain_name_real;
'neutron/password': value => $password_real, secret => true;
'neutron/auth_url': value => $auth_url_real;
'neutron/valid_interfaces': value => $valid_interfaces_real;
'neutron/endpoint_override': value => $endpoint_override_real;
'neutron/ovs_bridge': value => $ovs_bridge_real;
'neutron/extension_sync_interval': value => $extension_sync_interval_real;
'neutron/auth_type': value => $auth_type_real;
}
}

View File

@ -0,0 +1,6 @@
---
features:
- |
The parameters prefixed with neutron in nova::network::neutron class were
deprecated, to be replaced by the shortened parameters without neutron
prefix.

View File

@ -3,47 +3,47 @@ require 'spec_helper'
describe 'nova::network::neutron' do
let :default_params do
{
:neutron_auth_type => 'v3password',
:neutron_timeout => '30',
:neutron_project_name => 'services',
:neutron_project_domain_name => 'Default',
:neutron_region_name => 'RegionOne',
:neutron_username => 'neutron',
:neutron_user_domain_name => 'Default',
:neutron_auth_url => 'http://127.0.0.1:5000/v3',
:neutron_valid_interfaces => '<SERVICE DEFAULT>',
:neutron_endpoint_override => '<SERVICE DEFAULT>',
:neutron_ovs_bridge => 'br-int',
:neutron_extension_sync_interval => '600',
:vif_plugging_is_fatal => true,
:vif_plugging_timeout => '300',
:default_floating_pool => 'nova',
:auth_type => 'v3password',
:timeout => '30',
:project_name => 'services',
:project_domain_name => 'Default',
:region_name => 'RegionOne',
:username => 'neutron',
:user_domain_name => 'Default',
:auth_url => 'http://127.0.0.1:5000/v3',
:valid_interfaces => '<SERVICE DEFAULT>',
:endpoint_override => '<SERVICE DEFAULT>',
:ovs_bridge => 'br-int',
:extension_sync_interval => '600',
:vif_plugging_is_fatal => true,
:vif_plugging_timeout => '300',
:default_floating_pool => 'nova',
}
end
let :params do
{
:neutron_password => 's3cr3t'
:password => 's3cr3t'
}
end
shared_examples 'nova::network::neutron' do
context 'with required parameters' do
it 'configures neutron endpoint in nova.conf' do
should contain_nova_config('neutron/password').with_value(params[:neutron_password]).with_secret(true)
should contain_nova_config('neutron/password').with_value(params[:password]).with_secret(true)
should contain_nova_config('neutron/default_floating_pool').with_value(default_params[:default_floating_pool])
should contain_nova_config('neutron/auth_type').with_value(default_params[:neutron_auth_type])
should contain_nova_config('neutron/timeout').with_value(default_params[:neutron_timeout])
should contain_nova_config('neutron/project_name').with_value(default_params[:neutron_project_name])
should contain_nova_config('neutron/project_domain_name').with_value(default_params[:neutron_project_domain_name])
should contain_nova_config('neutron/region_name').with_value(default_params[:neutron_region_name])
should contain_nova_config('neutron/username').with_value(default_params[:neutron_username])
should contain_nova_config('neutron/user_domain_name').with_value(default_params[:neutron_user_domain_name])
should contain_nova_config('neutron/auth_url').with_value(default_params[:neutron_auth_url])
should contain_nova_config('neutron/valid_interfaces').with_value(default_params[:neutron_valid_interfaces])
should contain_nova_config('neutron/endpoint_override').with_value(default_params[:neutron_endpoint_override])
should contain_nova_config('neutron/extension_sync_interval').with_value(default_params[:neutron_extension_sync_interval])
should contain_nova_config('neutron/ovs_bridge').with_value(default_params[:neutron_ovs_bridge])
should contain_nova_config('neutron/auth_type').with_value(default_params[:auth_type])
should contain_nova_config('neutron/timeout').with_value(default_params[:timeout])
should contain_nova_config('neutron/project_name').with_value(default_params[:project_name])
should contain_nova_config('neutron/project_domain_name').with_value(default_params[:project_domain_name])
should contain_nova_config('neutron/region_name').with_value(default_params[:region_name])
should contain_nova_config('neutron/username').with_value(default_params[:username])
should contain_nova_config('neutron/user_domain_name').with_value(default_params[:user_domain_name])
should contain_nova_config('neutron/auth_url').with_value(default_params[:auth_url])
should contain_nova_config('neutron/valid_interfaces').with_value(default_params[:valid_interfaces])
should contain_nova_config('neutron/endpoint_override').with_value(default_params[:endpoint_override])
should contain_nova_config('neutron/extension_sync_interval').with_value(default_params[:extension_sync_interval])
should contain_nova_config('neutron/ovs_bridge').with_value(default_params[:ovs_bridge])
end
it 'configures neutron vif plugging events in nova.conf' do
@ -55,6 +55,50 @@ describe 'nova::network::neutron' do
context 'when overriding class parameters' do
before do
params.merge!(
:timeout => '30',
:project_name => 'openstack',
:project_domain_name => 'openstack_domain',
:region_name => 'RegionTwo',
:username => 'neutron2',
:user_domain_name => 'neutron_domain',
:auth_url => 'http://10.0.0.1:5000/v2',
:valid_interfaces => 'public',
:endpoint_override => 'http://127.0.0.1:9696',
:ovs_bridge => 'br-int',
:extension_sync_interval => '600',
:vif_plugging_is_fatal => false,
:vif_plugging_timeout => '0',
:default_floating_pool => 'public'
)
end
it 'configures neutron endpoint in nova.conf' do
should contain_nova_config('neutron/password').with_value(params[:password]).with_secret(true)
should contain_nova_config('neutron/default_floating_pool').with_value(params[:default_floating_pool])
should contain_nova_config('neutron/timeout').with_value(params[:timeout])
should contain_nova_config('neutron/project_name').with_value(params[:project_name])
should contain_nova_config('neutron/project_domain_name').with_value(params[:project_domain_name])
should contain_nova_config('neutron/region_name').with_value(params[:region_name])
should contain_nova_config('neutron/username').with_value(params[:username])
should contain_nova_config('neutron/user_domain_name').with_value(params[:user_domain_name])
should contain_nova_config('neutron/auth_url').with_value(params[:auth_url])
should contain_nova_config('neutron/valid_interfaces').with_value(params[:valid_interfaces])
should contain_nova_config('neutron/endpoint_override').with_value(params[:endpoint_override])
should contain_nova_config('neutron/extension_sync_interval').with_value(params[:extension_sync_interval])
should contain_nova_config('neutron/ovs_bridge').with_value(params[:ovs_bridge])
end
it 'configures neutron vif plugging events in nova.conf' do
should contain_nova_config('DEFAULT/vif_plugging_is_fatal').with_value(params[:vif_plugging_is_fatal])
should contain_nova_config('DEFAULT/vif_plugging_timeout').with_value(params[:vif_plugging_timeout])
end
end
context 'when overriding deprecated class parameters' do
before do
params.merge!(
:password => false,
:neutron_password => 's3cr3t',
:neutron_timeout => '30',
:neutron_project_name => 'openstack',
:neutron_project_domain_name => 'openstack_domain',
@ -66,15 +110,11 @@ describe 'nova::network::neutron' do
:neutron_endpoint_override => 'http://127.0.0.1:9696',
:neutron_ovs_bridge => 'br-int',
:neutron_extension_sync_interval => '600',
:vif_plugging_is_fatal => false,
:vif_plugging_timeout => '0',
:default_floating_pool => 'public'
)
end
it 'configures neutron endpoint in nova.conf' do
should contain_nova_config('neutron/password').with_value(params[:neutron_password]).with_secret(true)
should contain_nova_config('neutron/default_floating_pool').with_value(params[:default_floating_pool])
should contain_nova_config('neutron/timeout').with_value(params[:neutron_timeout])
should contain_nova_config('neutron/project_name').with_value(params[:neutron_project_name])
should contain_nova_config('neutron/project_domain_name').with_value(params[:neutron_project_domain_name])
@ -87,11 +127,6 @@ describe 'nova::network::neutron' do
should contain_nova_config('neutron/extension_sync_interval').with_value(params[:neutron_extension_sync_interval])
should contain_nova_config('neutron/ovs_bridge').with_value(params[:neutron_ovs_bridge])
end
it 'configures neutron vif plugging events in nova.conf' do
should contain_nova_config('DEFAULT/vif_plugging_is_fatal').with_value(params[:vif_plugging_is_fatal])
should contain_nova_config('DEFAULT/vif_plugging_timeout').with_value(params[:vif_plugging_timeout])
end
end
end