Remove support for contrail plugin

... which was deprecated during the previous cycle[1].

[1] 0877c62e92

Change-Id: I819fa33182729902e5f723dd0ca0db8a1be7d33a
This commit is contained in:
Takashi Kajinami 2024-04-19 10:55:05 +09:00
parent 12a2b5fd6f
commit c6c6fb87a5
11 changed files with 6 additions and 350 deletions

View File

@ -1,10 +0,0 @@
Puppet::Type.type(:neutron_plugin_opencontrail).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini'
end
end

View File

@ -1,56 +0,0 @@
Puppet::Type.newtype(:neutron_plugin_opencontrail) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from ContrailPlugin.ini (DEPRECATED)'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:file) do
['/etc/neutron/plugins/opencontrail']
end
autorequire(:anchor) do
['neutron::install::end']
end
end

View File

@ -95,9 +95,6 @@
# [*plugin_nuage_config*]
# (optional) Manage configuration of plugins/nuage/plugin.ini
#
# [*plugin_opencontrail_config*]
# (optional) Manage configuration of plugins/opencontrail/ContrailPlugin.ini
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
@ -127,7 +124,6 @@ class neutron::config (
# DEPRECATED PARAMETERS
Optional[Hash] $linuxbridge_agent_config = undef,
Optional[Hash] $plugin_nuage_config = undef,
Optional[Hash] $plugin_opencontrail_config = undef,
) {
include neutron::deps
@ -143,13 +139,6 @@ class neutron::config (
warning('The plugin_nuage_config parameter is deprecated and has no effect.')
}
if $plugin_opencontrail_config != undef {
warning('The plugin_opencontrail_config parameter is deprecated.')
$plugin_opencontrail_config_real = $plugin_opencontrail_config
} else {
$plugin_opencontrail_config_real = {}
}
create_resources('neutron_config', $server_config)
create_resources('neutron_api_paste_ini', $api_paste_ini)
create_resources('neutron_rootwrap_config', $rootwrap_config)
@ -172,6 +161,5 @@ class neutron::config (
create_resources('neutron_vpnaas_service_config', $vpnaas_service_config)
create_resources('neutron_taas_service_config', $taas_service_config)
create_resources('neutron_bgp_dragent_config', $bgp_dragent_config)
create_resources('neutron_plugin_opencontrail', $plugin_opencontrail_config_real)
create_resources('neutron_plugin_ml2', $plugin_ml2_config)
}

View File

@ -51,7 +51,6 @@ class neutron::deps {
Anchor['neutron::config::begin'] -> Neutron_bgp_dragent_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_l2gw_service_config<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_plugin_ml2<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_plugin_opencontrail<||> ~> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_sriov_agent_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_vpnaas_agent_config<||> -> Anchor['neutron::config::end']
Anchor['neutron::config::begin'] -> Neutron_vpnaas_service_config<||> ~> Anchor['neutron::config::end']

View File

@ -1,102 +0,0 @@
# DEPRECATED !!!
# This class installs and configures Opencontrail Neutron Plugin.
#
# === Parameters
#
# [*api_server_ip*]
# (Optional) IP address of the API Server
# Defaults to $facts['os_service_default']
#
# [*api_server_port*]
# (Optional) Port of the API Server.
# Defaults to $facts['os_service_default']
#
# [*contrail_extensions*]
# (Optional) Array of OpenContrail extensions to be supported
# Defaults to $facts['os_service_default']
# Example:
#
# class {'neutron::plugins::opencontrail' :
# contrail_extensions => ['ipam:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_ipam.NeutronPluginContrailIpam']
# }
#
# [*timeout*]
# (Optional) VNC API Server request timeout in seconds.
# Defaults to $facts['os_service_default']
#
# [*connection_timeout*]
# (Optional) VNC API Server connection timeout in seconds.
# Defaults to $facts['os_service_default']
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'.
#
# [*purge_config*]
# (Optional) Whether to set only the specified config options
# in the opencontrail config.
# Defaults to false.
#
class neutron::plugins::opencontrail (
$api_server_ip = $facts['os_service_default'],
$api_server_port = $facts['os_service_default'],
$contrail_extensions = $facts['os_service_default'],
$timeout = $facts['os_service_default'],
$connection_timeout = $facts['os_service_default'],
$package_ensure = 'present',
$purge_config = false,
) {
include neutron::deps
include neutron::params
warning('Support for contrail plugin has been deprecated.')
$contrail_extensions_real = $contrail_extensions ? {
Hash => join(join_keys_to_values($contrail_extensions, ':'), ','),
default => join(any2array($contrail_extensions), ','),
}
package { 'neutron-plugin-contrail':
ensure => $package_ensure,
name => $::neutron::params::opencontrail_plugin_package,
tag => ['openstack', 'neutron-package'],
}
ensure_resource('file', '/etc/neutron/plugins/opencontrail', {
ensure => directory,
owner => 'root',
group => $::neutron::params::group,
mode => '0640'}
)
if $facts['os']['family'] == 'Debian' {
file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
path => '/etc/default/neutron-server',
match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
line => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::opencontrail_config_file}",
tag => 'neutron-file-line',
}
}
if $facts['os']['family'] == 'Redhat' {
file { '/etc/neutron/plugin.ini':
ensure => link,
target => $::neutron::params::opencontrail_config_file,
require => Package[$::neutron::params::opencontrail_plugin_package],
tag => 'neutron-config-file',
}
}
resources { 'neutron_plugin_opencontrail':
purge => $purge_config,
}
neutron_plugin_opencontrail {
'APISERVER/api_server_ip': value => $api_server_ip;
'APISERVER/api_server_port': value => $api_server_port;
'APISERVER/contrail_extensions': value => $contrail_extensions_real;
'APISERVER/timeout': value => $timeout;
'APISERVER/connection_timeout': value => $connection_timeout;
}
}

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
Support for contrail plugin has been removed.

