Merge "Support NeutronNetworkPlugin options"

This commit is contained in:
Zuul 2024-10-22 15:33:12 +00:00 committed by Gerrit Code Review
commit 6952d8fa53
5 changed files with 111 additions and 12 deletions

View File

@ -0,0 +1,33 @@
# == define: manila::network::neutron_network
#
# Setup and configure the Neutron network plugin
#
# === Parameters
#
# [*neutron_physical_net_name*]
# (required) The name of the physical network to determine which net segment
# is used.
#
# [*network_plugin_ipv4_enabled*]
# (optional) Whether to support Ipv4 network resource.
# Defaults to $facts['os_service_default'].
#
# [*network_plugin_ipv6_enabled*]
# (optional) whether to support IPv6 network resource.
# Defaults to $facts['os_service_default'].
#
define manila::network::neutron_network (
$neutron_physical_net_name,
$network_plugin_ipv4_enabled = $facts['os_service_default'],
$network_plugin_ipv6_enabled = $facts['os_service_default'],
) {
$neutron_single_plugin_name = 'manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin'
manila_config {
"${name}/network_api_class": value => $neutron_single_plugin_name;
"${name}/neutron_physical_net_name": value => $neutron_physical_net_name;
"${name}/network_plugin_ipv4_enabled": value => $network_plugin_ipv4_enabled;
"${name}/network_plugin_ipv6_enabled": value => $network_plugin_ipv6_enabled;
}
}

View File

@ -5,23 +5,21 @@
# === Parameters
#
# [*neutron_net_id*]
# (required) Default Neutron network that will be used for share server
# creation. This opt is used only with
# class 'NeutronSingleNetworkPlugin'.
# (required) Default Neutron network that will be used for share server
# creation.
#
# [*neutron_subnet_id*]
# (required) Default Neutron subnet that will be used for share server
# creation. Should be assigned to network defined in opt
# 'neutron_net_id'. This opt is used only with
# class 'NeutronSingleNetworkPlugin'.
# (required) Default Neutron subnet that will be used for share server
# creation. Should be assigned to network defined in opt
# 'neutron_net_id'.
#
# [*network_plugin_ipv4_enabled*]
# (optional) Whether to support Ipv4 network resource.
# Defaults to $facts['os_service_default'].
# (optional) Whether to support Ipv4 network resource.
# Defaults to $facts['os_service_default'].
#
# [*network_plugin_ipv6_enabled*]
# (optional) whether to support IPv6 network resource.
# Defaults to $facts['os_service_default'].
# (optional) whether to support IPv6 network resource.
# Defaults to $facts['os_service_default'].
#
define manila::network::neutron_single_network (
$neutron_net_id,

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``manila::network::neutron_network`` defined resource type has been
added. It supports managing the options of neutron network plugin.

View File

@ -0,0 +1,61 @@
require 'spec_helper'
describe 'manila::network::neutron_network' do
let(:title) do
'neutronnet'
end
let :params do
{
:neutron_physical_net_name => 'br-ex',
}
end
shared_examples 'manila::network::neutron_network' do
context 'with required parameters' do
it 'configures neutron single network plugin' do
is_expected.to contain_manila_config("neutronnet/network_api_class").with_value(
'manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin')
is_expected.to contain_manila_config('neutronnet/neutron_physical_net_name')\
.with_value('br-ex')
is_expected.to contain_manila_config('neutronnet/network_plugin_ipv4_enabled')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_manila_config('neutronnet/network_plugin_ipv6_enabled')\
.with_value('<SERVICE DEFAULT>')
end
end
context 'with custom parameters' do
before do
params.merge!({
:network_plugin_ipv4_enabled => true,
:network_plugin_ipv6_enabled => false,
})
end
it 'configures neutron single network plugin' do
is_expected.to contain_manila_config("neutronnet/network_api_class").with_value(
'manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin')
is_expected.to contain_manila_config('neutronnet/neutron_physical_net_name')\
.with_value('br-ex')
is_expected.to contain_manila_config('neutronnet/network_plugin_ipv4_enabled')\
.with_value(true)
is_expected.to contain_manila_config('neutronnet/network_plugin_ipv6_enabled')\
.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 'manila::network::neutron_network'
end
end
end

View File

@ -1,7 +1,9 @@
require 'spec_helper'
describe 'manila::network::neutron_single_network' do
let("title") {'neutronsingle'}
let(:title) do
'neutronsingle'
end
let :params do
{