From 2d4f8f6f3514acd2fa65d47accf7241735fc552d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 10 Apr 2022 22:53:39 +0900 Subject: [PATCH] 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 --- manifests/params.pp | 1 + manifests/plugins/ml2/arista.pp | 42 ++++++++++++------- ...rking-arista-package-da048a480ba2e80d.yaml | 10 +++++ .../neutron_plugins_ml2_arista_spec.rb | 21 +++++++--- 4 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 releasenotes/notes/networking-arista-package-da048a480ba2e80d.yaml diff --git a/manifests/params.pp b/manifests/params.pp index da5bb3c22..f29f4f2ce 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' diff --git a/manifests/plugins/ml2/arista.pp b/manifests/plugins/ml2/arista.pp index 0e2e6042f..857c57bea 100644 --- a/manifests/plugins/ml2/arista.pp +++ b/manifests/plugins/ml2/arista.pp @@ -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'], + } } diff --git a/releasenotes/notes/networking-arista-package-da048a480ba2e80d.yaml b/releasenotes/notes/networking-arista-package-da048a480ba2e80d.yaml new file mode 100644 index 000000000..6f279b331 --- /dev/null +++ b/releasenotes/notes/networking-arista-package-da048a480ba2e80d.yaml @@ -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``). diff --git a/spec/classes/neutron_plugins_ml2_arista_spec.rb b/spec/classes/neutron_plugins_ml2_arista_spec.rb index 5c6e13a1d..b62b2d950 100644 --- a/spec/classes/neutron_plugins_ml2_arista_spec.rb +++ b/spec/classes/neutron_plugins_ml2_arista_spec.rb @@ -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