View File

@ -14,7 +14,6 @@ describe 'basic neutron_config resource' do
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/neutron_vpnaas.conf',
'/etc/neutron/taas_plugin.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/ml2/linuxbridge_agent.ini',
'/etc/neutron/plugins/ml2/openvswitch_agent.ini',
'/etc/neutron/plugins/ml2/ovn_agent.ini',
@ -35,7 +34,6 @@ describe 'basic neutron_config resource' do
File <||> -> Neutron_vpnaas_agent_config <||>
File <||> -> Neutron_vpnaas_service_config <||>
File <||> -> Neutron_taas_service_config <||>
File <||> -> Neutron_plugin_opencontrail <||>
File <||> -> Neutron_agent_linuxbridge <||>
File <||> -> Neutron_agent_ovs <||>
File <||> -> Neutron_agent_ovn <||>
@ -46,8 +44,7 @@ describe 'basic neutron_config resource' do
$neutron_directories = ['/etc/neutron',
'/etc/neutron/plugins',
'/etc/neutron/plugins/ml2',
'/etc/neutron/plugins/opencontrail']
'/etc/neutron/plugins/ml2']
$neutron_files = [ '/etc/neutron/api-paste.ini',
'/etc/neutron/neutron.conf',
@ -61,7 +58,6 @@ describe 'basic neutron_config resource' do
'/etc/neutron/vpn_agent.ini',
'/etc/neutron/neutron_vpnaas.conf',
'/etc/neutron/taas_plugin.ini',
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
'/etc/neutron/plugins/ml2/linuxbridge_agent.ini',
'/etc/neutron/plugins/ml2/openvswitch_agent.ini',
'/etc/neutron/plugins/ml2/ovn_agent.ini',
@ -255,24 +251,6 @@ describe 'basic neutron_config resource' do
ensure_absent_val => 'toto',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldnotexist' :
value => '<SERVICE DEFAULT>',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldexist2' :
value => '<SERVICE DEFAULT>',
ensure_absent_val => 'toto',
}
neutron_plugin_opencontrail { 'DEFAULT/thisshouldnotexist2' :
value => 'toto',
ensure_absent_val => 'toto',
}
neutron_agent_linuxbridge { 'DEFAULT/thisshouldexist' :
value => 'foo',
}
@ -411,7 +389,6 @@ describe 'basic neutron_config resource' do
'neutron_vpnaas_agent_config',
'neutron_vpnaas_service_config',
'neutron_taas_service_config',
'neutron_plugin_opencontrail',
'neutron_agent_linuxbridge',
'neutron_agent_ovs',
'neutron_agent_ovn',

