Remove support for networking-ansible

We deprecated the support during Zed cycle[1], because the plugin has
been unmaintained. So now we can remove the whole implementation.

[1] f82a231bad

Change-Id: I4d1509232daf18c213664545bda1d7f7aa05b93b
This commit is contained in:
Takashi Kajinami 2022-11-29 12:31:39 +09:00
parent 0abb807a8c
commit 1e55ead168
6 changed files with 4 additions and 357 deletions

View File

@ -61,7 +61,6 @@ class neutron::params {
$networking_baremetal_package = 'python3-networking-baremetal'
$networking_baremetal_agent_package = 'python3-ironic-neutron-agent'
$networking_baremetal_agent_service = 'ironic-neutron-agent'
$networking_ansible_package = 'python3-networking-ansible'
$mlnx_agent_package = 'python3-networking-mlnx'
$mlnx_plugin_package = 'python3-networking-mlnx'
$eswitchd_package = false

View File

@ -1,69 +0,0 @@
# == Class: neutron::plugins::ml2::networking_ansible
#
# DEPRECATED !!
# Configures the networking-ansible ML2 Mechanism Driver
#
# === Parameters
#
# [*host_configs*]
# (required) Network devices and their configurations
# Hash Format:
#
# {
# <host1> => {"ansible_network_os" => "junos",
# "ansible_host" => "10.0.0.1",
# "ansible_user" => 'ansible',
# "ansible_ssh_pass" => "***"},
# <host2> => {"ansible_network_os" => "junos",
# "ansible_host" => "10.0.0.2",
# "ansible_user" => 'ansible',
# "ansible_ssh_private_key_file" => "/private/key",
# "mac" => "01:23:45:67:89:AB",
# "manage_vlans" => false},
# }
#
# [*coordination_uri*]
# (optional) URI to use as a backend for tooz coordination
# Defaults to $::os_service_default
#
# [*package_ensure*]
# (optional) The intended state of the python-networking-ansible
# package, i.e. any of the possible values of the 'ensure'
# property for a package resource type.
# Defaults to 'present'
#
class neutron::plugins::ml2::networking_ansible(
$host_configs,
$coordination_uri = $::os_service_default,
$package_ensure = 'present'
) {
include neutron::deps
include neutron::params
require neutron::plugins::ml2
warning('Support for networking-ansible has been deprecated and \
will be removed in a future release.')
if($::osfamily != 'RedHat') {
# Drivers are only packaged for RedHat at this time
fail("Unsupported osfamily ${::osfamily}")
}
ensure_resource('package', 'python-networking-ansible',
{
ensure => $package_ensure,
name => $::neutron::params::networking_ansible_package,
tag => ['openstack', 'neutron-plugin-ml2-package']
}
)
create_resources(neutron::plugins::ml2::networking_ansible_host, $host_configs)
oslo::coordination { 'neutron_plugin_ml2':
backend_url => $coordination_uri,
manage_config => false,
}
neutron_plugin_ml2 {
'ml2_ansible/coordination_uri': value => $coordination_uri;
}
}

View File

@ -1,72 +0,0 @@
# == Define: neutron::plugins::ml2::networking_ansible_host
#
# DEPRECATED !!
# Defined type for networking-ansible configuration for a host/switch
#
# === Parameters
#
# [*ansible_network_os*]
# (Required) Operating system of the network device
#
# [*ansible_host*]
# (Required) IP Address of the network device
#
# [*ansible_user*]
# (Required) Username to connect to the network device
#
# [*ansible_ssh_pass*]
# (Optional) SSH password to connect to the network device
# This or ansible_ssh_private_key_file should be provided
# Defaults to $::os_service_default
#
# [*ansible_ssh_private_key_file*]
# (Optional) SSH private key to connect to the network device
# This or ansible_ssh_pass should be provided
# Defaults to $::os_service_default
#
# [*hostname*]
# (Optional) The hostname of a host connected to the switch.
# Defaults to $title
#
# [*mac*]
# (Optional) Chassis MAC ID of the network device. Used to map lldp provided
# value to the hostname when using ironic introspection.
# Defaults to $::os_service_default
#
# [*manage_vlans*]
# Should networking-ansible create and delete VLANs on the device.
# Defaults to $::os_service_default
#
define neutron::plugins::ml2::networking_ansible_host(
$ansible_network_os,
$ansible_host,
$ansible_user,
$ansible_ssh_pass = $::os_service_default,
$ansible_ssh_private_key_file = $::os_service_default,
$mac = $::os_service_default,
$hostname = $title,
$manage_vlans = $::os_service_default,
) {
include neutron::deps
require neutron::plugins::ml2
warning('Support for networking-ansible has been deprecated and \
will be removed in a future release.')
if ((is_service_default($ansible_ssh_pass) and is_service_default($ansible_ssh_private_key_file)) or
(!is_service_default($ansible_ssh_pass) and !is_service_default($ansible_ssh_private_key_file))) {
fail('One of ansible_ssh_pass OR ansible_ssh_private_key_file should be set')
}
$section = "ansible:${hostname}"
neutron_plugin_ml2 {
"${section}/ansible_network_os": value => $ansible_network_os;
"${section}/ansible_host": value => $ansible_host;
"${section}/ansible_user": value => $ansible_user;
"${section}/ansible_ssh_pass": value => $ansible_ssh_pass, secret => true;
"${section}/ansible_ssh_private_key_file": value => $ansible_ssh_private_key_file;
"${section}/mac": value => $mac;
"${section}/manage_vlans": value => $manage_vlans;
}
}

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
Support for the ``networking-ansible`` plugin has been removed.

View File

@ -1,94 +0,0 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::networking_ansible' do
let :default_params do
{
:package_ensure => 'present',
}
end
let :params do
{ :host_configs => {
'host1' => { 'ansible_network_os' => 'junos',
'ansible_host' => '192.0.2.1',
'ansible_user' => 'ansible',
'ansible_ssh_pass' => 'password1' },
'host2' => { 'ansible_network_os' => 'junos',
'ansible_host' => '192.0.2.1',
'ansible_user' => 'ansible',
'ansible_ssh_private_key_file' => '/path/to/key',
'mac' => '01:23:45:67:89:AB',
'manage_vlans' => false},},
:coordination_uri => 'etcd://127.0.0.1:2379'
}
end
shared_examples 'networking-ansible ml2 plugin' do
let :p do
default_params.merge(params)
end
it { should contain_class('neutron::params') }
it 'installs networking-ansible python-networking-ansible package' do
should contain_package('python-networking-ansible').with(
:name => platform_params[:networking_ansible_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-plugin-ml2-package'],
)
should contain_package('python-networking-ansible').that_requires('Anchor[neutron::install::begin]')
should contain_package('python-networking-ansible').that_notifies('Anchor[neutron::config::end]')
end
it 'should configure non-host config' do
should contain_oslo__coordination('neutron_plugin_ml2').with(
:backend_url => 'etcd://127.0.0.1:2379',
:manage_config => false,
)
should contain_neutron_plugin_ml2('ml2_ansible/coordination_uri').with_value('etcd://127.0.0.1:2379')
end
it {
params[:host_configs].each do |host_config|
should contain_neutron__plugins__ml2__networking_ansible_host(host_config.first)
should contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_pass').with_value('password1')
should contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_private_key_file').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key')
should contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ansible:host1/mac').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ansible:host2/mac').with_value('01:23:45:67:89:AB')
should contain_neutron_plugin_ml2('ansible:host1/manage_vlans').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
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
let (:platform_params) do
case facts[:osfamily]
when 'RedHat'
{ :networking_ansible_package => 'python3-networking-ansible'}
end
end
case facts[:osfamily]
when 'RedHat'
it_behaves_like 'networking-ansible ml2 plugin'
when facts[:osfamily] != 'RedHat'
it 'fails with unsupported osfamily' do
should raise_error(Puppet::Error, /Unsupported osfamily.*/)
end
end
end
end
end

View File

@ -1,121 +0,0 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::networking_ansible_host' do
let (:title) do
'myhostname'
end
shared_examples 'neutron::plugins::ml2::networking_ansible_host' do
let :params do
{
:ansible_network_os => 'openvswitch',
:ansible_host => '192.0.2.10',
:ansible_user => 'neutron',
}
end
context 'without credential' do
it { should raise_error(Puppet::Error) }
end
context 'with both ssh pass and ssh key file set' do
before do
params.merge!({
:ansible_ssh_pass => 'secrete',
:ansible_ssh_private_key_file => '/var/lib/neutron/.ssh/id_rsa',
})
end
it { should raise_error(Puppet::Error) }
end
context 'with ssh pass' do
before do
params.merge!({
:ansible_ssh_pass => 'secrete'
})
end
it 'configures the host' do
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_network_os')\
.with_value('openvswitch')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_host')\
.with_value('192.0.2.10')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_user')\
.with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_pass')\
.with_value('secrete').with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_private_key_file')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/mac')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/manage_vlans')\
.with_value('<SERVICE DEFAULT>')
end
end
context 'with ssh key file' do
before do
params.merge!({
:ansible_ssh_private_key_file => '/var/lib/neutron/.ssh/id_rsa'
})
end
it 'configures the host' do
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_network_os')\
.with_value('openvswitch')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_host')\
.with_value('192.0.2.10')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_user')\
.with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_pass')\
.with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_private_key_file')\
.with_value('/var/lib/neutron/.ssh/id_rsa')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/mac')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/manage_vlans')\
.with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters' do
before do
params.merge!({
:ansible_ssh_pass => 'secrete',
:mac => '00:00:5e:00:53:01',
:manage_vlans => false,
})
end
it 'configures the host' do
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_network_os')\
.with_value('openvswitch')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_host')\
.with_value('192.0.2.10')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_user')\
.with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_pass')\
.with_value('secrete').with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/ansible_ssh_private_key_file')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/mac')\
.with_value('00:00:5e:00:53:01')
is_expected.to contain_neutron_plugin_ml2('ansible:myhostname/manage_vlans')\
.with_value(false)
end
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::ml2::networking_ansible_host'
end
end
end