Refactorize Neutron configuration

* Drop plugin config in cloud::network because it's only needed in
 cloud::network::controller
* Drop deprecated parameters

Change-Id: I284402d5135cff61a565b7d33522c622dc8e4c06
This commit is contained in:
Emilien Macchi 2014-11-25 15:28:39 -05:00
parent 0035caea35
commit 6e4f4071aa
10 changed files with 73 additions and 198 deletions

View File

@ -35,16 +35,10 @@
# (optional) Set log output to debug output
# Defaults to true
#
# [*tunnel_eth*]
# Deprecated.
#
# [*provider_vlan_ranges*]
# (optionnal) VLAN range for provider networks
# Defaults to ['physnet1:1000:2999']
#
# [*provider_bridge_mappings*]
# Deprecated.
#
# [*flat_networks*]
# (optionnal) List of physical_network names with which flat networks
# can be created. Use * to allow flat networks with arbitrary
@ -52,15 +46,6 @@
# Should be an array.
# Default to ['public'].
#
# [*external_int*]
# Deprecated.
#
# [*external_bridge*]
# Deprecated.
#
# [*manage_ext_network*]
# Deprecated.
#
# [*use_syslog*]
# (optional) Use syslog for logging
# Defaults to true
@ -73,19 +58,6 @@
# (optional) DHCP Lease duration (in seconds)
# Defaults to '120'
#
# [*tunnel_types*]
# Deprecated.
#
# [*tenant_network_types*]
# (optional) Handled tenant network types
# Defaults to ['gre']
# Possible value ['local', 'flat', 'vlan', 'gre', 'vxlan']
#
# [*type_drivers*]
# (optional) Drivers to load
# Defaults to ['gre', 'vlan', 'flat']
# Possible value ['local', 'flat', 'vlan', 'gre', 'vxlan']
#
# [*plugin*]
# (optional) Neutron plugin name
# Supported values: 'ml2', 'n1kv'.
@ -97,38 +69,12 @@ class cloud::network(
$rabbit_hosts = ['127.0.0.1:5672'],
$rabbit_password = 'rabbitpassword',
$api_eth = '127.0.0.1',
$provider_vlan_ranges = ['physnet1:1000:2999'],
$use_syslog = true,
$log_facility = 'LOG_LOCAL0',
$dhcp_lease_duration = '120',
$flat_networks = ['public'],
$tenant_network_types = ['gre'],
$type_drivers = ['gre', 'vlan', 'flat'],
$plugin = 'ml2',
# only needed by cisco n1kv plugin
$n1kv_vsm_ip = '127.0.0.1',
$n1kv_vsm_password = 'secrete',
$neutron_db_host = '127.0.0.1',
$neutron_db_user = 'neutron',
$neutron_db_password = 'neutronpassword',
$ks_keystone_admin_host = '127.0.0.1',
$ks_keystone_admin_proto = 'http',
$ks_keystone_admin_port = 35357,
$ks_neutron_password = 'neutronpassword',
# DEPRECATED PARAMETERS
$tunnel_eth = false,
$tunnel_types = false,
$provider_bridge_mappings = false,
$external_int = false,
$external_bridge = false,
$manage_ext_network = false,
) {
# Deprecated parameters warning
if $tunnel_eth or $tunnel_types or $provider_bridge_mappings or $external_int or $external_bridge or $manage_ext_network {
warning('This parameter is deprecated to move in cloud::network::vswitch class.')
}
# Disable twice logging if syslog is enabled
if $use_syslog {
$log_dir = false
@ -145,36 +91,10 @@ class cloud::network(
case $plugin {
'ml2': {
$core_plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
class { 'neutron::plugins::ml2':
type_drivers => $type_drivers,
tenant_network_types => $tenant_network_types,
network_vlan_ranges => $provider_vlan_ranges,
tunnel_id_ranges => ['1:10000'],
flat_networks => $flat_networks,
mechanism_drivers => ['openvswitch','l2population'],
enable_security_group => true
}
}
'n1kv': {
$core_plugin = 'neutron.plugins.cisco.network_plugin.PluginV2'
class { 'neuton::plugins::cisco':
database_user => $neutron_db_user,
database_password => $neutron_db_password,
database_host => $neutron_db_host,
keystone_auth_url => "${ks_keystone_admin_proto}://${ks_keystone_admin_host}:${ks_keystone_admin_port}/v2.0/",
keystone_password => $ks_neutron_password,
vswitch_plugin => 'neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2',
}
neutron_plugin_cisco {
'securitygroup/firewall_driver': value => 'neutron.agent.firewall.NoopFirewallDriver';
"N1KV:${n1kv_vsm_ip}/username": value => 'admin';
"N1KV:${n1kv_vsm_ip}/password": value => $n1kv_vsm_password;
# TODO (EmilienM) not sure about this one:
'database/connection': value => "mysql://${neutron_db_user}:${neutron_db_password}@${neutron_db_host}/neutron";
}
}
default: {
err "${plugin} plugin is not supported."
}

View File

@ -26,6 +26,21 @@
# Should be an hash.
# Default to {}
#
# [*tenant_network_types*]
# (optional) Handled tenant network types
# Defaults to ['gre']
# Possible value ['local', 'flat', 'vlan', 'gre', 'vxlan']
#
# [*type_drivers*]
# (optional) Drivers to load
# Defaults to ['gre', 'vlan', 'flat']
# Possible value ['local', 'flat', 'vlan', 'gre', 'vxlan']
#
# [*plugin*]
# (optional) Neutron plugin name
# Supported values: 'ml2', 'n1kv'.
# Defaults to 'ml2'
#
class cloud::network::controller(
$neutron_db_host = '127.0.0.1',
$neutron_db_user = 'neutron',
@ -45,6 +60,21 @@ class cloud::network::controller(
$nova_region_name = 'RegionOne',
$manage_ext_network = false,
$firewall_settings = {},
$flat_networks = ['public'],
$tenant_network_types = ['gre'],
$type_drivers = ['gre', 'vlan', 'flat'],
$provider_vlan_ranges = ['physnet1:1000:2999'],
$plugin = 'ml2',
# only needed by cisco n1kv plugin
$n1kv_vsm_ip = '127.0.0.1',
$n1kv_vsm_password = 'secrete',
$neutron_db_host = '127.0.0.1',
$neutron_db_user = 'neutron',
$neutron_db_password = 'neutronpassword',
$ks_keystone_admin_host = '127.0.0.1',
$ks_keystone_admin_proto = 'http',
$ks_keystone_admin_port = 35357,
$ks_neutron_password = 'neutronpassword',
) {
include 'cloud::network'
@ -63,6 +93,44 @@ class cloud::network::controller(
agent_down_time => '60',
}
case $plugin {
'ml2': {
$core_plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
class { 'neutron::plugins::ml2':
type_drivers => $type_drivers,
tenant_network_types => $tenant_network_types,
network_vlan_ranges => $provider_vlan_ranges,
tunnel_id_ranges => ['1:10000'],
flat_networks => $flat_networks,
mechanism_drivers => ['openvswitch','l2population'],
enable_security_group => true
}
}
'n1kv': {
$core_plugin = 'neutron.plugins.cisco.network_plugin.PluginV2'
class { 'neuton::plugins::cisco':
database_user => $neutron_db_user,
database_password => $neutron_db_password,
database_host => $neutron_db_host,
keystone_auth_url => "${ks_keystone_admin_proto}://${ks_keystone_admin_host}:${ks_keystone_admin_port}/v2.0/",
keystone_password => $ks_neutron_password,
vswitch_plugin => 'neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2',
}
neutron_plugin_cisco {
'securitygroup/firewall_driver': value => 'neutron.agent.firewall.NoopFirewallDriver';
"N1KV:${n1kv_vsm_ip}/username": value => 'admin';
"N1KV:${n1kv_vsm_ip}/password": value => $n1kv_vsm_password;
# TODO (EmilienM) not sure about this one:
'database/connection': value => "mysql://${neutron_db_user}:${neutron_db_password}@${neutron_db_host}/neutron";
}
}
default: {
err "${plugin} plugin is not supported."
}
}
class { 'neutron::server::notifications':
nova_url => $nova_url,
nova_admin_auth_url => $nova_admin_auth_url,

View File

@ -57,15 +57,10 @@ describe 'cloud::compute::hypervisor' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['gre'],
type_drivers => ['gre', 'vlan', 'flat'],
log_facility => 'LOG_LOCAL0' }"
end
@ -151,16 +146,6 @@ describe 'cloud::compute::hypervisor' do
:log_dir => false,
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre','vlan','flat'],
:tenant_network_types => ['gre'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron on compute node' do

View File

@ -26,15 +26,10 @@ describe 'cloud::network::controller' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -76,8 +71,8 @@ describe 'cloud::network::controller' do
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:type_drivers => ['gre', 'vlan', 'flat'],
:tenant_network_types => ['gre'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],

View File

@ -26,15 +26,10 @@ describe 'cloud::network::dhcp' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -62,16 +57,6 @@ describe 'cloud::network::dhcp' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron dhcp' do
@ -98,10 +83,7 @@ describe 'cloud::network::dhcp' do
"class { 'cloud::network':
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
tunnel_eth => '10.0.1.1',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
provider_bridge_mappings => ['physnet1:br-eth1'],
verbose => true,
debug => true,
use_syslog => true,

View File

@ -26,15 +26,10 @@ describe 'cloud::network::l3' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -62,16 +57,6 @@ describe 'cloud::network::l3' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron l3' do

View File

@ -26,15 +26,10 @@ describe 'cloud::network::lbaas' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -62,16 +57,6 @@ describe 'cloud::network::lbaas' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron lbaas' do
@ -87,10 +72,7 @@ describe 'cloud::network::lbaas' do
class { 'cloud::network':
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
tunnel_eth => '10.0.1.1',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
provider_bridge_mappings => ['physnet1:br-eth1'],
verbose => true,
debug => true,
use_syslog => true,

View File

@ -26,15 +26,10 @@ describe 'cloud::network::metadata' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -70,16 +65,6 @@ describe 'cloud::network::metadata' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron metadata' do

View File

@ -26,15 +26,10 @@ describe 'cloud::network::vpn' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
@ -57,16 +52,6 @@ describe 'cloud::network::vpn' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
is_expected.not_to contain__neutron_network('public')
end
it 'configure neutron vpnaas' do

View File

@ -26,20 +26,17 @@ describe 'cloud::network::vswitch' do
rabbit_hosts => ['10.0.0.1'],
rabbit_password => 'secrete',
api_eth => '10.0.0.1',
provider_vlan_ranges => ['physnet1:1000:2999'],
flat_networks => ['public'],
external_bridge => 'br-pub',
verbose => true,
debug => true,
use_syslog => true,
dhcp_lease_duration => '10',
tenant_network_types => ['vxlan'],
type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
log_facility => 'LOG_LOCAL0' }"
end
let :params do
{ :tunnel_eth => '10.0.1.1' }
{
:tunnel_eth => '10.0.1.1'
}
end
it 'configure neutron common' do
@ -61,15 +58,6 @@ describe 'cloud::network::vswitch' do
:dhcp_lease_duration => '10',
:report_interval => '30'
)
is_expected.to contain_class('neutron::plugins::ml2').with(
:type_drivers => ['gre', 'vlan', 'flat', 'vxlan'],
:tenant_network_types => ['vxlan'],
:mechanism_drivers => ['openvswitch','l2population'],
:tunnel_id_ranges => ['1:10000'],
:network_vlan_ranges => ['physnet1:1000:2999'],
:flat_networks => ['public'],
:enable_security_group => true
)
end
context 'when running ML2 plugin with OVS driver' do