Add oslo.messaging notitication related options

Add an ability to configure olso.messaging notification related options:
driver, transport_url and topics

Change-Id: If8bf8c2d183d6a849b92f0d277866769e5beafc3
This commit is contained in:
Sergey Kolekonov 2016-05-04 17:59:18 +03:00
parent 56d2a46738
commit 24e5df42eb
3 changed files with 47 additions and 0 deletions

View File

@ -254,6 +254,20 @@
# in the neutron config.
# Defaults to false.
#
# [*notification_driver*]
# (optional) Driver or drivers to handle sending notifications.
# Value can be a string or a list.
# Defaults to $::os_service_default.
#
# [*notification_topics*]
# (optional) AMQP topic used for OpenStack notifications
# Defaults to ::os_service_default
#
# [*notification_transport_url*]
# (optional) A URL representing the messaging driver to use for
# notifications.
# Defaults to $::os_service_default.
#
# DEPRECATED PARAMETERS
#
# [*network_device_mtu*]
@ -315,6 +329,9 @@ class neutron (
$state_path = $::os_service_default,
$lock_path = '$state_path/lock',
$purge_config = false,
$notification_driver = $::os_service_default,
$notification_topics = $::os_service_default,
$notification_transport_url = $::os_service_default,
# DEPRECATED PARAMETERS
$network_device_mtu = undef,
) {
@ -405,6 +422,12 @@ class neutron (
oslo::concurrency { 'neutron_config': lock_path => $lock_path }
oslo::messaging::notifications { 'neutron_config':
driver => $notification_driver,
topics => $notification_topics,
transport_url => $notification_transport_url,
}
if ! is_service_default ($service_plugins) and ($service_plugins) {
if is_array($service_plugins) {
neutron_config { 'DEFAULT/service_plugins': value => join($service_plugins, ',') }

View File

@ -0,0 +1,3 @@
---
features:
- Add oslo.messaging notitications related options

View File

@ -44,6 +44,13 @@ describe 'neutron' do
it_configures 'rabbit_ha_queues set to false'
end
context 'with non-default notification options' do
before { params.merge!( :notification_driver => 'messagingv2',
:notification_topics => 'notifications',
:notification_transport_url => 'rabbit://me:passwd@host:5672/virtual_host' ) }
it_configures 'notification_driver and notification_topics'
end
it 'configures logging' do
is_expected.to contain_neutron_config('DEFAULT/log_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/log_dir').with_value(params[:log_dir])
@ -99,6 +106,12 @@ describe 'neutron' do
})
end
it 'configures messaging notifications' do
is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
end
it 'configures credentials for rabbit' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_userid').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
@ -174,6 +187,14 @@ describe 'neutron' do
end
end
shared_examples_for 'notification_driver and notification_topics' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value( params[:notification_driver] )
is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value( params[:notification_topics] )
is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value( params[:notification_transport_url] )
end
end
shared_examples_for 'with SSL socket options set' do
before do
params.merge!(