Support network plugin model

Supports configuration parameters for the following new network
plugins:
 - Neutron (formerly the only option)
 - Neutron single network
 - Nova networking
 - Standalone network

Documentation for these plugins is in review here:
https://review.openstack.org/#/c/171166/

Change-Id: Ida57ae5551c962791eaddacb695996cf4e8dec23
This commit is contained in:
Ryan Hefner 2015-03-22 23:38:48 -04:00
parent cf654ec8d6
commit 728a0e586d
12 changed files with 294 additions and 10 deletions

View File

@ -1,4 +1,4 @@
# == Class: manila::neutron
# == class: manila::network::neutron
#
# Setup and configure Neutron communication
#
@ -17,7 +17,7 @@
# (optional) password for connecting to neutron in admin context
#
# [*neutron_admin_tenant_name*]
# (optional) tenant name for connecting to neutron in admin context
# (optional) Tenant name for connecting to neutron in admin context
#
# [*neutron_region_name*]
# (optional) region name for connecting to neutron in admin context
@ -32,9 +32,6 @@
# (optional) auth strategy for connecting to
# neutron in admin context
#
# [*neutron_ovs_bridge*]
# (optional) Name of Integration Bridge used by Open vSwitch
#
# [*neutron_ca_certificates_file*]
# (optional) Location of ca certificates file to use for
# neutron client requests.
@ -50,11 +47,13 @@ class manila::network::neutron (
$neutron_admin_auth_url = 'http://localhost:5000/v2.0',
$neutron_api_insecure = false,
$neutron_auth_strategy = 'keystone',
$neutron_ovs_bridge = 'br-int',
$neutron_ca_certificates_file = undef,
) {
$neutron_plugin_name = 'manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin'
manila_config {
'DEFAULT/network_api_class': value => $neutron_plugin_name;
'DEFAULT/neutron_url': value => $neutron_url;
'DEFAULT/neutron_url_timeout': value => $neutron_url_timeout;
'DEFAULT/neutron_admin_username': value => $neutron_admin_username;
@ -64,7 +63,6 @@ class manila::network::neutron (
'DEFAULT/neutron_admin_auth_url': value => $neutron_admin_auth_url;
'DEFAULT/neutron_api_insecure': value => $neutron_api_insecure;
'DEFAULT/neutron_auth_strategy': value => $neutron_auth_strategy;
'DEFAULT/neutron_ovs_bridge': value => $neutron_ovs_bridge;
'DEFAULT/neutron_ca_certificates_file': value => $neutron_ca_certificates_file;
}
}

View File

@ -0,0 +1,31 @@
# == define: manila::network::neutron_single_network
#
# Setup and configure the Neutron single network plugin
#
# === Parameters
#
# [*neutron_net_id*]
# (required) Default Neutron network that will be used for share server
# creation. This opt is used only with
# class 'NeutronSingleNetworkPlugin'.
#
# [*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'.
#
define manila::network::neutron_single_network (
$neutron_net_id,
$neutron_subnet_id,
) {
$neutron_single_plugin_name = 'manila.network.neutron.neutron_network_plugin.NeutronSingleNetworkPlugin'
manila_config {
"${name}/network_api_class": value => $neutron_single_plugin_name;
"${name}/neutron_net_id": value => $neutron_net_id;
"${name}/neutron_subnet_id": value => $neutron_subnet_id;
}
}

View File

@ -0,0 +1,12 @@
# == define: manila::network::nova_network
#
# Setup and configure Nova Networking communication
#
define manila::network::nova_network () {
$nova_net_plugin_name = 'manila.network.nova_network_plugin.NovaNetworkPlugin'
manila_config {
"${name}/network_api_class": value => $nova_net_plugin_name;
}
}

View File

@ -0,0 +1,22 @@
# == define: manila::network::nova_single_network
#
# Setup and configure Nova Networking communication with a single network
#
# === Parameters
#
# [*nova_single_network_plugin_net_id*]
# (required) Default Nova network that will be used for share servers.
# This opt is used only with class 'NovaSingleNetworkPlugin'.
#
define manila::network::nova_single_network (
$nova_single_network_plugin_net_id,
) {
$nova_single_net_plugin_name = 'manila.network.nova_network_plugin.NovaSingleNetworkPlugin'
manila_config {
"${name}/network_api_class": value => $nova_single_net_plugin_name;
"${name}/nova_single_network_plugin_net_id": value => $nova_single_network_plugin_net_id;
}
}

View File

@ -0,0 +1,51 @@
# == define: manila::network::standalone
#
# Setup and configure Manila standalone network communication
#
# === Parameters
#
# [*standalone_network_plugin_gateway*]
# (required) Gateway IPv4 address that should be used. Required
#
# [*standalone_network_plugin_mask*]
# (required) Network mask that will be used. Can be either decimal
# like '24' or binary like '255.255.255.0'. Required.
#
# [*standalone_network_plugin_segmentation_id*]
# (optional) Set it if network has segmentation (VLAN, VXLAN, etc...).
# It will be assigned to share-network and share drivers will be
# able to use this for network interfaces within provisioned
# share servers. Optional. Example: 1001
#
# [*standalone_network_plugin_allowed_ip_ranges*]
# (optional) Can be IP address, range of IP addresses or list of addresses
# or ranges. Contains addresses from IP network that are allowed
# to be used. If empty, then will be assumed that all host
# addresses from network can be used. Optional.
# Examples: 10.0.0.10 or 10.0.0.10-10.0.0.20 or
# 10.0.0.10-10.0.0.20,10.0.0.30-10.0.0.40,10.0.0.50
#
# [*standalone_network_plugin_ip_version*]
# (optional) IP version of network. Optional.
# Allowed values are '4' and '6'. Default value is '4'.
#
define manila::network::standalone (
$standalone_network_plugin_gateway,
$standalone_network_plugin_mask,
$standalone_network_plugin_segmentation_id = undef,
$standalone_network_plugin_allowed_ip_ranges = undef,
$standalone_network_plugin_ip_version = '4',
) {
$standalone_plugin_name = 'manila.network.standalone_network_plugin.StandaloneNetworkPlugin'
manila_config {
"${name}/network_api_class": value => $standalone_plugin_name;
"${name}/standalone_network_plugin_gateway": value => $standalone_network_plugin_gateway;
"${name}/standalone_network_plugin_mask": value => $standalone_network_plugin_mask;
"${name}/standalone_network_plugin_segmentation_id": value => $standalone_network_plugin_segmentation_id;
"${name}/standalone_network_plugin_allowed_ip_ranges": value => $standalone_network_plugin_allowed_ip_ranges;
"${name}/standalone_network_plugin_ip_version": value => $standalone_network_plugin_ip_version;
}
}

View File

@ -1,9 +1,6 @@
# ==define manila::service_instance
#
# ===Parameters
# [*share_backend_name*]
# (required) Name of the backend in manila.conf that
# these settings will reside in
#
# [*service_image_name*]
# (optional) Name of image in glance, that will be used to create
@ -73,6 +70,10 @@
# [*connect_share_server_to_tenant_network*]
# (optional) Attach share server directly to share network.
# Defaults to: false
#
# [*service_instance_network_helper_type*]
# Allowed values are nova, neutron
# Defaults to: neutron
define manila::service_instance (
$service_image_name = 'manila-service-image',
@ -91,6 +92,7 @@ define manila::service_instance (
$service_network_division_mask = 28,
$interface_driver = 'manila.network.linux.interface.OVSInterfaceDriver',
$connect_share_server_to_tenant_network = false,
$service_instance_network_helper_type = 'neutron',
) {
if $service_image_location {
@ -122,5 +124,6 @@ define manila::service_instance (
"${name}/service_network_division_mask": value => $service_network_division_mask;
"${name}/interface_driver": value => $interface_driver;
"${name}/connect_share_server_to_tenant_network": value => $connect_share_server_to_tenant_network;
"${name}/service_instance_network_helper_type": value => $service_instance_network_helper_type;
}
}

View File

@ -0,0 +1,55 @@
require 'spec_helper'
describe 'manila::network::neutron' do
let :params do
{
:neutron_admin_username => 'neutron',
:neutron_admin_password => 'password',
:neutron_admin_tenant_name => 'service',
:neutron_region_name => 'nova',
:neutron_ca_certificates_file => '/etc/neutron/ca-certificates',
}
end
let :default_params do
{
:neutron_url => 'http://127.0.0.1:9696',
:neutron_url_timeout => 30,
:neutron_admin_tenant_name => 'service',
:neutron_admin_auth_url => 'http://localhost:5000/v2.0',
:neutron_api_insecure => false,
:neutron_auth_strategy => 'keystone',
}
end
shared_examples_for 'neutron network plugin' do
let :params_hash do
default_params.merge(params)
end
it 'configures neutron network plugin' do
is_expected.to contain_manila_config("DEFAULT/network_api_class").with_value(
'manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin')
params_hash.each_pair do |config,value|
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
end
end
context 'with default parameters' do
before do
params = {}
end
it_configures 'neutron network plugin'
end
context 'with provided parameters' do
it_configures 'neutron network plugin'
end
end

View File

@ -0,0 +1,24 @@
require 'spec_helper'
describe 'manila::network::neutron_single_network' do
let("title") {'neutronsingle'}
let :params do
{
:neutron_net_id => 'abcdef',
:neutron_subnet_id => 'ghijkl',
}
end
context 'with provided parameters' do
it 'configures neutron single network plugin' do
is_expected.to contain_manila_config("neutronsingle/network_api_class").with_value(
'manila.network.neutron.neutron_network_plugin.NeutronSingleNetworkPlugin')
params.each_pair do |config,value|
is_expected.to contain_manila_config("neutronsingle/#{config}").with_value( value )
end
end
end
end

View File

@ -0,0 +1,14 @@
require 'spec_helper'
describe 'manila::network::nova_network' do
let("title") {'novanet'}
context 'with provided parameters' do
it 'configures nova network plugin' do
is_expected.to contain_manila_config("novanet/network_api_class").with_value(
'manila.network.nova_network_plugin.NovaNetworkPlugin')
end
end
end

View File

@ -0,0 +1,23 @@
require 'spec_helper'
describe 'manila::network::nova_single_network' do
let("title") {'novasinglenet'}
let :params do
{
:nova_single_network_plugin_net_id => 'abcdef',
}
end
context 'with provided parameters' do
it 'configures nova network plugin' do
is_expected.to contain_manila_config("novasinglenet/network_api_class").with_value(
'manila.network.nova_network_plugin.NovaSingleNetworkPlugin')
params.each_pair do |config,value|
is_expected.to contain_manila_config("novasinglenet/#{config}").with_value( value )
end
end
end
end

View File

@ -0,0 +1,50 @@
require 'spec_helper'
describe 'manila::network::standalone' do
let("title") {'standalone'}
let :params do
{
:standalone_network_plugin_gateway => '192.168.1.1',
:standalone_network_plugin_mask => '255.255.255.0',
:standalone_network_plugin_segmentation_id => '1001',
:standalone_network_plugin_allowed_ip_ranges => '10.0.0.10-10.0.0.20',
}
end
let :default_params do
{
:standalone_network_plugin_ip_version => '4',
}
end
shared_examples_for 'standalone network plugin' do
let :params_hash do
default_params.merge(params)
end
it 'configures standalone network plugin' do
is_expected.to contain_manila_config("standalone/network_api_class").with_value(
'manila.network.standalone_network_plugin.StandaloneNetworkPlugin')
params_hash.each_pair do |config,value|
is_expected.to contain_manila_config("standalone/#{config}").with_value( value )
end
end
end
context 'with default parameters' do
before do
params = {}
end
it_configures 'standalone network plugin'
end
context 'with provided parameters' do
it_configures 'standalone network plugin'
end
end

View File

@ -20,6 +20,7 @@ describe 'manila::service_instance' do
:service_network_division_mask => 28,
:interface_driver => 'manila.network.linux.interface.OVSInterfaceDriver',
:connect_share_server_to_tenant_network => false,
:service_instance_network_helper_type => 'neutron',
}
end