Update MidoNet plugin manifest

The MidoNet API no longer exists with that name. We are deprecating its
parameters and replacing them by its counterpart "cluster".

Also the dependency python-networking-midonet-ext package is removed as
this is only needed for the N release. Will be added when backported.

Change-Id: Ia85bc41c05d766f995835941ed5fc46ce5465334
This commit is contained in:
Alejandro Andreu
2017-02-03 12:06:19 +01:00
parent 00b0c01a70
commit 76113ea945
3 changed files with 112 additions and 52 deletions

View File

@@ -7,51 +7,69 @@
# #
# === Parameters # === Parameters
# #
# [*midonet_api_ip*] # [*midonet_cluster_ip*]
# IP address of the MidoNet api service # IP address of the MidoNet Cluster service.
# [*midonet_api_port*] # Defaults to '127.0.0.1'
# IP address of the MidoNet port service. MidoNet runs in a Tomcat, so 8080 #
# is used by default. # [*midonet_cluster_port*]
# Port on which the MidoNet Cluster listens.
# Defaults to '8181'
#
# [*keystone_username*] # [*keystone_username*]
# Username from which midonet api will authenticate against Keystone (neutron # Username with which MidoNet Cluster will authenticate against Keystone.
# service is desirable and defaulted) # Defaults to 'neutron'
#
# [*keystone_password*] # [*keystone_password*]
# Password from which midonet api will authenticate against Keystone # Password for the user that will be used to authenticate against Keystone.
# Defaults to $::os_service_default # Defaults to $::os_service_default
#
# [*keystone_tenant*] # [*keystone_tenant*]
# Tenant from which midonet api will authenticate against Keystone (services # Tenant for the user that will be used to authenticate against Keystone.
# tenant is desirable and defaulted) # Defaults to 'services'
#
# [*sync_db*] # [*sync_db*]
# Whether 'midonet-db-manage' should run to create and/or syncrhonize the database # Whether 'midonet-db-manage' should run to create and/or sync the database
# with MidoNet specific tables. Defaults to false # with MidoNet specific tables.
# Defaults to false
# #
# [*purge_config*] # [*purge_config*]
# (optional) Whether to set only the specified config options # (optional) Whether to set only the specified config options
# in the midonet config. # in the midonet config.
# Defaults to false. # Defaults to false
# #
# [*package_ensure*] # [*package_ensure*]
# Whether to install the latest package, or a version for midonet plugin # Whether to install the latest package, or a specific version
# Defaults to 'present'. # of the MidoNet plugin.
# Defaults to 'present'
#
# DEPRECATED PARAMETERS
#
# [*midonet_api_ip*]
# (DEPRECATED) IP address of the MidoNet API service.
# Defaults to undef
#
# [*midonet_api_port*]
# (DEPRECATED) Port on which the MidoNet API service listens.
# Defaults to undef
# #
# === Examples # === Examples
# #
# An example call would be: # An example call would be:
# #
# class {'neutron:plugins::midonet': # class {'neutron:plugins::midonet':
# midonet_api_ip => '23.123.5.32', # midonet_cluster_ip => '23.123.5.32',
# midonet_api_port => '8080', # midonet_cluster_port => '8181',
# keystone_username => 'neutron', # keystone_username => 'neutron',
# keystone_password => '32kjaxT0k3na', # keystone_password => '32kjaxT0k3na',
# keystone_tenant => 'services', # keystone_tenant => 'services',
# sync_db => true # sync_db => true
# } # }
# #
# You can alternatively use the Hiera's yaml style: # You can alternatively use the Hiera's yaml style:
# neutron::plugin::midonet::midonet_api_ip: '23.213.5.32' # neutron::plugin::midonet::midonet_cluster_ip: '23.213.5.32'
# neutron::plugin::midonet::port: '8080' # neutron::plugin::midonet::port: '8181'
# neutron::plugin::midonet::keystone_username: 'neutron' # neutron::plugin::midonet::keystone_username: 'neutron'
# neutron::plugin::midonet::keystone_password: '32.kjaxT0k3na' # neutron::plugin::midonet::keystone_password: '32kjaxT0k3na'
# neutron::plugin::midonet::keystone_tenant: 'services' # neutron::plugin::midonet::keystone_tenant: 'services'
# neutron::plugin::midonet::sync_db: true # neutron::plugin::midonet::sync_db: true
# #
@@ -76,24 +94,45 @@
# limitations under the License. # limitations under the License.
# #
class neutron::plugins::midonet ( class neutron::plugins::midonet (
$midonet_api_ip = '127.0.0.1', $midonet_cluster_ip = '127.0.0.1',
$midonet_api_port = '8080', $midonet_cluster_port = '8181',
$keystone_username = 'neutron', $keystone_username = 'neutron',
$keystone_password = $::os_service_default, $keystone_password = $::os_service_default,
$keystone_tenant = 'services', $keystone_tenant = 'service',
$sync_db = false, $sync_db = false,
$purge_config = false, $purge_config = false,
$package_ensure = 'present' $package_ensure = 'present',
# DEPRECATED PARAMETERS
$midonet_api_ip = undef,
$midonet_api_port = undef,
) { ) {
include ::neutron::deps include ::neutron::deps
include ::neutron::params include ::neutron::params
ensure_resource('file', '/etc/neutron/plugins/midonet', { if $midonet_api_ip {
ensure => directory, # If we got midonet_api_ip here, display deprecation warning and use this value.
owner => 'root', warning('The midonet_api_ip parameter is going to be removed in future releases. Use the midonet_cluster_ip parameter instead.')
group => 'neutron', $cluster_ip = $midonet_api_ip
mode => '0640'} } else {
$cluster_ip = $midonet_cluster_ip
}
if $midonet_api_port {
# If we got midonet_api_port here, display deprecation warning and use this value.
warning('The midonet_api_port parameter is going to be removed in future releases. Use the midonet_cluster_port parameter instead.')
$cluster_port = $midonet_api_port
} else {
$cluster_port = $midonet_cluster_port
}
ensure_resource('file', '/etc/neutron/plugins/midonet',
{
ensure => directory,
owner => 'root',
group => 'neutron',
mode => '0640'
}
) )
resources { 'neutron_plugin_midonet': resources { 'neutron_plugin_midonet':
@@ -106,14 +145,8 @@ class neutron::plugins::midonet (
tag => ['neutron-package', 'openstack'], tag => ['neutron-package', 'openstack'],
} }
package { 'python-networking-midonet-ext':
ensure => $package_ensure,
name => $::neutron::params::midonet_server_package_ext,
tag => ['neutron-package', 'openstack'],
}
neutron_plugin_midonet { neutron_plugin_midonet {
'MIDONET/midonet_uri': value => "http://${midonet_api_ip}:${midonet_api_port}/midonet-api"; 'MIDONET/midonet_uri': value => "http://${cluster_ip}:${cluster_port}/midonet-api";
'MIDONET/username': value => $keystone_username; 'MIDONET/username': value => $keystone_username;
'MIDONET/password': value => $keystone_password, secret =>true; 'MIDONET/password': value => $keystone_password, secret =>true;
'MIDONET/project_id': value => $keystone_tenant; 'MIDONET/project_id': value => $keystone_tenant;
@@ -143,7 +176,6 @@ class neutron::plugins::midonet (
if $sync_db { if $sync_db {
Package<| title == 'python-networking-midonet' |> ~> Exec['midonet-db-sync'] Package<| title == 'python-networking-midonet' |> ~> Exec['midonet-db-sync']
Package<| title == 'python-networking-midonet-ext' |> ~> Exec['midonet-db-sync']
exec { 'midonet-db-sync': exec { 'midonet-db-sync':
command => 'neutron-db-manage --subproject networking-midonet upgrade head', command => 'neutron-db-manage --subproject networking-midonet upgrade head',
path => '/usr/bin', path => '/usr/bin',

View File

@@ -0,0 +1,6 @@
---
deprecations:
- |
The MidoNet API does not exist anymore. Starting in the MidoNet 5.0 release
the API is now called Cluster. Hence we are deprecating the "midonet_api_*"
parameter in favor of "midonet_cluster_*".

View File

@@ -12,12 +12,12 @@ describe 'neutron::plugins::midonet' do
let :default_params do let :default_params do
{ {
:midonet_api_ip => '127.0.0.1', :midonet_cluster_ip => '127.0.0.1',
:midonet_api_port => '8080', :midonet_cluster_port => '8181',
:keystone_username => 'neutron', :keystone_username => 'neutron',
:keystone_password => 'test_midonet', :keystone_password => 'test_midonet',
:keystone_tenant => 'services', :keystone_tenant => 'services',
:purge_config => false, :purge_config => false,
} }
end end
@@ -57,7 +57,7 @@ describe 'neutron::plugins::midonet' do
end end
it 'should perform default configuration of' do it 'should perform default configuration of' do
midonet_uri = "http://" + params[:midonet_api_ip] + ":" + params[:midonet_api_port] + "/midonet-api"; midonet_uri = "http://" + params[:midonet_cluster_ip] + ":" + params[:midonet_cluster_port] + "/midonet-api";
is_expected.to contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri) is_expected.to contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
is_expected.to contain_neutron_plugin_midonet('MIDONET/username').with_value(params[:keystone_username]) is_expected.to contain_neutron_plugin_midonet('MIDONET/username').with_value(params[:keystone_username])
is_expected.to contain_neutron_plugin_midonet('MIDONET/password').with_value(params[:keystone_password]) is_expected.to contain_neutron_plugin_midonet('MIDONET/password').with_value(params[:keystone_password])
@@ -66,6 +66,26 @@ describe 'neutron::plugins::midonet' do
end end
shared_examples_for 'neutron midonet plugin using deprecated params' do
let :params do
{
:midonet_api_ip => '192.168.0.1',
:midonet_api_port => '8181',
}
end
before do
params.merge!(default_params)
end
it 'should take into account deprecated parameters first' do
midonet_uri = "http://" + params[:midonet_api_ip] + ":" + params[:midonet_api_port] + "/midonet-api";
is_expected.to contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
end
it 'should take into account deprecated parameters first' do
bad_midonet_uri = "http://" + params[:midonet_cluster_ip] + ":" + params[:midonet_cluster_port] + "/midonet-api";
is_expected.to_not contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(bad_midonet_uri)
end
end
context 'on Debian platforms' do context 'on Debian platforms' do
let :facts do let :facts do
@default_facts.merge(test_facts.merge({ @default_facts.merge(test_facts.merge({
@@ -82,6 +102,7 @@ describe 'neutron::plugins::midonet' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]') is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end end
it_configures 'neutron midonet plugin' it_configures 'neutron midonet plugin'
it_configures 'neutron midonet plugin using deprecated params'
end end
context 'on RedHat platforms' do context 'on RedHat platforms' do
@@ -92,6 +113,7 @@ describe 'neutron::plugins::midonet' do
})) }))
end end
it_configures 'neutron midonet plugin' it_configures 'neutron midonet plugin'
it_configures 'neutron midonet plugin using deprecated params'
end end
end end