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'
$user = 'neutron'
$group = 'neutron'
$arista_plugin_package = 'python3-networking-arista'
if($::osfamily == 'Redhat') {
$package_name = 'openstack-neutron'

View File

@ -20,36 +20,42 @@
# === Parameters
#
# [*eapi_host*]
# (required) The Arista EOS IP address.
# (required) The Arista EOS IP address.
#
# [*eapi_username*]
# (required) The Arista EOS api username.
# (required) The Arista EOS api username.
#
# [*eapi_password*]
# (required) The Arista EOS api password.
# (required) The Arista EOS api password.
#
# [*region_name*]
# (optional) Region name that is assigned to the OpenStack controller.
# This setting must be set if multiple regions are using the same Arista
# hardware.
# Defaults to $::os_service_default
# (optional) Region name that is assigned to the OpenStack controller.
# This setting must be set if multiple regions are using the same Arista
# hardware.
# Defaults to $::os_service_default
#
# [*sync_interval*]
# (optional) Sync interval in seconds between neutron plugin and EOS.
# Defaults to $::os_service_default
# (optional) Sync interval in seconds between neutron plugin and EOS.
# Defaults to $::os_service_default
#
# [*use_fqdn*]
# (optional) Defines if hostnames are sent to Arista EOS as FQDNS
# Defaults to $::os_service_default
# (optional) Defines if hostnames are sent to Arista EOS as FQDNS
# 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(
$eapi_host,
$eapi_username,
$eapi_password,
$region_name = $::os_service_default,
$sync_interval = $::os_service_default,
$use_fqdn = $::os_service_default,
$region_name = $::os_service_default,
$sync_interval = $::os_service_default,
$use_fqdn = $::os_service_default,
$package_ensure = 'present'
) {
include neutron::deps
@ -63,4 +69,10 @@ class neutron::plugins::ml2::arista(
'ml2_arista/sync_interval': value => $sync_interval;
'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
shared_examples 'neutron plugin ml2 arista' do
before do
params.merge!(default_params)
let :p do
default_params.merge(params)
end
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_username').with_value(params[: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_host').with_value(p[:eapi_host])
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(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