networking-arista: Ensure the plugin package is installed

Arista plugin requires the python3-networking-arista package. This
change ensures the plugin package is installed when using the Arista
plugin.

Closes-Bug: #1968471
Change-Id: I58cf4bc3a2a3c38216b6ffadafe2fcb36e9c4a3a
This commit is contained in:
Takashi Kajinami 2022-04-10 22:53:39 +09:00
parent e8643a023d
commit 2d4f8f6f35
4 changed files with 54 additions and 20 deletions

View File

@ -30,6 +30,7 @@ class neutron::params {
$sfc_package = 'python3-networking-sfc' $sfc_package = 'python3-networking-sfc'
$user = 'neutron' $user = 'neutron'
$group = 'neutron' $group = 'neutron'
$arista_plugin_package = 'python3-networking-arista'
if($::osfamily == 'Redhat') { if($::osfamily == 'Redhat') {
$package_name = 'openstack-neutron' $package_name = 'openstack-neutron'

View File

@ -42,6 +42,12 @@
# (optional) Defines if hostnames are sent to Arista EOS as FQDNS # (optional) Defines if hostnames are sent to Arista EOS as FQDNS
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*package_ensure*]
# (optional) The intended state of the python-networking-baremetal
# package, i.e. any of the possible values of the 'ensure'
# property for a package resource type.
# Defaults to 'present'
#
class neutron::plugins::ml2::arista( class neutron::plugins::ml2::arista(
$eapi_host, $eapi_host,
$eapi_username, $eapi_username,
@ -49,7 +55,7 @@ class neutron::plugins::ml2::arista(
$region_name = $::os_service_default, $region_name = $::os_service_default,
$sync_interval = $::os_service_default, $sync_interval = $::os_service_default,
$use_fqdn = $::os_service_default, $use_fqdn = $::os_service_default,
$package_ensure = 'present'
) { ) {
include neutron::deps include neutron::deps
@ -63,4 +69,10 @@ class neutron::plugins::ml2::arista(
'ml2_arista/sync_interval': value => $sync_interval; 'ml2_arista/sync_interval': value => $sync_interval;
'ml2_arista/use_fqdn' : value => $use_fqdn; 'ml2_arista/use_fqdn' : value => $use_fqdn;
} }
package { 'python-networking-arista':
ensure => $package_ensure,
name => $::neutron::params::arista_plugin_package,
tag => ['openstack', 'neutron-plugin-ml2-package'],
}
} }

View File

@ -0,0 +1,10 @@
---
features:
- |
The new ``neutron::plugins::m2::arista::package_ensure`` parameter has
been added.
fixes:
- |
The ``neutron::plugins::ml2::arista`` class now installs the required
plugin package (``python3-networoking-arista``).

View File

@ -45,14 +45,25 @@ describe 'neutron::plugins::ml2::arista' do
end end
shared_examples 'neutron plugin ml2 arista' do shared_examples 'neutron plugin ml2 arista' do
before do let :p do
params.merge!(default_params) default_params.merge(params)
end end
it 'configures ml2 arista settings' do it 'configures ml2 arista settings' do
should contain_neutron_plugin_ml2('ml2_arista/eapi_host').with_value(params[:eapi_host]) should contain_neutron_plugin_ml2('ml2_arista/eapi_host').with_value(p[:eapi_host])
should contain_neutron_plugin_ml2('ml2_arista/eapi_username').with_value(params[:eapi_username]) should contain_neutron_plugin_ml2('ml2_arista/eapi_username').with_value(p[:eapi_username])
should contain_neutron_plugin_ml2('ml2_arista/eapi_password').with_value(params[:eapi_password]).with_secret(true) should contain_neutron_plugin_ml2('ml2_arista/eapi_password').with_value(p[:eapi_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_arista/region_name').with_value(p[:region_name])
should contain_neutron_plugin_ml2('ml2_arista/sync_interval').with_value(p[:sync_interval])
should contain_neutron_plugin_ml2('ml2_arista/use_fqdn').with_value(p[:use_fqdn])
end
it 'installs the plugin package' do
should contain_package('python-networking-arista').with(
:ensure => 'present',
:name => 'python3-networking-arista',
:tag => ['openstack', 'neutron-plugin-ml2-package'],
)
end end
end end