From 926ee10c20823fae2491d50e5ede7934371176ba Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 10 Jun 2015 19:14:44 -0400 Subject: [PATCH] Drop OVS & LB monolitic plugins OVS & LB monolitic plugins have been dropped from Neutron in Juno and have been replaced in Havana by ML2 (in neutron::plugins::ml2::X and neutron::agents::ml2::X). It's time to clean this module by dropping useless plugins. Change-Id: I62ecd46fbc74f3e30b66052a7f95ee7c96c3138f --- README.md | 19 +- examples/neutron.pp | 14 +- manifests/agents/linuxbridge.pp | 81 ------- manifests/agents/ovs.pp | 163 -------------- manifests/plugins/linuxbridge.pp | 74 ------- manifests/plugins/ovs.pp | 86 -------- .../neutron_agents_linuxbridge_spec.rb | 91 -------- spec/classes/neutron_agents_ovs_spec.rb | 200 ----------------- .../neutron_plugins_linuxbridge_spec.rb | 93 -------- spec/classes/neutron_plugins_ovs_spec.rb | 203 ------------------ 10 files changed, 14 insertions(+), 1010 deletions(-) delete mode 100644 manifests/agents/linuxbridge.pp delete mode 100644 manifests/agents/ovs.pp delete mode 100644 manifests/plugins/linuxbridge.pp delete mode 100644 manifests/plugins/ovs.pp delete mode 100644 spec/classes/neutron_agents_linuxbridge_spec.rb delete mode 100644 spec/classes/neutron_agents_ovs_spec.rb delete mode 100644 spec/classes/neutron_plugins_linuxbridge_spec.rb delete mode 100644 spec/classes/neutron_plugins_ovs_spec.rb diff --git a/README.md b/README.md index aed94c623..b606cb2f2 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,13 @@ class { 'neutron::server': sql_connection => 'mysql://neutron:neutron_sql_secret@127.0.0.1/neutron?charset=utf8', } -# enable the Open VSwitch plugin server -class { 'neutron::plugins::ovs': - tenant_network_type => 'gre', - network_vlan_ranges => 'physnet:1000:2000', +# ml2 plugin with vxlan as ml2 driver and ovs as mechanism driver +class { '::neutron::plugins::ml2': + type_drivers => ['vxlan'], + tenant_network_types => ['vxlan'], + vxlan_group => '239.1.1.1', + mechanism_drivers => ['openvswitch'], + vni_ranges => ['0:300'] } ``` @@ -98,9 +101,11 @@ Limitations This module supports the following neutron plugins: -* Open vSwitch -* linuxbridge -* cisco-neutron +* Open vSwitch with ML2 +* linuxbridge with ML2 +* cisco-neutron with and without ML2 +* NVP +* PLUMgrid The following platforms are supported: diff --git a/examples/neutron.pp b/examples/neutron.pp index 56f760693..f9648c051 100644 --- a/examples/neutron.pp +++ b/examples/neutron.pp @@ -32,16 +32,11 @@ class { '::neutron::agents::metering': } # This plugin configures Neutron for OVS on the server # Agent -class { '::neutron::agents::ovs': +class { '::neutron::agents::ml2::ovs': local_ip => '192.168.1.1', enable_tunneling => true, } -# Plugin -class { '::neutron::plugins::ovs': - tenant_network_type => 'gre', -} - # ml2 plugin with vxlan as ml2 driver and ovs as mechanism driver class { '::neutron::plugins::ml2': type_drivers => ['vxlan'], @@ -63,12 +58,7 @@ class { '::neutron': # The agent/plugin combo also needs installed on clients # Agent -class { '::neutron::agents::ovs': +class { '::neutron::agents::ml2::ovs': local_ip => '192.168.1.11', enable_tunneling => true, } - -# Plugin -class { '::neutron::plugins::ovs': - tenant_network_type => 'gre', -} diff --git a/manifests/agents/linuxbridge.pp b/manifests/agents/linuxbridge.pp deleted file mode 100644 index 2e5e7950a..000000000 --- a/manifests/agents/linuxbridge.pp +++ /dev/null @@ -1,81 +0,0 @@ -# == Class: neutron::agents::linuxbridge -# -# Setups linuxbridge neutron agent. -# -# === Parameters -# -# [*physical_interface_mappings*] -# (required) Comma-separated list of : -# tuples mapping physical network names to agent's node-specific physical -# network interfaces. -# -# [*firewall_driver*] -# (optional) Firewall driver for realizing neutron security group function. -# Defaults to 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver'. -# -# [*package_ensure*] -# (optional) Ensure state for package. Defaults to 'present'. -# -# [*enable*] -# (optional) Enable state for service. Defaults to 'true'. -# -# [*manage_service*] -# (optional) Whether to start/stop the service -# Defaults to true -# -class neutron::agents::linuxbridge ( - $physical_interface_mappings, - $firewall_driver = 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver', - $package_ensure = 'present', - $enable = true, - $manage_service = true -) { - - include ::neutron::params - - Neutron_config<||> ~> Service['neutron-plugin-linuxbridge-service'] - Neutron_plugin_linuxbridge<||> ~> Service<| title == 'neutron-plugin-linuxbridge-service' |> - - if $::neutron::params::linuxbridge_agent_package { - Package['neutron'] -> Package['neutron-plugin-linuxbridge-agent'] - Package['neutron-plugin-linuxbridge-agent'] -> Neutron_plugin_linuxbridge<||> - Package['neutron-plugin-linuxbridge-agent'] -> Service['neutron-plugin-linuxbridge-service'] - package { 'neutron-plugin-linuxbridge-agent': - ensure => $package_ensure, - name => $::neutron::params::linuxbridge_agent_package, - tag => 'openstack', - } - } else { - # Some platforms (RedHat) do not provide a separate neutron plugin - # linuxbridge agent package. The configuration file for the linuxbridge - # agent is provided by the neutron linuxbridge plugin package. - Package['neutron-plugin-linuxbridge'] -> Neutron_plugin_linuxbridge<||> - - if ! defined(Package['neutron-plugin-linuxbridge']) { - package { 'neutron-plugin-linuxbridge': - ensure => $package_ensure, - name => $::neutron::params::linuxbridge_server_package, - tag => 'openstack', - } - } - } - - neutron_plugin_linuxbridge { - 'LINUX_BRIDGE/physical_interface_mappings': value => $physical_interface_mappings; - 'SECURITYGROUP/firewall_driver': value => $firewall_driver; - } - - if $manage_service { - if $enable { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - service { 'neutron-plugin-linuxbridge-service': - ensure => $service_ensure, - name => $::neutron::params::linuxbridge_agent_service, - enable => $enable, - } -} diff --git a/manifests/agents/ovs.pp b/manifests/agents/ovs.pp deleted file mode 100644 index 65246b9c0..000000000 --- a/manifests/agents/ovs.pp +++ /dev/null @@ -1,163 +0,0 @@ -# == Class: neutron::agents::ovs -# -# Setups OVS neutron agent. -# -# === Parameters -# -# [*firewall_driver*] -# (optional) Firewall driver for realizing neutron security group function. -# Defaults to 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver'. -# -class neutron::agents::ovs ( - $package_ensure = 'present', - $manage_service = true, - $enabled = true, - $bridge_uplinks = [], - $bridge_mappings = [], - $integration_bridge = 'br-int', - $enable_tunneling = false, - $tunnel_types = [], - $local_ip = false, - $tunnel_bridge = 'br-tun', - $vxlan_udp_port = 4789, - $polling_interval = 2, - $firewall_driver = 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', - $veth_mtu = undef -) { - - include ::neutron::params - require vswitch::ovs - - if $enable_tunneling and ! $local_ip { - fail('Local ip for ovs agent must be set when tunneling is enabled') - } - - - if $enabled { - Neutron_config<||> ~> Service['neutron-plugin-ovs-service'] - Neutron_plugin_ovs<||> ~> Service['neutron-plugin-ovs-service'] - Neutron::Plugins::Ovs::Bridge<||> -> Service['neutron-plugin-ovs-service'] - Neutron::Plugins::Ovs::Port<||> -> Service['neutron-plugin-ovs-service'] - Vs_bridge<||> -> Service['neutron-plugin-ovs-service'] - } - - if ($bridge_mappings != []) { - # bridge_mappings are used to describe external networks that are - # *directly* attached to this machine. - # (This has nothing to do with VM-VM comms over neutron virtual networks.) - # Typically, the network node - running L3 agent - will want one external - # network (often this is on the control node) and the other nodes (all the - # compute nodes) will want none at all. The only other reason you will - # want to add networks here is if you're using provider networks, in which - # case you will name the network with bridge_mappings and add the server's - # interfaces that are attached to that network with bridge_uplinks. - # (The bridge names can be nearly anything, they just have to match between - # mappings and uplinks; they're what the OVS switches will get named.) - - # Set config for bridges that we're going to create - # The OVS neutron plugin will talk in terms of the networks in the bridge_mappings - $br_map_str = join($bridge_mappings, ',') - neutron_plugin_ovs { - 'OVS/bridge_mappings': value => $br_map_str; - } - neutron::plugins::ovs::bridge{ $bridge_mappings: } - neutron::plugins::ovs::port{ $bridge_uplinks: } - } - - neutron_plugin_ovs { - 'AGENT/polling_interval': value => $polling_interval; - 'OVS/integration_bridge': value => $integration_bridge; - } - - if ($firewall_driver) { - neutron_plugin_ovs { 'SECURITYGROUP/firewall_driver': - value => $firewall_driver - } - } else { - neutron_plugin_ovs { 'SECURITYGROUP/firewall_driver': ensure => absent } - } - - vs_bridge { $integration_bridge: - ensure => present, - } - - if $enable_tunneling { - vs_bridge { $tunnel_bridge: - ensure => present, - before => Service['neutron-plugin-ovs-service'], - } - neutron_plugin_ovs { - 'OVS/enable_tunneling': value => true; - 'OVS/tunnel_bridge': value => $tunnel_bridge; - 'OVS/local_ip': value => $local_ip; - } - - if size($tunnel_types) > 0 { - neutron_plugin_ovs { - 'agent/tunnel_types': value => join($tunnel_types, ','); - } - } - if 'vxlan' in $tunnel_types { - validate_vxlan_udp_port($vxlan_udp_port) - neutron_plugin_ovs { - 'agent/vxlan_udp_port': value => $vxlan_udp_port; - } - } - } else { - neutron_plugin_ovs { - 'OVS/enable_tunneling': value => false; - 'OVS/tunnel_bridge': ensure => absent; - 'OVS/local_ip': ensure => absent; - } - } - - - if $::neutron::params::ovs_agent_package { - Package['neutron-plugin-ovs-agent'] -> Neutron_plugin_ovs<||> - package { 'neutron-plugin-ovs-agent': - ensure => $package_ensure, - name => $::neutron::params::ovs_agent_package, - tag => 'openstack', - } - } else { - # Some platforms (RedHat) do not provide a separate - # neutron plugin ovs agent package. The configuration file for - # the ovs agent is provided by the neutron ovs plugin package. - Package['neutron-plugin-ovs'] -> Neutron_plugin_ovs<||> - Package['neutron-plugin-ovs'] -> Service['ovs-cleanup-service'] - - ensure_resource('package', 'neutron-plugin-ovs', { - ensure => $package_ensure, - name => $::neutron::params::ovs_server_package, - tag => 'openstack', - }) - } - - if $manage_service { - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - service { 'neutron-plugin-ovs-service': - ensure => $service_ensure, - name => $::neutron::params::ovs_agent_service, - enable => $enabled, - require => Class['neutron'], - } - - if $::neutron::params::ovs_cleanup_service { - service {'ovs-cleanup-service': - name => $::neutron::params::ovs_cleanup_service, - enable => $enabled, - } - } - - if $veth_mtu { - neutron_plugin_ovs { 'AGENT/veth_mtu': value => $veth_mtu } - } else { - neutron_plugin_ovs { 'AGENT/veth_mtu': ensure => absent } - } -} diff --git a/manifests/plugins/linuxbridge.pp b/manifests/plugins/linuxbridge.pp deleted file mode 100644 index ce10a6ff8..000000000 --- a/manifests/plugins/linuxbridge.pp +++ /dev/null @@ -1,74 +0,0 @@ -# == Class: neutron::plugins::linuxbridge -# -# Setups linuxbridge plugin for neutron server. -# -# === Parameters -# -# [*sql_connection*] -# sql_connection is no longer configured in the plugin.ini. -# Use $connection in the nuetron::server class to configure the SQL -# connection string. -# -# [*network_vlan_ranges*] -# (required) Comma-separated list of [::] -# tuples enumerating ranges of VLAN IDs on named physical networks that are -# available for allocation. -# -# [*tenant_network_type*] -# (optional) Type of network to allocate for tenant networks. -# Defaults to 'vlan'. -# -# [*package_ensure*] -# (optional) Ensure state for package. Defaults to 'present'. -# -class neutron::plugins::linuxbridge ( - $sql_connection = false, - $network_vlan_ranges = 'physnet1:1000:2000', - $tenant_network_type = 'vlan', - $package_ensure = 'present' -) { - - include ::neutron::params - - Package['neutron'] -> Package['neutron-plugin-linuxbridge'] - Package['neutron-plugin-linuxbridge'] -> Neutron_plugin_linuxbridge<||> - Neutron_plugin_linuxbridge<||> ~> Service<| title == 'neutron-server' |> - Package['neutron-plugin-linuxbridge'] -> Service<| title == 'neutron-server' |> - - if $::operatingsystem == 'Ubuntu' { - file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': - path => '/etc/default/neutron-server', - match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', - line => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::linuxbridge_config_file}", - require => [ - Package['neutron-plugin-linuxbridge'], - Package['neutron-server'], - ], - notify => Service['neutron-server'], - } - } - - package { 'neutron-plugin-linuxbridge': - ensure => $package_ensure, - name => $::neutron::params::linuxbridge_server_package, - tag => 'openstack', - } - - if $sql_connection { - warning('sql_connection is deprecated for connection in the neutron::server class') - } - - neutron_plugin_linuxbridge { - 'VLANS/tenant_network_type': value => $tenant_network_type; - 'VLANS/network_vlan_ranges': value => $network_vlan_ranges; - } - - # In RH, this link is used to start Neutron process but in Debian, it's used only - # to manage database synchronization. - file {'/etc/neutron/plugin.ini': - ensure => link, - target => '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', - require => Package['neutron-plugin-linuxbridge'] - } - -} diff --git a/manifests/plugins/ovs.pp b/manifests/plugins/ovs.pp deleted file mode 100644 index 62db1e824..000000000 --- a/manifests/plugins/ovs.pp +++ /dev/null @@ -1,86 +0,0 @@ -# Configure the neutron server to use the OVS plugin. -# This configures the plugin for the API server, but does nothing -# about configuring the agents that must also run and share a config -# file with the OVS plugin if both are on the same machine. -# -# === Parameters -# -class neutron::plugins::ovs ( - $package_ensure = 'present', - $tenant_network_type = 'vlan', - # NB: don't need tunnel ID range when using VLANs, - # *but* you do need the network vlan range regardless of type, - # because the list of networks there is still important - # even if the ranges aren't specified - # if type is vlan or flat, a default of physnet1:1000:2000 is used - # otherwise this will not be set by default. - $network_vlan_ranges = undef, - $tunnel_id_ranges = '1:1000', - $vxlan_udp_port = 4789 -) { - - include ::neutron::params - - Package['neutron'] -> Package['neutron-plugin-ovs'] - Package['neutron-plugin-ovs'] -> Neutron_plugin_ovs<||> - Neutron_plugin_ovs<||> ~> Service<| title == 'neutron-server' |> - Package['neutron-plugin-ovs'] -> Service<| title == 'neutron-server' |> - - if ! defined(Package['neutron-plugin-ovs']) { - package { 'neutron-plugin-ovs': - ensure => $package_ensure, - name => $::neutron::params::ovs_server_package, - tag => 'openstack', - } - } - - neutron_plugin_ovs { - 'OVS/tenant_network_type': value => $tenant_network_type; - } - - if $tenant_network_type in ['gre', 'vxlan'] { - validate_tunnel_id_ranges($tunnel_id_ranges) - neutron_plugin_ovs { - # this is set by the plugin and the agent - since the plugin node has the agent installed - # we rely on it setting it. - # TODO(ijw): do something with a virtualised node - # 'OVS/enable_tunneling': value => 'True'; - 'OVS/tunnel_id_ranges': value => $tunnel_id_ranges; - 'OVS/tunnel_type': value => $tenant_network_type; - } - } - - validate_vxlan_udp_port($vxlan_udp_port) - neutron_plugin_ovs { 'OVS/vxlan_udp_port': value => $vxlan_udp_port; } - - if ! $network_vlan_ranges { - # If the user hasn't specified vlan_ranges, fail for the modes where - # it is required, otherwise keep it absent - if $tenant_network_type in ['vlan', 'flat'] { - fail('When using the vlan network type, network_vlan_ranges is required') - } else { - neutron_plugin_ovs { 'OVS/network_vlan_ranges': ensure => absent } - } - } else { - # This might be set by the user for the gre or vxlan case where - # provider networks are in use - if !is_array($network_vlan_ranges) { - $arr_network_vlan_ranges = strip(split($network_vlan_ranges, ',')) - } else { - $arr_network_vlan_ranges = $network_vlan_ranges - } - - validate_network_vlan_ranges($arr_network_vlan_ranges) - neutron_plugin_ovs { - 'OVS/network_vlan_ranges': value => join($arr_network_vlan_ranges, ','); - } - } - - # In RH, this link is used to start Neutron process but in Debian, it's used only - # to manage database synchronization. - file {'/etc/neutron/plugin.ini': - ensure => link, - target => '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini', - require => Package['neutron-plugin-ovs'] - } -} diff --git a/spec/classes/neutron_agents_linuxbridge_spec.rb b/spec/classes/neutron_agents_linuxbridge_spec.rb deleted file mode 100644 index d5c9bf531..000000000 --- a/spec/classes/neutron_agents_linuxbridge_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'spec_helper' - -describe 'neutron::agents::linuxbridge' do - - let :pre_condition do - "class { 'neutron': rabbit_password => 'passw0rd' }\n" + - "class { 'neutron::plugins::linuxbridge': }" - end - - let :params do - { :physical_interface_mappings => 'physnet:eth0', - :firewall_driver => 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver', - :package_ensure => 'present', - :enable => true - } - end - - shared_examples_for 'neutron linuxbridge agent' do - - it { is_expected.to contain_class('neutron::params') } - - it 'configures neutron linuxbridge agent service' do - is_expected.to contain_service('neutron-plugin-linuxbridge-service').with( - :ensure => 'running', - :name => platform_params[:linuxbridge_agent_service], - :enable => params[:enable] - ) - end - - context 'with manage_service as false' do - before :each do - params.merge!(:manage_service => false) - end - it 'should not start/stop service' do - is_expected.to contain_service('neutron-plugin-linuxbridge-service').without_ensure - end - end - - it 'configures linuxbridge_conf.ini' do - is_expected.to contain_neutron_plugin_linuxbridge('LINUX_BRIDGE/physical_interface_mappings').with( - :value => params[:physical_interface_mappings] - ) - is_expected.to contain_neutron_plugin_linuxbridge('SECURITYGROUP/firewall_driver').with( - :value => params[:firewall_driver] - ) - end - end - - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - let :platform_params do - { :linuxbridge_agent_package => 'neutron-plugin-linuxbridge-agent', - :linuxbridge_agent_service => 'neutron-plugin-linuxbridge-agent' } - end - - it_configures 'neutron linuxbridge agent' - - it 'installs neutron linuxbridge agent package' do - is_expected.to contain_package('neutron-plugin-linuxbridge-agent').with( - :ensure => params[:package_ensure], - :name => platform_params[:linuxbridge_agent_package], - :tag => 'openstack' - ) - end - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat' } - end - - let :platform_params do - { :linuxbridge_server_package => 'openstack-neutron-linuxbridge', - :linuxbridge_agent_service => 'neutron-linuxbridge-agent' } - end - - it_configures 'neutron linuxbridge agent' - - it 'installs neutron linuxbridge package' do - is_expected.to contain_package('neutron-plugin-linuxbridge').with( - :ensure => params[:package_ensure], - :name => platform_params[:linuxbridge_server_package], - :tag => 'openstack' - ) - end - end -end diff --git a/spec/classes/neutron_agents_ovs_spec.rb b/spec/classes/neutron_agents_ovs_spec.rb deleted file mode 100644 index b81fa236f..000000000 --- a/spec/classes/neutron_agents_ovs_spec.rb +++ /dev/null @@ -1,200 +0,0 @@ -require 'spec_helper' - -describe 'neutron::agents::ovs' do - - let :pre_condition do - "class { 'neutron': rabbit_password => 'passw0rd' }\n" + - "class { 'neutron::plugins::ovs': network_vlan_ranges => 'physnet1:1000:2000' }" - end - - let :default_params do - { :package_ensure => 'present', - :manage_service => true, - :enabled => true, - :bridge_uplinks => [], - :bridge_mappings => [], - :integration_bridge => 'br-int', - :enable_tunneling => false, - :local_ip => false, - :tunnel_bridge => 'br-tun', - :polling_interval => 2, - :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', - :veth_mtu => '' - } - end - - let :params do - {} - end - - shared_examples_for 'neutron plugin ovs agent' do - let :p do - default_params.merge(params) - end - - it { is_expected.to contain_class('neutron::params') } - - it 'configures ovs_neutron_plugin.ini' do - is_expected.to contain_neutron_plugin_ovs('AGENT/polling_interval').with_value(p[:polling_interval]) - is_expected.to contain_neutron_plugin_ovs('OVS/integration_bridge').with_value(p[:integration_bridge]) - is_expected.to contain_neutron_plugin_ovs('SECURITYGROUP/firewall_driver').\ - with_value(p[:firewall_driver]) - is_expected.to contain_neutron_plugin_ovs('OVS/enable_tunneling').with_value(false) - is_expected.to contain_neutron_plugin_ovs('OVS/tunnel_bridge').with_ensure('absent') - is_expected.to contain_neutron_plugin_ovs('OVS/local_ip').with_ensure('absent') - is_expected.to contain_neutron_plugin_ovs('AGENT/veth_mtu').with_ensure('absent') - end - - it 'configures vs_bridge' do - is_expected.to contain_vs_bridge(p[:integration_bridge]).with_ensure('present') - end - - it 'installs neutron ovs agent package' do - if platform_params.has_key?(:ovs_agent_package) - is_expected.to contain_package('neutron-plugin-ovs-agent').with( - :name => platform_params[:ovs_agent_package], - :ensure => p[:package_ensure], - :tag => 'openstack' - ) - is_expected.to contain_package('neutron-plugin-ovs-agent').with_before(/Neutron_plugin_ovs\[.+\]/) - else - is_expected.to contain_package('neutron-plugin-ovs').with_before(/Neutron_plugin_ovs\[.+\]/) - end - end - - it 'configures neutron ovs agent service' do - is_expected.to contain_service('neutron-plugin-ovs-service').with( - :name => platform_params[:ovs_agent_service], - :enable => true, - :ensure => 'running', - :require => 'Class[Neutron]' - ) - end - - context 'with veth_mtu set' do - before :each do - params.merge(:veth_mtu => '9000') - end - - it 'should set the veth_mtu on the ovs agent' do - is_expected.to contain_neutron_plugin_ovs('AGENT/veth_mtu').with_value(params[:veth_mtu]) - end - end - - context 'when not installing ovs agent package' do - before :each do - params.merge!(:package_ensure => 'absent') - end - it 'uninstalls neutron ovs agent package' do - if platform_params.has_key?(:ovs_agent_package) - is_expected.to contain_package('neutron-plugin-ovs-agent').with( - :name => platform_params[:ovs_agent_package], - :ensure => p[:package_ensure], - :tag => 'openstack' - ) - end - end - end - - context 'when supplying a firewall driver' do - before :each do - params.merge!(:firewall_driver => false) - end - it 'should configure firewall driver' do - is_expected.to contain_neutron_plugin_ovs('SECURITYGROUP/firewall_driver').with_ensure('absent') - end - end - - context 'when supplying bridge mappings for provider networks' do - before :each do - params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex']) - end - - it 'configures bridge mappings' do - is_expected.to contain_neutron_plugin_ovs('OVS/bridge_mappings') - end - - it 'should configure bridge mappings' do - is_expected.to contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with( - :before => 'Service[neutron-plugin-ovs-service]' - ) - end - - it 'should configure bridge uplinks' do - is_expected.to contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with( - :before => 'Service[neutron-plugin-ovs-service]' - ) - end - end - - context 'when enabling tunneling' do - context 'without local ip address' do - before :each do - params.merge!(:enable_tunneling => true) - end - - it_raises 'a Puppet::Error', /Local ip for ovs agent must be set when tunneling is enabled/ - end - - context 'with default params' do - before :each do - params.merge!(:enable_tunneling => true, :local_ip => '127.0.0.1' ) - end - it 'should configure ovs for tunneling' do - is_expected.to contain_neutron_plugin_ovs('OVS/enable_tunneling').with_value(true) - is_expected.to contain_neutron_plugin_ovs('OVS/tunnel_bridge').with_value(default_params[:tunnel_bridge]) - is_expected.to contain_neutron_plugin_ovs('OVS/local_ip').with_value('127.0.0.1') - is_expected.to contain_vs_bridge(default_params[:tunnel_bridge]).with_ensure('present') - end - end - - context 'with vxlan tunneling' do - before :each do - params.merge!(:enable_tunneling => true, - :local_ip => '127.0.0.1', - :tunnel_types => ['vxlan'], - :vxlan_udp_port => '4789') - end - - it 'should perform vxlan network configuration' do - is_expected.to contain_neutron_plugin_ovs('agent/tunnel_types').with_value(params[:tunnel_types]) - is_expected.to contain_neutron_plugin_ovs('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port]) - end - end - end - end - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - let :platform_params do - { :ovs_agent_package => 'neutron-plugin-openvswitch-agent', - :ovs_agent_service => 'neutron-plugin-openvswitch-agent' } - end - - it_configures 'neutron plugin ovs agent' - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat' } - end - - let :platform_params do - { :ovs_cleanup_service => 'neutron-ovs-cleanup', - :ovs_agent_service => 'neutron-openvswitch-agent' } - end - - it_configures 'neutron plugin ovs agent' - it 'configures neutron ovs cleanup service' do - is_expected.to contain_service('ovs-cleanup-service').with( - :name => platform_params[:ovs_cleanup_service], - :enable => true - ) - is_expected.to contain_package('neutron-plugin-ovs').with_before(/Service\[ovs-cleanup-service\]/) - end - - end -end diff --git a/spec/classes/neutron_plugins_linuxbridge_spec.rb b/spec/classes/neutron_plugins_linuxbridge_spec.rb deleted file mode 100644 index e0285afe1..000000000 --- a/spec/classes/neutron_plugins_linuxbridge_spec.rb +++ /dev/null @@ -1,93 +0,0 @@ -require 'spec_helper' - -describe 'neutron::plugins::linuxbridge' do - - let :pre_condition do - "class { 'neutron': rabbit_password => 'passw0rd' }" - end - - let :params do - { :sql_connection => false, - :network_vlan_ranges => 'physnet0:100:109', - :tenant_network_type => 'vlan', - :package_ensure => 'installed' - } - end - - shared_examples_for 'neutron linuxbridge plugin' do - - it { is_expected.to contain_class('neutron::params') } - - it 'installs neutron linuxbridge plugin package' do - is_expected.to contain_package('neutron-plugin-linuxbridge').with( - :ensure => params[:package_ensure], - :name => platform_params[:linuxbridge_plugin_package], - :tag => 'openstack' - ) - end - - it 'configures linuxbridge_conf.ini' do - is_expected.to contain_neutron_plugin_linuxbridge('VLANS/tenant_network_type').with( - :value => params[:tenant_network_type] - ) - is_expected.to contain_neutron_plugin_linuxbridge('VLANS/network_vlan_ranges').with( - :value => params[:network_vlan_ranges] - ) - end - - it 'should create plugin symbolic link' do - is_expected.to contain_file('/etc/neutron/plugin.ini').with( - :ensure => 'link', - :target => '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', - :require => 'Package[neutron-plugin-linuxbridge]' - ) - end - end - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - let :platform_params do - { :linuxbridge_plugin_package => 'neutron-plugin-linuxbridge' } - end - - context 'on Ubuntu operating systems' do - before do - facts.merge!({:operatingsystem => 'Ubuntu'}) - end - - it 'configures /etc/default/neutron-server' do - is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with( - :path => '/etc/default/neutron-server', - :match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', - :line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', - :require => ['Package[neutron-plugin-linuxbridge]', 'Package[neutron-server]'], - :notify => 'Service[neutron-server]' - ) - end - it_configures 'neutron linuxbridge plugin' - end - - context 'on Debian operating systems' do - before do - facts.merge!({:operatingsystem => 'Debian'}) - end - - it_configures 'neutron linuxbridge plugin' - end - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat' } - end - - let :platform_params do - { :linuxbridge_plugin_package => 'openstack-neutron-linuxbridge' } - end - - it_configures 'neutron linuxbridge plugin' - end -end diff --git a/spec/classes/neutron_plugins_ovs_spec.rb b/spec/classes/neutron_plugins_ovs_spec.rb deleted file mode 100644 index 0cd45ce5e..000000000 --- a/spec/classes/neutron_plugins_ovs_spec.rb +++ /dev/null @@ -1,203 +0,0 @@ -require 'spec_helper' - -describe 'neutron::plugins::ovs' do - - let :pre_condition do - "class { 'neutron': rabbit_password => 'passw0rd' }" - end - - let :default_params do - { - :package_ensure => 'present', - :tunnel_id_ranges => '1:1000', - :network_vlan_ranges => 'physnet1:1000:2000' - } - end - - let :params do - { } - end - - shared_examples_for 'neutron ovs plugin' do - before do - params.merge!(default_params) { |key, v1, v2| v1 } - end - - let :params do - { :tenant_network_type => 'vlan' } - end - - it 'should create plugin symbolic link' do - is_expected.to contain_file('/etc/neutron/plugin.ini').with( - :ensure => 'link', - :target => '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini', - :require => 'Package[neutron-plugin-ovs]' - ) - end - - it 'should perform default configuration of' do - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - is_expected.to contain_package('neutron-plugin-ovs').with( - :name => platform_params[:ovs_server_package], - :ensure => params[:package_ensure], - :tag => 'openstack' - ) - is_expected.not_to contain_class('vswitch::ovs') - end - - context 'with vlan mode' do - let :params do - { :tenant_network_type => 'vlan' } - end - - it 'should perform vlan network configuration' do - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges]) - end - end - - context 'with gre tunneling' do - let :params do - { :tenant_network_type => 'gre', :tunnel_id_ranges => '1:1000'} - end - - before do - params.delete(:network_vlan_ranges) - end - - it 'should perform gre network configuration' do - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - is_expected.to contain_neutron_plugin_ovs('OVS/tunnel_id_ranges').with_value(params[:tunnel_id_ranges]) - is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_ensure('absent') - end - end - - context 'with gre tunneling and provider networks' do - let :params do - { :tenant_network_type => 'gre', - :network_vlan_ranges => 'physnet1:1000:2000', - :tunnel_id_ranges => '1:1000'} - end - - it 'should perform gre network configuration' do - is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges]) - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - is_expected.to contain_neutron_plugin_ovs('OVS/tunnel_id_ranges').with_value(params[:tunnel_id_ranges]) - end - end - - context 'with vxlan tunneling' do - let :params do - { :tenant_network_type => 'vxlan', - :vxlan_udp_port => '4789'} - end - - before do - params.delete(:network_vlan_ranges) - end - - it 'should perform vxlan network configuration' do - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - is_expected.to contain_neutron_plugin_ovs('OVS/vxlan_udp_port').with_value(params[:vxlan_udp_port]) - is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_ensure('absent') - end - end - - context 'with vxlan tunnelling using bad vxlan_udp_port' do - let :params do - { :tenant_network_type => 'vxlan', - :vxlan_udp_port => '1',} - end - - it_raises 'a Puppet::Error', /vxlan udp port is invalid./ - end - - context 'with vxlan tunnelling using bad tunnel_id_ranges' do - let :params do - { :tenant_network_type => 'vxlan', - :tunnel_id_ranges => '100:9',} - end - - it_raises 'a Puppet::Error', /tunnel id ranges are invalid./ - end - - context 'with vxlan tunneling and provider networks using bad network_vlan_ranges' do - let :params do - { :tenant_network_type => 'vxlan', - :network_vlan_ranges => 'physnet1:200:1'} - end - - it_raises 'a Puppet::Error', /network vlan ranges are invalid./ - end - - context 'with vxlan tunneling using bad multiple network_vlan_ranges' do - let :params do - { :tenant_network_type => 'vxlan', - :network_vlan_ranges => ['physnet1:0:100', 'physnet2:1000:1']} - end - - it_raises 'a Puppet::Error', /network vlan ranges are invalid/ - end - - context 'with vxlan tunneling and provider networks' do - let :params do - { :tenant_network_type => 'vxlan', - :network_vlan_ranges => 'physnet1:1000:2000'} - end - - it 'should perform vxlan network configuration' do - is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges]) - is_expected.to contain_neutron_plugin_ovs('OVS/tenant_network_type').with_value(params[:tenant_network_type]) - end - end - - context 'with a flat network' do - let :params do - { :tenant_network_type => 'flat'} - end - it { is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges]) } - end - - context 'with comma separated vlan ranges' do - let :params do - { :network_vlan_ranges => 'physint1:1000:2000,physext1:100:200' } - end - it { is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges]) } - end - - context 'with vlan ranges in array' do - let :params do - { :network_vlan_ranges => ['physint1:1000:2000', 'physext1:100:200'] } - end - it { is_expected.to contain_neutron_plugin_ovs('OVS/network_vlan_ranges').with_value(params[:network_vlan_ranges].join(',')) } - end - end - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - let :platform_params do - { :ovs_server_package => 'neutron-plugin-openvswitch' } - end - - it_configures 'neutron ovs plugin' - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat' } - end - - let :params do - { :network_vlan_ranges => 'physnet1:1000:2000' } - end - - let :platform_params do - { :ovs_server_package => 'openstack-neutron-openvswitch' } - end - - it_configures 'neutron ovs plugin' - end -end