View File

@ -177,17 +177,10 @@ describe 'neutron::config' do
shared_examples 'neutron_plugin_config' do
let :params do
{
:plugin_opencontrail_config => config_hash,
:plugin_ml2_config => config_hash
:plugin_ml2_config => config_hash
}
end
it 'configures arbitrary neutron_plugin_opencontrail configurations' do
should contain_neutron_plugin_opencontrail('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_opencontrail('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_opencontrail('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_ml2 configurations' do
should contain_neutron_plugin_ml2('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_ml2('DEFAULT/bar').with_value('barValue')

View File

@ -1,94 +0,0 @@
require 'spec_helper'
describe 'neutron::plugins::opencontrail' do
shared_examples 'neutron::plugins::contrail' do
context 'with defaults' do
it 'passes purge to resource' do
should contain_resources('neutron_plugin_opencontrail').with({
:purge => false
})
end
it 'should perform default configuration of' do
should contain_neutron_plugin_opencontrail('APISERVER/api_server_ip').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_opencontrail('APISERVER/api_server_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_opencontrail('APISERVER/timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_opencontrail('APISERVER/connection_timeout').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters' do
let :params do
{
:api_server_ip => '10.0.0.1',
:api_server_port => '8082',
:contrail_extensions => ['ipam:ipam','policy:policy','route-table'],
:timeout => 10,
:connection_timeout => 5,
}
end
it 'should set the given values' do
should contain_neutron_plugin_opencontrail('APISERVER/api_server_ip').with_value(params[:api_server_ip])
should contain_neutron_plugin_opencontrail('APISERVER/api_server_port').with_value(params[:api_server_port])
should contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value(params[:contrail_extensions].join(','))
should contain_neutron_plugin_opencontrail('APISERVER/timeout').with_value(params[:timeout])
should contain_neutron_plugin_opencontrail('APISERVER/connection_timeout').with_value(params[:connection_timeout])
end
end
context 'contrail_extensions set by a dictionary' do
let :params do
{
:contrail_extensions => {
'ipam' => 'ipam',
'policy' => 'policy',
'route-table' => 'route-table',
}
}
end
it 'should configure the contrail_extensions' do
should contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value('ipam:ipam,policy:policy,route-table:route-table')
end
end
end
shared_examples 'neutron::plugins::opencontrail on Debian' do
it 'configures /etc/default/neutron-server' do
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
:path => '/etc/default/neutron-server',
:match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
:line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
:tag => 'neutron-file-line',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
shared_examples 'neutron::plugins::opencontrail on RedHat' do
it 'should create plugin symbolic link' do
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
:require => 'Package[neutron-plugin-contrail]'
)
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'neutron::plugins::contrail'
it_behaves_like "neutron::plugins::opencontrail on #{facts[:os]['family']}"
end
end
end

View File

@ -1,23 +0,0 @@
require 'spec_helper'
provider_class = Puppet::Type.type(:neutron_plugin_opencontrail).provider(:ini_setting)
describe provider_class do
let(:resource ) do
Puppet::Type::Neutron_plugin_opencontrail.new({
:name => 'DEFAULT/foo',
:value => 'bar',
})
end
let (:provider) { resource.provider }
[ 'RedHat', 'Debian' ].each do |os|
context "on #{os} with default setting" do
it 'it should fall back to default and use ContrailPlugin.ini' do
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
expect(provider.file_path).to eq('/etc/neutron/plugins/opencontrail/ContrailPlugin.ini')
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'puppet'
require 'puppet/type/neutron_plugin_opencontrail'
describe 'Puppet::Type.type(:neutron_plugin_opencontrail)' do
before :each do
@neutron_plugin_opencontrail = Puppet::Type.type(:neutron_plugin_opencontrail).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'neutron::install::end')
catalog.add_resource anchor, @neutron_plugin_opencontrail
dependency = @neutron_plugin_opencontrail.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@neutron_plugin_opencontrail)
expect(dependency[0].source).to eq(anchor)
end
end