2016-03-22 19:22:13 -04:00
|
|
|
# Configure the Neutron service
|
|
|
|
#
|
|
|
|
# [*driver*]
|
|
|
|
# (optional) Neutron Driver to test
|
|
|
|
# Can be: openvswitch or linuxbridge.
|
2016-12-16 13:57:41 +08:00
|
|
|
# Defaults to 'openvswitch'.
|
2016-05-24 22:30:55 -04:00
|
|
|
#
|
2017-04-11 16:33:48 +02:00
|
|
|
# [*bgpvpn_enabled*]
|
|
|
|
# (optional) Flag to enable BGPVPN
|
|
|
|
# API extensions.
|
|
|
|
# Defaults to false.
|
|
|
|
#
|
2017-04-26 14:05:33 +02:00
|
|
|
# [*l2gw_enabled*]
|
|
|
|
# (optional) Flag to enable L2GW.
|
|
|
|
# Defaults to false.
|
|
|
|
#
|
2018-07-17 14:21:01 +02:00
|
|
|
# [*bgp_dragent_enabled*]
|
|
|
|
# (optional) Flag to enable BGP dragent
|
|
|
|
# Defaults to false.
|
|
|
|
#
|
2017-12-28 11:25:51 -08:00
|
|
|
# [*notification_topics*]
|
|
|
|
# (optional) AMQP topic used for OpenStack notifications
|
|
|
|
# Defaults to $::os_service_default.
|
|
|
|
#
|
2016-03-22 19:22:13 -04:00
|
|
|
class openstack_integration::neutron (
|
2017-12-28 11:25:51 -08:00
|
|
|
$driver = 'openvswitch',
|
|
|
|
$bgpvpn_enabled = false,
|
|
|
|
$l2gw_enabled = false,
|
2018-07-17 14:21:01 +02:00
|
|
|
$bgp_dragent_enabled = false,
|
2017-12-28 11:25:51 -08:00
|
|
|
$notification_topics = $::os_service_default,
|
2016-03-22 19:22:13 -04:00
|
|
|
) {
|
2016-02-26 19:13:28 -05:00
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
include openstack_integration::config
|
|
|
|
include openstack_integration::params
|
2016-05-10 15:21:48 -04:00
|
|
|
|
|
|
|
if $::openstack_integration::config::ssl {
|
|
|
|
openstack_integration::ssl_key { 'neutron':
|
|
|
|
notify => Service['neutron-server'],
|
|
|
|
require => Package['neutron'],
|
|
|
|
}
|
|
|
|
Exec['update-ca-certificates'] ~> Service['neutron-server']
|
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
|
2017-09-15 08:33:55 -04:00
|
|
|
openstack_integration::mq_user { 'neutron':
|
2015-12-23 22:54:56 +01:00
|
|
|
password => 'an_even_bigger_secret',
|
2017-09-15 08:33:55 -04:00
|
|
|
before => Anchor['neutron::service::begin'],
|
2017-01-06 08:57:09 -05:00
|
|
|
}
|
|
|
|
|
2016-03-22 19:22:13 -04:00
|
|
|
case $driver {
|
|
|
|
'openvswitch': {
|
2019-12-08 12:59:28 +01:00
|
|
|
include vswitch::ovs
|
2019-12-10 11:22:06 +05:30
|
|
|
# In CentOS8 puppet-vswitch requires network-scripts package until it's ported to NM.
|
|
|
|
if ($::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '8') == 0) {
|
|
|
|
package { 'network-scripts-openvswitch':
|
|
|
|
ensure => 'latest'
|
|
|
|
}
|
|
|
|
}
|
2016-03-22 19:22:13 -04:00
|
|
|
# Functional test for Open-vSwitch:
|
|
|
|
# create dummy loopback interface to exercise adding a port to a bridge
|
|
|
|
vs_bridge { 'br-ex':
|
|
|
|
ensure => present,
|
|
|
|
notify => Exec['create_loop1_port'],
|
|
|
|
}
|
|
|
|
exec { 'create_loop1_port':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
command => 'ip link add name loop1 type dummy && ip addr add 127.2.0.1/24 dev loop1',
|
|
|
|
refreshonly => true,
|
2017-07-20 20:39:08 +02:00
|
|
|
}
|
|
|
|
-> vs_port { 'loop1':
|
2016-03-22 19:22:13 -04:00
|
|
|
ensure => present,
|
|
|
|
bridge => 'br-ex',
|
|
|
|
notify => Exec['create_br-ex_vif'],
|
|
|
|
}
|
|
|
|
# creates br-ex virtual interface to reach floating-ip network
|
|
|
|
exec { 'create_br-ex_vif':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
command => 'ip addr add 172.24.5.1/24 dev br-ex && ip link set br-ex up',
|
|
|
|
refreshonly => true,
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::ml2::ovs':
|
2016-08-09 15:34:52 -04:00
|
|
|
local_ip => '127.0.0.1',
|
|
|
|
tunnel_types => ['vxlan'],
|
|
|
|
bridge_mappings => ['external:br-ex'],
|
|
|
|
manage_vswitch => false,
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
2016-12-16 13:57:41 +08:00
|
|
|
$firewall_driver = 'iptables_hybrid'
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
|
|
|
'linuxbridge': {
|
|
|
|
exec { 'create_dummy_iface':
|
|
|
|
path => '/usr/bin:/bin:/usr/sbin:/sbin',
|
|
|
|
provider => shell,
|
|
|
|
unless => 'ip l show loop0',
|
|
|
|
command => 'ip link add name loop0 type dummy && ip addr add 172.24.5.1/24 dev loop0 && ip link set loop0 up',
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::ml2::linuxbridge':
|
2016-03-22 19:22:13 -04:00
|
|
|
local_ip => $::ipaddress,
|
|
|
|
tunnel_types => ['vxlan'],
|
|
|
|
physical_interface_mappings => ['external:loop0'],
|
|
|
|
}
|
2016-12-16 13:57:41 +08:00
|
|
|
$firewall_driver = 'iptables'
|
2016-03-22 19:22:13 -04:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
fail("Unsupported neutron driver (${driver})")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::db::mysql':
|
2015-12-23 22:54:56 +01:00
|
|
|
password => 'neutron',
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::keystone::auth':
|
2016-05-10 15:21:48 -04:00
|
|
|
public_url => "${::openstack_integration::config::base_url}:9696",
|
|
|
|
internal_url => "${::openstack_integration::config::base_url}:9696",
|
|
|
|
admin_url => "${::openstack_integration::config::base_url}:9696",
|
2016-03-02 19:09:05 -05:00
|
|
|
password => 'a_big_secret',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2017-04-26 14:05:33 +02:00
|
|
|
$bgpvpn_plugin = $bgpvpn_enabled ? {
|
|
|
|
true => 'bgpvpn',
|
|
|
|
default => undef,
|
|
|
|
}
|
|
|
|
if $l2gw_enabled {
|
|
|
|
if ($::operatingsystem == 'Ubuntu') {
|
2019-12-08 12:59:28 +01:00
|
|
|
class {'neutron::services::l2gw': }
|
2017-04-26 14:05:33 +02:00
|
|
|
$l2gw_provider = 'L2GW:l2gw:networking_l2gw.services.l2gateway.service_drivers.L2gwDriver:default'
|
|
|
|
}
|
|
|
|
elsif ($::operatingsystem != 'Ubuntu') {
|
2019-12-08 12:59:28 +01:00
|
|
|
class {'neutron::services::l2gw':
|
2017-04-26 14:05:33 +02:00
|
|
|
service_providers => ['L2GW:l2gw:networking_l2gw.services.l2gateway.service_drivers.L2gwDriver:default']
|
|
|
|
}
|
|
|
|
$l2gw_provider = undef
|
|
|
|
}
|
2019-06-17 17:54:03 +02:00
|
|
|
} else {
|
|
|
|
$l2gw_provider = undef
|
2017-04-26 14:05:33 +02:00
|
|
|
}
|
|
|
|
$l2gw_plugin = $l2gw_enabled ? {
|
|
|
|
true => 'networking_l2gw.services.l2gateway.plugin.L2GatewayPlugin',
|
|
|
|
default => undef,
|
2017-04-11 16:33:48 +02:00
|
|
|
}
|
2018-07-17 14:21:01 +02:00
|
|
|
$bgp_dr_plugin = $bgp_dragent_enabled ? {
|
|
|
|
true => 'neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin',
|
|
|
|
default => undef,
|
|
|
|
}
|
2019-05-13 14:47:24 +02:00
|
|
|
$plugins_list = delete_undef_values(['router', 'metering', 'firewall_v2', 'qos', 'trunk', $bgpvpn_plugin, $l2gw_plugin, $bgp_dr_plugin])
|
2017-04-26 14:05:33 +02:00
|
|
|
|
2018-02-20 10:27:32 +05:30
|
|
|
if $driver == 'linuxbridge' {
|
|
|
|
$global_physnet_mtu = '1450'
|
|
|
|
} else {
|
|
|
|
$global_physnet_mtu = undef
|
|
|
|
}
|
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::logging':
|
2018-11-27 23:24:00 +01:00
|
|
|
debug => true,
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron':
|
2017-01-06 08:57:09 -05:00
|
|
|
default_transport_url => os_transport_url({
|
|
|
|
'transport' => $::openstack_integration::config::messaging_default_proto,
|
|
|
|
'host' => $::openstack_integration::config::host,
|
|
|
|
'port' => $::openstack_integration::config::messaging_default_port,
|
|
|
|
'username' => 'neutron',
|
|
|
|
'password' => 'an_even_bigger_secret',
|
|
|
|
}),
|
|
|
|
notification_transport_url => os_transport_url({
|
|
|
|
'transport' => $::openstack_integration::config::messaging_notify_proto,
|
2016-11-09 09:41:17 -07:00
|
|
|
'host' => $::openstack_integration::config::host,
|
2017-01-06 08:57:09 -05:00
|
|
|
'port' => $::openstack_integration::config::messaging_notify_port,
|
2016-11-09 09:41:17 -07:00
|
|
|
'username' => 'neutron',
|
|
|
|
'password' => 'an_even_bigger_secret',
|
|
|
|
}),
|
2017-01-06 08:57:09 -05:00
|
|
|
rabbit_use_ssl => $::openstack_integration::config::ssl,
|
|
|
|
amqp_sasl_mechanisms => 'PLAIN',
|
|
|
|
allow_overlapping_ips => true,
|
|
|
|
core_plugin => 'ml2',
|
|
|
|
service_plugins => $plugins_list,
|
|
|
|
bind_host => $::openstack_integration::config::host,
|
|
|
|
use_ssl => $::openstack_integration::config::ssl,
|
|
|
|
cert_file => $::openstack_integration::params::cert_path,
|
|
|
|
key_file => "/etc/neutron/ssl/private/${::fqdn}.pem",
|
2017-12-28 11:25:51 -08:00
|
|
|
notification_topics => $notification_topics,
|
|
|
|
notification_driver => 'messagingv2',
|
2018-02-20 10:27:32 +05:30
|
|
|
global_physnet_mtu => $global_physnet_mtu,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::client': }
|
|
|
|
class { 'neutron::keystone::authtoken':
|
2018-04-24 20:36:35 +08:00
|
|
|
password => 'a_big_secret',
|
|
|
|
user_domain_name => 'Default',
|
|
|
|
project_domain_name => 'Default',
|
|
|
|
auth_url => $::openstack_integration::config::keystone_admin_uri,
|
|
|
|
www_authenticate_uri => $::openstack_integration::config::keystone_auth_uri,
|
|
|
|
memcached_servers => $::openstack_integration::config::memcached_servers,
|
2016-08-30 14:56:51 -04:00
|
|
|
}
|
2019-05-13 14:47:24 +02:00
|
|
|
$providers_list = delete_undef_values(['FIREWALL_V2:fwaas_db:neutron_fwaas.services.firewall.service_drivers.agents.agents.FirewallAgentDriver:default',
|
2017-04-26 14:05:33 +02:00
|
|
|
$l2gw_provider])
|
2018-05-16 16:55:22 +02:00
|
|
|
|
|
|
|
if $::osfamily == 'Debian' {
|
|
|
|
Service<| title == 'neutron-server'|> -> Openstacklib::Service_validation<| title == 'neutron-server' |> -> Neutron_network<||>
|
|
|
|
$validate_neutron_server_service = true
|
|
|
|
} else {
|
|
|
|
$validate_neutron_server_service = false
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::server':
|
2019-03-29 11:08:46 -06:00
|
|
|
database_connection => 'mysql+pymysql://neutron:neutron@127.0.0.1/neutron?charset=utf8',
|
|
|
|
sync_db => true,
|
|
|
|
api_workers => 2,
|
|
|
|
rpc_workers => 2,
|
|
|
|
rpc_response_max_timeout => 300,
|
|
|
|
validate => $validate_neutron_server_service,
|
|
|
|
service_providers => $providers_list,
|
|
|
|
ensure_dr_package => $bgp_dragent_enabled,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2018-05-16 16:55:22 +02:00
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::plugins::ml2':
|
2017-03-22 15:41:02 +08:00
|
|
|
type_drivers => ['vxlan', 'vlan', 'flat'],
|
|
|
|
tenant_network_types => ['vxlan', 'vlan', 'flat'],
|
2017-10-25 14:34:13 +05:30
|
|
|
extension_drivers => 'port_security,qos',
|
2016-03-22 19:22:13 -04:00
|
|
|
mechanism_drivers => $driver,
|
2016-04-01 17:55:01 +03:00
|
|
|
firewall_driver => $firewall_driver,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2018-08-20 15:03:31 +02:00
|
|
|
|
|
|
|
if $::openstack_integration::config::ssl {
|
|
|
|
# with nova metadata api running via wsgi it is ssl terminated, also
|
|
|
|
# neutron metadata agent does not support an ipv6 address for the
|
|
|
|
# metadata_host, so we need to use the hostname
|
|
|
|
$metadata_host = 'localhost'
|
|
|
|
$metadata_protocol = 'https'
|
|
|
|
} else {
|
|
|
|
$metadata_host = $::openstack_integration::config::host
|
|
|
|
$metadata_protocol = 'http'
|
|
|
|
}
|
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::metadata':
|
2018-08-20 15:03:31 +02:00
|
|
|
debug => true,
|
|
|
|
shared_secret => 'a_big_secret',
|
|
|
|
metadata_workers => 2,
|
|
|
|
metadata_host => $metadata_host,
|
|
|
|
metadata_protocol => $metadata_protocol,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::l3':
|
2018-06-21 21:34:44 +02:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2019-02-05 12:22:01 +05:30
|
|
|
extensions => 'fwaas_v2',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::dhcp':
|
2016-03-22 19:22:13 -04:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::agents::metering':
|
2016-03-22 19:22:13 -04:00
|
|
|
interface_driver => $driver,
|
|
|
|
debug => true,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::server::notifications':
|
2016-03-01 18:50:40 -05:00
|
|
|
auth_url => $::openstack_integration::config::keystone_admin_uri,
|
2016-01-06 17:39:07 -05:00
|
|
|
password => 'a_big_secret',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'neutron::services::fwaas':
|
2016-11-22 13:54:28 -05:00
|
|
|
enabled => true,
|
2019-02-05 12:22:01 +05:30
|
|
|
agent_version => 'v2',
|
2019-02-06 11:34:57 +05:30
|
|
|
driver => 'neutron_fwaas.services.firewall.service_drivers.agents.drivers.linux.iptables_fwaas_v2.IptablesFwaasDriver',
|
2016-11-22 13:54:28 -05:00
|
|
|
|
2016-02-23 22:40:49 -05:00
|
|
|
}
|
2017-04-11 16:33:48 +02:00
|
|
|
if $bgpvpn_enabled {
|
2019-12-08 12:59:28 +01:00
|
|
|
class {'neutron::services::bgpvpn':
|
2017-04-11 16:33:48 +02:00
|
|
|
service_providers => 'BGPVPN:Dummy:networking_bgpvpn.neutron.services.service_drivers.driver_api.BGPVPNDriver:default'
|
|
|
|
}
|
|
|
|
}
|
2018-07-17 14:21:01 +02:00
|
|
|
if $bgp_dragent_enabled {
|
2019-12-08 12:59:28 +01:00
|
|
|
class {'neutron::agents::bgp_dragent':
|
2018-08-20 09:56:28 +02:00
|
|
|
bgp_router_id => '127.0.0.1'
|
|
|
|
}
|
2018-07-17 14:21:01 +02:00
|
|
|
}
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|